se
{
$new = CORE::bless( $hash => $class );
}
CORE::return( $new );
}
sub TO_JSON { return( shift->as_string ); }
# NOTE: Locale::Intl::Boolean class
package Locale::Intl::Boolea
$self );
}
else
{
CORE::return( $class->new( $str ) );
}
}
sub TO_JSON
{
# JSON does not check that the value is a proper true or false. It stupidly assumes this is a str
gets L<the most likely values|https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/supplemental/likelySubtags.json> for the C<language>, C<script>, and C<region> of this L<locale|Lo
h =
{
name => 'John Doe',
active => $bool,
};
# Converting to json
print( JSON->new->encode( $hash ), "\n" );
# Would result in
{
name: "Jogn Doe",
<JSON> bool, i.e. C<true> or C<false>
The code is taken and adapted from part of L<JSON> module.
=head1 METHODS
=head2 true
This returns a perl true value i.e. 1 or C<true> when added into L<JSON>
ded into L<JSON>
=head2 TO_JSON
This is called by L<JSON> to transform an object into json data format.
It returns C<\1> if true, or C<\0> otherwise. Those values are understood by L<JSON> and tran
nd call L<perlfunc/"die"> with it.
=head2 TO_JSON
Special method called by L<JSON> to transform this object into a string suitable to be added in a json data.
=head2 type
Set or get the error type
STORABLE_freeze
=for Pod::Coverage STORABLE_thaw
=for Pod::Coverage THAW
=for Pod::Coverage TO_JSON
Serialisation by L<CBOR|CBOR::XS>, L<Sereal> and L<Storable::Improved> (or the legacy L<Storable