view release on metacpan or search on metacpan
lib/Data/Encoder.pm view on Meta::CPAN
=item my $encoded = $encoder->encode($stuff [, @args]);
The module SHOULD have a C<<encode>> method.
=item my $decoded = $encoder->decode($stuff [, @args]);
The module SHOULD have a C<<decod>> method.
=back
view all matches for this distribution
view release on metacpan or search on metacpan
t/Data-FastPack-JPacker.t view on Meta::CPAN
my $count=5;
my $encoded="";
encode_fastpack($encoded,[[0,1,$_]]) for(1..$count);
my $encoded_copy=$encoded;
my @decoded;
decode_fastpack($encoded_copy, \@decoded);
ok (@decoded == $count);
#use Data::Dumper;
#use feature ":all";
#say STDERR Dumper @decoded;
use File::Temp qw<mktemp>;
# Write to file
my $input=mktemp("fastpackXXXXXXXX");;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/FastPack.pm view on Meta::CPAN
Buffer is aliased and is an in/out parameter
Decoded messages are added to the dereferenced output array
An optional limit of message count can be specified.
Returns the number of bytes consumed during decoding. I a message could not be
decoded, 0 bytes are consumed.
buffer (aliased)
output (array ref)
limit (numeric)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Feed.pm view on Meta::CPAN
or Carp::confess(
"Failed to fetch URI $stream: " . $res->status_line );
if ( $res->code == 410 ) {
Carp::confess("This feed has been permanently removed");
}
$content = $res->decoded_content;
}
elsif ( $ref eq 'SCALAR' ) {
$content = $$stream;
}
elsif ( $ref eq 'GLOB' ) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/ICal/RDF.pm view on Meta::CPAN
# for some reason base64 is not built into Data::ICal.
return MIME::Base64::decode($prop->value);
}
elsif ($enc eq 'QUOTED-PRINTABLE') {
# QP *is* built in, however.
return $prop->decoded_value;
}
else {
return;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/ICal/Property.pm view on Meta::CPAN
You shouldn't need to create L<Data::ICal::Property> values directly
-- just use C<add_property> in L<Data::ICal::Entry>.
The C<encoding> parameter value is only interpreted by L<Data::ICal>
in the C<decoded_value> and C<encode> methods: all other methods
access the encoded version directly (if there is an encoding).
Currently, the only supported encoding is C<QUOTED-PRINTABLE>.
=head1 METHODS
lib/Data/ICal/Property.pm view on Meta::CPAN
return $dec;
}
},
);
=head2 decoded_value
Gets the value of this property, converted from the encoding specified
in its encoding parameter. (That is, C<value> will return the encoded
version; this will apply the encoding.) If the encoding is not
specified or recognized, just returns the raw value.
=cut
sub decoded_value {
my $self = shift;
my $value = $self->value;
my $encoding = uc( $self->parameters->{'ENCODING'} || "" );
if ( $ENCODINGS{$encoding} ) {
lib/Data/ICal/Property.pm view on Meta::CPAN
}
}
=head2 encode $encoding
Calls C<decoded_value> to get the current decoded value, then encodes
it in C<$encoding>, sets the value to that, and sets the encoding
parameter to C<$encoding>. (C<$encoding> is first converted to upper
case.)
If C<$encoding> is undef, deletes the encoding parameter and sets the
value to the decoded value. Does nothing if the encoding is not
recognized.
=cut
sub encode {
my $self = shift;
my $encoding = uc shift;
my $decoded_value = $self->decoded_value;
if ( not defined $encoding ) {
$self->value($decoded_value);
delete $self->parameters->{'ENCODING'};
} elsif ( $ENCODINGS{$encoding} ) {
$self->value( $ENCODINGS{$encoding}{'encode'}->($decoded_value) );
$self->parameters->{'ENCODING'} = $encoding;
}
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/JPack.pm view on Meta::CPAN
$pairs{$_}=~/"(.*)"/;
$compression=$1;
}
}
my $decoded;
my $output="";
for($compression){
if(/deflate/){
$decoded=decode_base64($data);
rawinflate(\$decoded, \$output) or die $RawInflateError;
}
else {
$output=decode_base64($data);
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Localize.pm view on Meta::CPAN
# using the key ('Hello, [_1]') as the localization token.
print $loc->localize('Hello, [_1]', 'John Doe'), "\n";
=head1 UTF8
All data is expected to be in decoded utf8. You must "use utf8" or
decode them to Perl's internal representation for all values
passed to Data::Localizer. We won't try to be smart for you. USE UTF8!
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
$count++;
is $stream->data, 'hoge', 'data ok';
}
}
is $count, 100, 'decoded count ok';
}
{
# New specification: Str type
my $utf8_mp = Data::MessagePack->new->utf8;
view all matches for this distribution
view release on metacpan or search on metacpan
t/15_utf8.t view on Meta::CPAN
for(1 .. 2) {
ok $u->get_utf8();
$p = $u->execute($packed, $p);
my $d = $u->data();
$u->reset();
is_deeply $d, $data, 'decoded';
}
is $u->utf8(0), $u, 'utf8(0)';
$p = 0;
for(1 .. 2) {
t/15_utf8.t view on Meta::CPAN
$p = $u->execute($packed, $p);
my $d = $u->data();
$u->reset();
my $s = $data->[3];
utf8::encode($s);
is_deeply $d->[3], $s, 'not decoded';
}
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/OFAC/SDN.pm view on Meta::CPAN
$lwp->env_proxy;
my $rsp = $lwp->get(SDNURL);
if ( $rsp->is_success ) {
$self->buildDatabase( $rsp->decoded_content );
}
else {
$self->{_status} = 'dirty';
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/OpenGraph.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new();
my $res = $ua->get( $uri );
if (! $res->is_success) {
Carp::croak( "Failed to get $uri: " . $res->status_line);
}
return $class->parse_string( $res->decoded_content );
} else {
Carp::croak( "No applicable UserAgent (such as LWP::UserAgent) found" );
}
}
lib/Data/OpenGraph.pm view on Meta::CPAN
my $og = Data::OpenGraph->parse_uri( "http://some.content/with/opengraph.html" );
my $ua = LWP::UserAgent->new();
my $res = $ua->get( "http://some.content/with/opengraph.html" );
my $og = Data::OpenGraph->parse_uri( $res->decoded_content );
my $title = $og->property( "title" );
my $type = $og->property( "type" );
=head1 DESCRIPTION
view all matches for this distribution
view release on metacpan or search on metacpan
t/04encodings.t view on Meta::CPAN
$ch = "\x{05D0}"; # the letter "Alef" in hebrew, in unicode
$oc = "\xE0"; # the same in iso-8859-8
ok( $s->build($ch) eq $oc, "Char hebrew: Build: simple");
ok( $s->parse($oc) eq $ch, "Char hebrew: Parse: simple");
my $love_decoded = "\x{05D0}\x{05D4}\x{05D1}\x{05D4}";
my $love_encoded = "\xd7\x90\xd7\x94\xd7\x91\xd7\x94";
$s = PaddedString("foo", 10, encoding => "utf8", padchar => "\0");
$oc = $love_encoded."\0\0";
ok( $s->build($love_decoded) eq $oc, "String: Build: love");
ok( $s->parse($oc) eq $love_decoded, "String: Parse: love");
$s = PascalString("foo", undef, "utf8");
$oc = "\x04".$love_encoded;
ok( $s->build($love_decoded) eq $oc, "PascalString: Build: love");
ok( $s->parse($oc) eq $love_decoded, "PascalString: Parse: love");
$s = CString("foo", encoding => "utf8");
$oc = $love_encoded."\0";
ok( $s->build($love_decoded) eq $oc, "CString: Build: love");
ok( $s->parse($oc) eq $love_decoded, "CString: Parse: love");
view all matches for this distribution
view release on metacpan or search on metacpan
share/dictionary.txt 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/Password/zxcvbn/RankedDictionaries/English.pm view on Meta::CPAN
'decisions' => 1465,
'deck' => 1921,
'decked' => 10339,
'declare' => 3272,
'decode' => 11109,
'decoded' => 13804,
'decoder' => 11397,
'decompose' => 18327,
'decomposed' => 14333,
'decomposing' => 12047,
'decompress' => 17301,
view all matches for this distribution
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/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