view release on metacpan or search on metacpan
lib/Data/Dumper/AutoEncode.pm view on Meta::CPAN
=head2 BEFORE_HOOK / AFTER_HOOK
Set code ref for hooks which excuted around encoding
$Data::Dumper::AutoEncode::BEFORE_HOOK = sub {
my $value = $_[0]; # decoded
$value =~ s/\x{2019}/'/g;
return $value;
};
$Data::Dumper::AutoEncode::AFTER_HOOK = sub {
lib/Data/Dumper/AutoEncode.pm view on Meta::CPAN
return $value;
};
=head2 CHECK_ALREADY_ENCODED : false
If you set this option true value, check a target before encoding. And do encode in case of decoded value.
=head2 DO_NOT_PROCESS_NUMERIC_VALUE : true
By default, numeric values are ignored (do nothing).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Dumper/Interp.pm view on Meta::CPAN
C<< use open IO => ':locale'; >> or otherwise arrange to
encode the output for your terminal.
You'll also want C<< use utf8; >> if your Perl source is written
using utf8 characters outside the ASCII range.
Undecoded binary octets (e.g. data read from a 'binmode' file)
will still be escaped as individual bytes.
=item *
Depending on options, spaces·may·be·shown·visibly
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Edit/Xml/Xref.pm view on Meta::CPAN
{my ($xref, $file, $href) = @_; # Cross referencer, file containing reference, reference
my $fileExists = sub # Check that the specified file exists by looking for the topic id which L<Dita> guarantees will exist
{my ($file) = @_; # File to check
return 1 if $xref->topicIds->{$file}; # File exists
my $decodedTarget = wwwDecode($file); # Decode file name by expanding % signs to see if we can get a match
return 2 if $xref->topicIds->{$decodedTarget}; # File exists after decoding % signs
return 3 if -e $file; # Images
undef # Cannot locate file
};
if ($href =~ m(#)) # Full Dita href
view all matches for this distribution
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
t/edge_cases.t view on Meta::CPAN
my $j;
lives_ok(
sub { $j = diff_json({x => 'say "hello"'}, {x => 'say "goodbye"'}) },
'diff_json: quote in value: no exception'
);
my $decoded = eval { JSON::MaybeXS::decode_json($j) };
ok(!$@, 'diff_json: quote in value: valid JSON output');
};
subtest 'diff_json: Unicode value produces valid JSON' => sub {
require JSON::MaybeXS;
my $j = diff_json({x => "caf\x{e9}"}, {x => "caf\x{e8}"});
my $decoded = eval { JSON::MaybeXS::decode_json($j) };
ok(!$@, 'diff_json: Unicode value: valid JSON output');
};
subtest 'diff_test2: all lines carry "# " prefix for deep nested change' => sub {
my $old = {a => {b => {c => {d => 1}}}};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/HexConverter.pm view on Meta::CPAN
=head1 FUNCTIONS
=head2 hex_to_binary(\$hexstr)
Takes a reference to a hex string, returns the decoded binary string.
=head2 binary_to_hex(\$binstr)
Takes a reference to a binary string, returns the hex encoded string.
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/JSEmail.pm view on Meta::CPAN
$val =~ s{^(.*filename=\s*)([^\s"][^;]+)}{$1"$2"};
$disposition = parse_content_disposition($val);
}
$partno ||= '1';
my $body = $eml->body();
my $raw_size = length($body); # size in octets of decoded content
if ($type->{type} eq 'text') {
# Decode charset to Perl character string
my $decoded = eval { $eml->body_str() };
if (defined $decoded) {
$body = $decoded;
} else {
# Fallback: try UTF-8 decode
$body = eval { Encode::decode('UTF-8', $body) } // $body;
}
# RFC 8621: line endings in bodyValues MUST be \n not \r\n
my $text_body = $body;
$text_body =~ s/\r\n/\n/g;
$values->{$partno} = {
value => $text_body,
isEncodingProblem => (defined $decoded ? $JSON::false : $JSON::true),
isTruncated => $JSON::false,
};
}
my $charset = $type->{attributes}{charset};
if ($type->{type} eq 'text' and not $charset) {
lib/Data/JSEmail.pm view on Meta::CPAN
sub asText {
my $val = shift;
return undef unless defined $val;
# Decode MIME-Header encoded words, then NFC normalize
my $decoded = eval { decode('MIME-Header', $val) };
$decoded = $val unless defined $decoded;
# If still raw bytes (not flagged as UTF-8), try UTF-8 decode
if (!Encode::is_utf8($decoded) && $decoded =~ /[\x80-\xff]/) {
$decoded = eval { Encode::decode('UTF-8', $decoded) } // $decoded;
}
my $res = NFC($decoded);
$res =~ s/^\s*//;
$res =~ s/\s*$//;
return $res;
}
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
xt/metrics_export.t view on Meta::CPAN
# Serialize â parse
my $json = eval { encode_json($stats) };
ok !$@, "stats serializes to JSON: $@" if $@;
ok length($json) > 20, "non-trivial JSON: " . substr($json, 0, 80);
my $decoded = decode_json($json);
is_deeply $decoded, $stats, "JSON roundtrip preserves hash";
# Invariants
cmp_ok $stats->{used}, '<=', $stats->{capacity}, "used <= capacity";
cmp_ok $stats->{allocs}, '>=', $stats->{frees}, "allocs >= frees";
is $stats->{used}, $stats->{allocs} - $stats->{frees},
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