diff --git a/98_EaseeWallbox.pm b/98_EaseeWallbox.pm index 1e28bfc..2c0a6a3 100644 --- a/98_EaseeWallbox.pm +++ b/98_EaseeWallbox.pm @@ -13,58 +13,58 @@ use DateTime::Format::Strptime; # try to use JSON::MaybeXS wrapper # for chance of better performance + open code -#eval { -# require JSON::MaybeXS; -# import JSON::MaybeXS qw( decode_json encode_json ); -# 1; -#} or do { +eval { + require JSON::MaybeXS; + import JSON::MaybeXS qw( decode_json encode_json ); + 1; +} or do { # try to use JSON wrapper # for chance of better performance - # eval { + eval { # JSON preference order - # local $ENV{PERL_JSON_BACKEND} = - # 'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP' - # unless ( defined( $ENV{PERL_JSON_BACKEND} ) ); + local $ENV{PERL_JSON_BACKEND} = + 'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP' + unless ( defined( $ENV{PERL_JSON_BACKEND} ) ); - # require JSON; - # import JSON qw( decode_json encode_json ); - # 1; - # } or do { + require JSON; + import JSON qw( decode_json encode_json ); + 1; + } or do { # In rare cases, Cpanel::JSON::XS may # be installed but JSON|JSON::MaybeXS not ... -# eval { -# require Cpanel::JSON::XS; -# import Cpanel::JSON::XS qw(decode_json encode_json); -# 1; -# } or do { + eval { + require Cpanel::JSON::XS; + import Cpanel::JSON::XS qw(decode_json encode_json); + 1; + } or do { # In rare cases, JSON::XS may # be installed but JSON not ... - # eval { - # require JSON::XS; - # import JSON::XS qw(decode_json encode_json); - # 1; - # } or do { + eval { + require JSON::XS; + import JSON::XS qw(decode_json encode_json); + 1; + } or do { # Fallback to built-in JSON which SHOULD # be available since 5.014 ... - # eval { - # require JSON::PP; - # import JSON::PP qw(decode_json encode_json); - # 1; - # } or do { + eval { + require JSON::PP; + import JSON::PP qw(decode_json encode_json); + 1; + } or do { # Fallback to JSON::backportPP in really rare cases - # require JSON::backportPP; - # import JSON::backportPP qw(decode_json encode_json); - # 1; - # }; - # }; - # }; - # }; -#}; + require JSON::backportPP; + import JSON::backportPP qw(decode_json encode_json); + 1; + }; + }; + }; + }; +}; # Import von Funktionen und/oder Variablen aus der FHEM main # man kann ::Funktionaname wählen und sich so den Import schenken. Variablen sollten aber