mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
Meta.pm: remove JSON::MaybeXS from metadata but keep compatibility
git-svn-id: https://svn.fhem.de/fhem/trunk@19217 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
96fdfe63c8
commit
476c7cbbdb
@ -34,6 +34,44 @@ use FHEM::Meta;
|
||||
use GPUtils qw(GP_Import);
|
||||
use Data::Dumper;
|
||||
|
||||
# Run before module compilation
|
||||
BEGIN {
|
||||
|
||||
# JSON preference order
|
||||
$ENV{PERL_JSON_BACKEND} =
|
||||
'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP'
|
||||
unless ( defined( $ENV{PERL_JSON_BACKEND} ) );
|
||||
|
||||
# Import from main::
|
||||
GP_Import(
|
||||
qw(
|
||||
readingsSingleUpdate
|
||||
readingsBulkUpdate
|
||||
readingsBulkUpdateIfChanged
|
||||
readingsBeginUpdate
|
||||
readingsEndUpdate
|
||||
ReadingsTimestamp
|
||||
defs
|
||||
modules
|
||||
Log3
|
||||
Debug
|
||||
DoTrigger
|
||||
CommandAttr
|
||||
attr
|
||||
AttrVal
|
||||
ReadingsVal
|
||||
Value
|
||||
IsDisabled
|
||||
deviceEvents
|
||||
init_done
|
||||
gettimeofday
|
||||
InternalTimer
|
||||
RemoveInternalTimer
|
||||
FW_webArgs
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
# try to use JSON::MaybeXS wrapper
|
||||
# for chance of better performance + open code
|
||||
eval {
|
||||
@ -87,38 +125,6 @@ if ($@) {
|
||||
}
|
||||
}
|
||||
|
||||
# Run before module compilation
|
||||
BEGIN {
|
||||
# Import from main::
|
||||
GP_Import(
|
||||
qw(
|
||||
readingsSingleUpdate
|
||||
readingsBulkUpdate
|
||||
readingsBulkUpdateIfChanged
|
||||
readingsBeginUpdate
|
||||
readingsEndUpdate
|
||||
ReadingsTimestamp
|
||||
defs
|
||||
modules
|
||||
Log3
|
||||
Debug
|
||||
DoTrigger
|
||||
CommandAttr
|
||||
attr
|
||||
AttrVal
|
||||
ReadingsVal
|
||||
Value
|
||||
IsDisabled
|
||||
deviceEvents
|
||||
init_done
|
||||
gettimeofday
|
||||
InternalTimer
|
||||
RemoveInternalTimer
|
||||
FW_webArgs
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
my %fhem_npm_modules = (
|
||||
'alexa-fhem' => { fhem_module => 'alexa', },
|
||||
'gassistant-fhem' => { fhem_module => 'gassistant', },
|
||||
@ -1846,8 +1852,7 @@ sub ToDay() {
|
||||
"SubProcess": 0
|
||||
},
|
||||
"recommends": {
|
||||
"JSON": 0,
|
||||
"JSON::MaybeXS": 0
|
||||
"JSON": 0
|
||||
},
|
||||
"suggests": {
|
||||
"Cpanel::JSON::XS": 0,
|
||||
|
@ -41,6 +41,51 @@ use Data::Dumper;
|
||||
use Config;
|
||||
use ExtUtils::Installed;
|
||||
|
||||
# Run before module compilation
|
||||
BEGIN {
|
||||
|
||||
# JSON preference order
|
||||
$ENV{PERL_JSON_BACKEND} =
|
||||
'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP'
|
||||
unless ( defined( $ENV{PERL_JSON_BACKEND} ) );
|
||||
|
||||
# Import from main::
|
||||
GP_Import(
|
||||
qw(
|
||||
attr
|
||||
AttrVal
|
||||
cmds
|
||||
CommandAttr
|
||||
Debug
|
||||
defs
|
||||
deviceEvents
|
||||
devspec2array
|
||||
DoTrigger
|
||||
FW_webArgs
|
||||
gettimeofday
|
||||
init_done
|
||||
InternalTimer
|
||||
IsDisabled
|
||||
LoadModule
|
||||
Log
|
||||
Log3
|
||||
maxNum
|
||||
modules
|
||||
packages
|
||||
readingsBeginUpdate
|
||||
readingsBulkUpdate
|
||||
readingsBulkUpdateIfChanged
|
||||
readingsEndUpdate
|
||||
readingsSingleUpdate
|
||||
ReadingsTimestamp
|
||||
ReadingsVal
|
||||
RemoveInternalTimer
|
||||
TimeNow
|
||||
Value
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
# try to use JSON::MaybeXS wrapper
|
||||
# for chance of better performance + open code
|
||||
eval {
|
||||
@ -86,53 +131,25 @@ if ($@) {
|
||||
|
||||
# Fallback to built-in JSON which SHOULD
|
||||
# be available since 5.014 ...
|
||||
require JSON::PP;
|
||||
import JSON::PP qw(decode_json encode_json);
|
||||
1;
|
||||
eval {
|
||||
require JSON::PP;
|
||||
import JSON::PP qw(decode_json encode_json);
|
||||
1;
|
||||
};
|
||||
|
||||
if ($@) {
|
||||
$@ = undef;
|
||||
|
||||
# Fallback to JSON::backportPP in really rare cases
|
||||
require JSON::backportPP;
|
||||
import JSON::backportPP qw(decode_json encode_json);
|
||||
1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Run before module compilation
|
||||
BEGIN {
|
||||
# Import from main::
|
||||
GP_Import(
|
||||
qw(
|
||||
attr
|
||||
AttrVal
|
||||
cmds
|
||||
CommandAttr
|
||||
Debug
|
||||
defs
|
||||
deviceEvents
|
||||
devspec2array
|
||||
DoTrigger
|
||||
FW_webArgs
|
||||
gettimeofday
|
||||
init_done
|
||||
InternalTimer
|
||||
IsDisabled
|
||||
LoadModule
|
||||
Log
|
||||
Log3
|
||||
maxNum
|
||||
modules
|
||||
packages
|
||||
readingsBeginUpdate
|
||||
readingsBulkUpdate
|
||||
readingsBulkUpdateIfChanged
|
||||
readingsEndUpdate
|
||||
readingsSingleUpdate
|
||||
ReadingsTimestamp
|
||||
ReadingsVal
|
||||
RemoveInternalTimer
|
||||
TimeNow
|
||||
Value
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
# Load dependent FHEM modules as packages,
|
||||
# no matter if user also defined FHEM devices or not.
|
||||
# We want to use their functions here :-)
|
||||
@ -1032,7 +1049,7 @@ sub CpanInstall($) {
|
||||
print qq($line\n) if ( $cmd->{debug} == 1 );
|
||||
|
||||
if ( $line =~
|
||||
/^Successfully\s+(\S+)\s+([\S]+)-(\d+\.\d+(?:_\d+)?).*$/i )
|
||||
/^Successfully\s+(\S+)\s+([\S]+)-(\d+(?:\.\d+(?:_\d+)?)?).*$/i )
|
||||
{
|
||||
my $r = $1;
|
||||
my $m = $2;
|
||||
@ -1044,7 +1061,8 @@ sub CpanInstall($) {
|
||||
}
|
||||
|
||||
elsif ( $line =~
|
||||
/^(\S+)\s+is\s+up\s+to\s+date.*\((\d+\.\d+(?:_\d+)?)\).*$/i )
|
||||
/^(\S+)\s+is\s+up\s+to\s+date.*\((\d+(?:\.\d+(?:_\d+)?)?)\).*$/i
|
||||
)
|
||||
{
|
||||
my $m = $1;
|
||||
my $v = $2;
|
||||
@ -5483,8 +5501,7 @@ sub __list_module {
|
||||
},
|
||||
"recommends": {
|
||||
"Perl::PrereqScanner::NotQuiteLite": 0,
|
||||
"JSON": 0,
|
||||
"JSON::MaybeXS": 0
|
||||
"JSON": 0
|
||||
},
|
||||
"suggests": {
|
||||
"Cpanel::JSON::XS": 0,
|
||||
|
@ -22,6 +22,11 @@ use Encode;
|
||||
# Run before module compilation
|
||||
BEGIN {
|
||||
|
||||
# JSON preference order
|
||||
$ENV{PERL_JSON_BACKEND} =
|
||||
'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP'
|
||||
unless ( defined( $ENV{PERL_JSON_BACKEND} ) );
|
||||
|
||||
# Import from main::
|
||||
GP_Import(
|
||||
qw(
|
||||
@ -1293,6 +1298,18 @@ m/(^#\s+(?:\d{1,2}\.\d{1,2}\.(?:\d{2}|\d{4})\s+)?[^v\d]*(v?(?:\d{1,3}\.\d{1,3}(?
|
||||
import JSON::PP qw(decode_json encode_json);
|
||||
1;
|
||||
};
|
||||
|
||||
if ($@) {
|
||||
$@ = undef;
|
||||
|
||||
# Fallback to JSON::backportPP in really rare cases
|
||||
eval {
|
||||
require JSON::backportPP;
|
||||
import JSON::backportPP
|
||||
qw(decode_json encode_json);
|
||||
1;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3155,7 +3172,6 @@ sub __SetXVersion {
|
||||
},
|
||||
"recommends": {
|
||||
"JSON": 0,
|
||||
"JSON::MaybeXS": 0,
|
||||
"Perl::PrereqScanner::NotQuiteLite": 0,
|
||||
"Time::Local": 0
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user