Fix Perl cannot string bind undef (#13114)

* fix and add perl client tests

* fixed undefined value in Perl

* update perl client sample

* fix test case
This commit is contained in:
AnaTofuZ
2022-08-06 22:05:37 +09:00
committed by GitHub
parent f73decb0f0
commit 462f927b87
54 changed files with 318 additions and 13 deletions

View File

@@ -256,10 +256,12 @@ sub deserialize
} elsif (grep /^$class$/, ('DATE_TIME', 'DATE')) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ($class eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($class eq 'object') {
return $data;
} elsif (grep /^$class$/, ('int', 'float', 'double')) {
return undef unless defined $data;
return $data + 0;
} elsif ($class eq 'bool') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -131,21 +131,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -196,8 +200,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -131,21 +131,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -196,8 +200,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -140,21 +140,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -208,8 +212,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -140,21 +140,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -208,8 +212,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -134,21 +134,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -199,8 +203,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -131,21 +131,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -196,8 +200,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -131,21 +131,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -196,8 +200,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -131,21 +131,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -196,8 +200,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -131,21 +131,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -196,8 +200,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -131,21 +131,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -196,8 +200,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -132,21 +132,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -197,8 +201,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;

View File

@@ -130,21 +130,25 @@ sub _to_json_primitives {
if ( grep( /^$type$/, ('int', 'double'))) {
# https://metacpan.org/pod/JSON#simple-scalars
# numify it, ensuring it will be dumped as a number
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
# https://metacpan.org/pod/JSON#simple-scalars
# stringified
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
return $data ? \1 : \0;
} elsif ($type eq 'DATE') {
return undef unless defined $data;
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
return $data->ymd;
}
return $data .q();
} elsif ($type eq 'DATE_TIME') {
return undef unless defined $data;
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
if (ref($data) eq 'DateTime') {
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
@@ -195,8 +199,10 @@ sub _deserialize {
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double'))) {
return undef unless defined $data;
return $data + 0;
} elsif ($type eq 'string') {
return undef unless defined $data;
return $data . q();
} elsif ($type eq 'boolean') {
return !!$data;