view release on metacpan or search on metacpan
lib/Data/Petitcom/Resource/PRG.pm view on Meta::CPAN
}
sub _decode {
my $binary = shift;
my ( $zenkaku, $encoding ) = @_;
my $decoded = '';
for my $i ( 0 .. ( bytes::length($binary) - 1 ) ) {
my $byte = bytes::substr( $binary, $i, 1 );
$decoded .= load_char($byte);
}
if ($zenkaku) {
# $decoded = Unicode::Japanese->new($decoded)->h2zKanaK->get;
# $decoded = Unicode::Japanese->new($decoded)->h2z->get;
$decoded = Unicode::Japanese->new($decoded)->h2zKanaK->h2z->getu;
}
if ($encoding) {
Encode::from_to( $decoded, 'utf8', $encoding );
}
return $decoded;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Presenter.pm view on Meta::CPAN
where C<11> mapped to 'Monday, 9:00 am', C<12> to 'Monday, 10:00 am', C<51>
to 'Friday, 9:00 am' and so forth and where the fields underlying this output
were 'timeslot', 'classname', 'instructor', 'room' and 'sessionID'. While
this presentation is useful, a client might wish to have the time slots and
instructor IDs decoded for more readable output:
Monday, 9:00 Arithmetic E Jones 4044 4044_11
Monday, 9:00 Language Studies T Wilson 4054 4054_11
Monday, 10:00 Bible Study M Eliade 4068 4068_12
Monday, 10:00 Introduction to Computers D Knuth 4086 4086_12
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Printer/Filter/JSON.pm view on Meta::CPAN
our $VERSION = '0.3';
=head1 NAME
Data::Printer::Filter::JSON - pretty-print your decoded JSON structures!
=head1 VERSION
Version 0.03
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Printer/Config.pm view on Meta::CPAN
; it will expose $obj (the data structure to be parsed) and $ddp
; (data printer's object). YOU MAY ONLY DO THIS IF YOUR FILE IS ONLY
; READABLE AND WRITEABLE BY THE USER (i.e. chmod 0600).
begin filter HTTP::Request
return $ddp->maybe_colorize($obj->method . ' ' . $obj->uri, 'string')
. $obj->decoded_content;
end filter
=head1 PUBLIC INTERFACE
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Radius/Decode.pm view on Meta::CPAN
my $attr = $dict->tlv_attribute_name($parent, $attr_id);
if (! $attr) {
push @list, {Name => $attr_id, Value => $attr_val, Unknown => 1};
}
else {
my $decoded = decode($attr, $attr_val, $dict);
if (is_enum_type($attr->{type})) {
$decoded = $dict->constant($attr->{name}, $decoded) // $decoded;
}
push @list, {Name => $attr->{name}, Value => $decoded, Type => $attr->{type}};
}
$pos += $attr_len;
}
lib/Data/Radius/Decode.pm view on Meta::CPAN
sub decode {
my ($attr, $value, $dict) = @_;
my $decoder = $attr->{type} . ($attr->{has_tag} ? '_tag' : '');
my ($decoded, $tag) = $decode_map{ $decoder }->($value, $attr, $dict);
return wantarray ? ($decoded, $tag) : $decoded;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Random/Contact/Language/EN.pm view on Meta::CPAN
declining
declivities
declivity
declivity's
decode
decoded
decoder
decoder's
decodes
decoding
decolletes
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Random/dict view on Meta::CPAN
decliners
declines
declining
DECnet
decode
decoded
decoder
decoders
decodes
decoding
decodings
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Record/Serialize/Encode/ddump.pm view on Meta::CPAN
$s->send( \%record );
=head1 DESCRIPTION
B<Data::Record::Serialize::Encode::ddump> encodes a record using
L<Data::Dumper>. The resultant encoding may be decoded via
@data = eval $buf;
It performs the L<Data::Record::Serialize::Role::Encode> role.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Recursive/Encode.pm view on Meta::CPAN
=item decode
my $ret = Data::Recursive::Encode->decode($encoding, $data, [CHECK]);
Returns a structure containing nodes which are decoded from the specified
encoding.
=item encode
my $ret = Data::Recursive::Encode->encode($encoding, $data, [CHECK]);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Riak/Result/JSONValue.pm view on Meta::CPAN
version 2.0
=head1 DESCRIPTION
Results for requests resulting in JSON data use this role to provide convenient
access to the decoded body payload.
=head1 METHODS
=head2 json_value
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Sah/Filter/perl/Str/try_decode_json.pm view on Meta::CPAN
my $res = {};
$res->{modules}{"JSON::PP"} //= 0;
$res->{expr_filter} = join(
"",
"do { my \$decoded; eval { \$decoded = JSON::PP->new->allow_nonref->decode($dt); 1 }; \$@ ? $dt : \$decoded }",
);
$res;
}
lib/Data/Sah/Filter/perl/Str/try_decode_json.pm view on Meta::CPAN
This rule is sometimes convenient if you want to accept unquoted string or a
data structure (encoded in JSON). This means, compared to just decoding from
JSON, you don't have to always quote your string. But beware of traps like the
bare values C<null>, C<true>, C<false> becoming undef/1/0 in Perl instead of
string literals, because they can be JSON-decoded.
=for Pod::Coverage ^(meta|filter)$
=head1 HOMEPAGE
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Section/Simple.pm view on Meta::CPAN
=head2 utf8 pragma
If you enable L<utf8> pragma in the caller's package (or the package
you're inspecting with the OO interface), the data retrieved via
C<get_data_section> is decoded, but otherwise undecoded. There's no
reliable way for this module to programmatically know whether utf8
pragma is enabled or not: it's your responsibility to handle them
correctly.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Section.pm view on Meta::CPAN
Carp::confess("bogus data section: text outside of named section")
unless defined $current;
$current_line++;
unless ($default_encoding eq 'bytes') {
my $decoded_line = eval { decode($default_encoding, $line, Encode::FB_CROAK) }
or warn "Invalid character encoding in $current, line $current_line\n";
$line = $decoded_line if defined $decoded_line;
}
$line =~ s/\A\\//;
${$template->{$current}} .= $line;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Serializer/Cookbook.pm view on Meta::CPAN
my $raw_serializer = Data::Serializer::Raw->new();
=head1 Encrypting your data
You wish to encrypt your data structure, so that it can only be decoded
by someone who shares the same key.
=head2 Solution
$serializer->secret('mysecret');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/SimpleKV.pm view on Meta::CPAN
to call save() will overwrite previous changes.
=head1 UTF-8 SUPPORT
The module fully supports UTF-8 encoded strings for both keys and values.
All string data is properly encoded/decoded to ensure correct storage
and retrieval of international characters.
=head1 DEPENDENCIES
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Structure/Deserialize/Auto.pm view on Meta::CPAN
$n = shift(@decoders);
my $decoder = $decoders{$n};
try {
my $structure = $decoder->($v);
if (ref($structure) eq 'HASH' || ref($structure) eq 'ARRAY') {
# warn("decoded using '$n'");
return $decoder->($v);
}
} catch {
# ignore any errors and try the next decoder, or die out at the bottom
};
view all matches for this distribution
view release on metacpan or search on metacpan
ok( has_utf8( $hash2 ), "Has utf8" );
is( has_utf8( $hash2 ), $hash2, "Has utf8" );
is( $hash2->{key1}, $hash->{key1}, "Same string" );
ok( !compare( $hash2->{key1}, $hash->{key1} ), "Different encoding" );
ok( utf8_off( $hash2 ), "Have decoded utf8" );
ok( !has_utf8( $hash2 ), "Has not utf8" );
is( $hash2->{key1}, $hash->{key1}, "Same string" );
ok( compare( $hash2->{key1}, $hash->{key1} ), "Same encoding" );
ok( utf8_on( $hash ), "Have encoded utf8" );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/TOON.pm view on Meta::CPAN
# Output:
# active: true
# age: 30
# name: Alice
my $decoded = Data::TOON->decode($toon);
# Tabular arrays
my $users = {
users => [
{ id => 1, name => 'Alice', role => 'admin' },
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/TagDB/Tag.pm view on Meta::CPAN
=head2 displaycolour
my $displaycolour = $tag->displaycolour( [ %opts ] );
Returns a colour that can be used to display the tag or C<undef>.
This will return a decoded object, most likely (but not necessarily) an instance of L<Data::URIID::Colour>.
Later versions of this module may allow to force a specific type.
B<Note:> Future versions of this method will C<die> if no value can be found.
The following universal options are supported: L</default>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Transform/ExplicitMetadata.pm view on Meta::CPAN
descriptor number and open mode. It will first try fcntl() with F_GETFL
to determine the open mode, falling back to using FileHandle::Fmode if it's
available. Finally, it will first try re-opening the file descriptor in
read mode, then write mode.
Coderefs cannot be decoded properly. They are recreated by returning a
reference to a dummy sub that returns a message explaning the situation.
=back
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_zlib.t view on Meta::CPAN
my $compressed = $filter->put( [ $teststring, Data::Transform::Meta::EOF->new() ] );
is (@$compressed, 3, "sending a string plus EOF gets the right amount of packets");
pop @$compressed; # the EOF packet doesn't go over the wire normally
my $answer = $filter->get( $compressed );
is( @$answer, 1, 'decoding those gets the correct number of packets');
is( $answer->[0], $teststring, 'the decoded string equals the original' );
}
my $stack = Data::Transform::Stackable->new( Filters =>
[
view all matches for this distribution
view release on metacpan or search on metacpan
t/json_read.t view on Meta::CPAN
use PointReadHandler;
use Test::More;
use Data::Transit;
# scalars
is_decoded_to('["~#\'",null]', undef);
is_decoded_to('["~#\'","foo"]', "foo");
is_decoded_to('["~#\'",1]', 1);
# arrays
is_decoded_to('[]', []);
is_decoded_to('["foo"]', ["foo"]);
# maps
is_decoded_to('["^ "]', {});
is_decoded_to('[["^ "]]', [{}]);
is_decoded_to('["^ ","foo",1]', {foo => 1});
is_decoded_to('[["^ ","foo",1],"bar"]', [{foo => 1}, "bar"]);
is_decoded_to('["^ ","foo",["^ ","bar",1]]', {foo => {bar => 1}});
# caching
is_decoded_to('[["^ ","foo",1,"fooo",1],["^ ","foo",1,"^0",1]]',[{foo => 1, fooo => 1}, {foo => 1, fooo => 1}]);
is_decoded_to('[["^ ","fooo",1],["^ ","^0",1]]', [{fooo => 1}, {fooo => 1}]);
# custom handlers
is_decoded_to('["~#point","2,3"]', Point->new(2,3), {point => PointReadHandler->new()});
is_decoded_to('[["~#point","2,3"],["^0","3,4"]]', [Point->new(2,3), Point->new(3,4)], {point => PointReadHandler->new()});
# types not in base perl
is_decoded_to('["^ ","~_",1]', {"" => 1});
is_decoded_to('["~#\'",true]', 1);
is_decoded_to('["~#\'",false]', 0);
is_decoded_to('["^ ","~?t",1]', {1 => 1});
is_decoded_to('["^ ","~?f",1]', {0 => 1});
is_decoded_to('["~#\'","~i123"]', 123);
is_decoded_to('["~#\'","~d123.456"]', 123.456);
done_testing();
sub is_decoded_to {
my ($json, $data, $handlers) = @_;
my $reader = Data::Transit::reader("json", handlers => $handlers);
return is_deeply($reader->read($json), $data);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/URIID/Barcode.pm view on Meta::CPAN
my $data = $barcode->data;
Returns the data of the barcode.
The returned value might differ from the value passed to L</new> as it might have been normalised, decoded (character set), or otherwise altered.
No options are supported. However the options C<default>, and C<no_defaults> are ignored.
=head2 type
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/UUID/Concise.pm view on Meta::CPAN
use Data::UUID::Concise;
my $duc = Data::UUID::Concise->new();
my $encoded_uuid = $duc->encode((Data::UUID->new)->create);
my $decoded_uuid = $duc->decode('M55djt9tt4WoFaL68da9Ef');
$duc->alphabet('aaaaabcdefgh1230123');
$duc->alphabet; # 0123abcdefgh
=head1 ATTRIBUTES
lib/Data/UUID/Concise.pm view on Meta::CPAN
symbols.
=head2 decode
Decode a string with the appropriate set of symbols and return a
Data::UUID instance representing the decoded UUID.
=head1 FUNCTIONS
=head2 _normalize_alphabet
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/VRM/GB.pm view on Meta::CPAN
A function which takes a VRM as its first and only argument, and returns a
HASHREF with the keys C<start_date> and C<end_date>.
Each of those keys has as its value a DateTime object, truncated to the 'day'.
If the registration mark couldn't be decoded to a date, either
because it's of an unrecognised format or is using a letter prefix that is
not understood, then it will return undef.
Before comparing these dates with another DateTime, you must ensure you
truncate your DateTime to the day. If you have a time portion, you will
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Validate/Japanese.pm view on Meta::CPAN
=head1 METHODS
All methods return true or false unless otherwise stated.
All methods also expect Japanese characters that have successfully been
decoded to Perl's internal unicode format.
=head2 new()
Creates a new instance of Data::Validate::Japanese
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Visitor/Encode.pm view on Meta::CPAN
$dev->decode($encoding, \@list);
$dev->decode($encoding, \$scalar);
$dev->decode($encoding, $scalar);
$dev->decode($encoding, $object);
Returns a structure containing nodes which are decoded from the specified
encoding.
=head2 decode_utf8
$dev->decode_utf8(\%hash);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/asXML.pm view on Meta::CPAN
}
# in safe_mode decode back the xml string and compare the data structures
if ($safe_mode) {
my $xml_string = $where->toString;
my $what_decoded = eval { $self->decode($xml_string) };
die 'encoding failed '.$@.' of '.eval('use Data::Dumper; Dumper([$what, $xml_string, $what_decoded])').' failed'
if not eq_deeply($what, $what_decoded);
# set back the safe mode after all was encoded
$self->safe_mode($safe_mode);
}
lib/Data/asXML.pm view on Meta::CPAN
sub decode {
my $self = shift;
my $xml = shift;
my $pos = shift || 1;
# in safe_mode "encode+decode" the decoded data for comparing
if ($self->safe_mode) {
$self->safe_mode(0);
my $data = $self->decode($xml, $pos);
my $data_redecoded = eval { $self->decode(
$self->encode($data)->toString,
$pos,
)};
die 'redecoding failed "'.$@.'" of '.eval('use Data::Dumper; Dumper([$xml, $data, $data_redecoded])').' failed'
if not eq_deeply($data, $data_redecoded);
$self->safe_mode(1);
return $data;
}
if (not $self->{'_cur_xpath_steps'}) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DataFlow/Proc/URLRetriever.pm view on Meta::CPAN
my $url =
$self->has_baseurl
? URI->new_abs( $_, $self->baseurl )->as_string
: $_;
return $self->ua->get($url)->decoded_content;
# TODO allow ArrayRef's instead of Str, and use the other elements
# as parameters for the get() method
};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DataStore/CAS/FS/DirCodec/Universal.pm view on Meta::CPAN
C<{ "*InvalidUTF8*": $bytes_as_codepoints }>
Any attribute which contains bytes >= 0x80 and which does not have Perl's
unicode flag set will be encoded this way, so that it comes back as it went in.
However, since filenames are intended to be human-readable, they are decoded as
unicode strings when appropriate, even if they arrived as octets which just
happened to be valid UTF-8.
=head1 METHODS
view all matches for this distribution