view release on metacpan or search on metacpan
lib/Feersum/Connection.pm view on Meta::CPAN
protocol (psgi SERVER_PROTOCOL)
=item C<< my $env = $req->path >>
percent decoded request path (psgi PATH_INFO)
=item C<< my $env = $req->query >>
request query (psgi QUERY_STRING)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/ANVL.pm view on Meta::CPAN
in which case they contain the line number and value, respectively. Array
element 1 always contains a string naming the format of the input, such
as, "ANVL", "JSON", "XML", etc.
The remaining triples are free form except that the values will have been
drawn from the original format and possibly decoded. The first item
("lineno") in each remaining triple is a number followed by a character,
for example, "34:" or "6#". The number indicates the line number (or
octet offset, depending on the origin format) of the start of the
element. The character is either ':' to indicate a real element or '#'
to indicate a comment; if the latter, the element name has no defined
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/BOM.pm view on Meta::CPAN
$enc = open_bom(my $fh, $filename, ':utf8');
$line = <$fh>;
The filehandle will be cued up to read after the BOM. Unseekable files (e.g.
fifos) will cause croaking, unless called in list context to catch spillage
from the handle. Any spillage will be automatically decoded from the encoding,
if found.
e.g.
# croak if my_socket is unseekable
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/CountLines.pm view on Meta::CPAN
smaller block size at all. Depending on your size a larger block size
might speed up things a bit.)
=head1 Character Encodings
If you supply a separator yourself, it should not be a decoded string.
The file is read in binary mode, which implies that this module
works fine for text files in ASCII-compatible encodings, including
ASCII itself, UTF-8 and all the ISO-8859-* encodings (aka Latin-1,
Latin-2, ...).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Dropbox.pm view on Meta::CPAN
elsif ($code == 507) {
$! = EFBIG;
}
else {
die join ' ', $code, $response->decoded_content();
}
return 0;
} # __error__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Find/utf8.pm view on Meta::CPAN
#pod C<wanted>, and C<postporcess> functions.
#pod
#pod If for any reason (e.g., compatibility with find.pl or find2perl) you
#pod also need the I<special> variables C<$File::Find::topdir>,
#pod C<$File::Find::topdev>, C<$File::Find::topino>,
#pod C<$File::Find::topmode>, and C<$File::Find::topnlink> to be decoded,
#pod specify C<local $File::Find::utf8::COMPATILBILITY = 1;> in your
#pod code. The extra decoding that needs to happen will impact performance
#pod though, so use only when absolutely necessary.
#pod
#pod =cut
lib/File/Find/utf8.pm view on Meta::CPAN
C<wanted>, and C<postporcess> functions.
If for any reason (e.g., compatibility with find.pl or find2perl) you
also need the I<special> variables C<$File::Find::topdir>,
C<$File::Find::topdev>, C<$File::Find::topino>,
C<$File::Find::topmode>, and C<$File::Find::topnlink> to be decoded,
specify C<local $File::Find::utf8::COMPATILBILITY = 1;> in your
code. The extra decoding that needs to happen will impact performance
though, so use only when absolutely necessary.
=head2 $File::Find::utf8::UTF8_CHECK
view all matches for this distribution
view release on metacpan or search on metacpan
libtomcrypt/src/headers/tomcrypt_private.h view on Meta::CPAN
#ifdef LTC_PKCS_8
int pkcs8_decode_flexi(const unsigned char *in, unsigned long inlen,
const void *pwd, unsigned long pwdlen,
ltc_asn1_list **decoded_list);
#endif /* LTC_PKCS_8 */
#ifdef LTC_PKCS_12
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/KDBX/Loader/XML.pm view on Meta::CPAN
$value = trim($reader->getAttribute($name));
}
return $default if !defined $value;
my $decoded = eval { _decode_primitive($value, $type) };
if (my $err = $@) {
ref $err and $err->details(attribute => $name, node => $reader->nodePath, line => $reader->lineNumber);
throw $err
}
return $decoded;
}
sub _read_xml_content {
my $self = shift;
my $type = shift;
lib/File/KDBX/Loader/XML.pm view on Meta::CPAN
$reader->read if !$reader->isEmptyElement; # step into element
return '' if !$reader->hasValue;
my $content = trim($reader->value);
my $decoded = eval { _decode_primitive($content, $type) };
if (my $err = $@) {
ref $err and $err->details(node => $reader->nodePath, line => $reader->lineNumber);
throw $err;
}
return $decoded;
}
##############################################################################
sub _decode_primitive { goto &{__PACKAGE__."::_decode_$_[1]"} }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/LoadLines.pm view on Meta::CPAN
=head2 loadlines
@lines = loadlines("mydata.txt");
@lines = loadlines("mydata.txt", $options);
The file is opened, read, decoded and split into lines
that are returned in the result array. Line terminators are removed.
In scalar context, returns an array reference.
The first argument may be the name of a file, an opened file handle,
lib/File/LoadLines.pm view on Meta::CPAN
elsif ( $filename =~ /^https?:/ ) {
require LWP::UserAgent;
my $ua = LWP::UserAgent->new( timeout => 20 );
my $res = $ua->get($filename);
if ( $res->is_success ) {
$data = $res->decoded_content;
}
elsif ( $options->{fail} eq "soft" ) {
$options->{error} = $res->status_line;
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/20-unicode.t view on Meta::CPAN
utf8::decode($example) or die 'Can\'t decode $example';
is(warnings { utf8::decode($mapped) }, 0, 'Can decode mapped');
ok utf8::is_utf8($mapped), 'Mapped memory is decoded to characters';
is $mapped, $example, '$mapped eq $example';
for my $var (substr $mapped, 0, length $mapped) {
is(warnings { $var = uc $var }, 0, 'Indirect capitolization gives no warnings');
t/20-unicode.t view on Meta::CPAN
my $utf_mapped;
is(warnings { map_handle $utf_mapped, $fh }, 0, 'Can map utf8 handle without warnings');
ok utf8::is_utf8($utf_mapped), 'Mapped memory is decoded to characters automatically';
}
{
my $utf_mapped;
is(warnings { map_file $utf_mapped, $0, '<:raw:utf8' }, 0, 'Can map utf8 file without warnings');
ok utf8::is_utf8($utf_mapped), 'Mapped memory is decoded to characters automatically';
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Name/Check.pm view on Meta::CPAN
sub _reencode {
my $self = shift;
my ( $bytes, $encoding) = @_;
no warnings 'utf8';
if ( $bytes ne encode( $encoding, decode( $encoding, $bytes ) ) ) {
# say '*** decoded: ', decode( $encoding, $bytes );
# say ' quoted: ', decode( $encoding, $bytes, Encode::FB_PERLQQ );
return 0;
}
else { return 1; }
}
view all matches for this distribution
view release on metacpan or search on metacpan
filenames as Perl strings consisting of unicode characters,
while CORE::readme() and other file tests still working on
octet strings. This is enabled with -u (--unicode).
It is possible to specify the encoding of filenames, with:
--unicode encoding. Filenames are decoded from octet
strings to unicode strings before applying the user code,
and then the resulting string is encoded for CORE::rename.
upgrade filenames to unicode (encoded as utf8) by default.
COPYRIGHT AND LICENCE
view all matches for this distribution
view release on metacpan or search on metacpan
script/rsybak view on Meta::CPAN
# my $key = $1;
# my $val = $2;
#
# if ($val =~ /\A["!\\[\{~]/) {
# $_raw_val = $val if $cb;
# my ($err, $parse_res, $decoded_val) = $self->_parse_raw_value($val);
# $self->_err("Invalid value: " . $err) if $err;
# $val = $decoded_val;
# } else {
# $_raw_val = $val if $cb;
# $val =~ s/\s*[#;].*//;
# }
#
script/rsybak view on Meta::CPAN
#codeset range. Neither of these flags conflict with each other, although
#some combinations make less sense than others.
#
#Care has been taken to make all flags symmetrical with respect to
#C<encode> and C<decode>, that is, texts encoded with any combination of
#these flag values will be correctly decoded when the same flags are used
#- in general, if you use different flag settings while encoding vs. when
#decoding you likely have a bug somewhere.
#
#Below comes a verbose discussion of these flags. Note that a "codeset" is
#simply an abstract set of character-codepoint pairs, while an encoding
script/rsybak view on Meta::CPAN
#=item C<utf8> flag disabled
#
#When C<utf8> is disabled (the default), then C<encode>/C<decode> generate
#and expect Unicode strings, that is, characters with high ordinal Unicode
#values (> 255) will be encoded as such characters, and likewise such
#characters are decoded as-is, no changes to them will be done, except
#"(re-)interpreting" them as Unicode codepoints or Unicode characters,
#respectively (to Perl, these are the same thing in strings unless you do
#funny/weird/dumb stuff).
#
#This is useful when you want to do the encoding yourself (e.g. when you
script/rsybak view on Meta::CPAN
# $rargs->{$arg} //= {};
# $val_set = 1; $val = $_[2];
# $rargs->{$arg}{$_[1]} = $val;
# } else {
# {
# my ($success, $e, $decoded);
# ($success, $e, $decoded) = _parse_json($_[1]);
# if ($success) {
# $val_set = 1; $val = $decoded;
# $rargs->{$arg} = $val;
# last;
# }
# ($success, $e, $decoded) = _parse_yaml($_[1]);
# if ($success) {
# $val_set = 1; $val = $decoded;
# $rargs->{$arg} = $val;
# last;
# }
# die "Invalid YAML/JSON in arg '$fqarg'";
# }
script/rsybak view on Meta::CPAN
# } elsif (defined $extra->{is_neg}) {
# $go_spec->{$ospec} = sub { $handler->($_[0], 1) };
# } elsif ($extra->{is_base64}) {
# $go_spec->{$ospec} = sub {
# require MIME::Base64;
# my $decoded = MIME::Base64::decode($_[1]);
# $handler->($_[0], $decoded);
# };
# } else {
# $go_spec->{$ospec} = $handler;
# }
#
script/rsybak view on Meta::CPAN
# warn "Clash of option: $jopt, not added";
# } else {
# my $jospec = "$jopt=s";
# my $parsed = {type=>"s", opts=>[$jopt]};
# $go_spec->{$jospec} = sub {
# my ($success, $e, $decoded);
# ($success, $e, $decoded) = _parse_json($_[1]);
# if ($success) {
# $rargs->{$arg} = $decoded;
# } else {
# die "Invalid JSON in option --$jopt: $_[1]: $e";
# }
# };
# $specmeta->{$jospec} = {arg=>$arg, fqarg=>$fqarg, is_json=>1, parsed=>$parsed, %$extra};
script/rsybak view on Meta::CPAN
# warn "Clash of option: $yopt, not added";
# } else {
# my $yospec = "$yopt=s";
# my $parsed = {type=>"s", opts=>[$yopt]};
# $go_spec->{$yospec} = sub {
# my ($success, $e, $decoded);
# ($success, $e, $decoded) = _parse_yaml($_[1]);
# if ($success) {
# $rargs->{$arg} = $decoded;
# } else {
# die "Invalid YAML in option --$yopt: $_[1]: $e";
# }
# };
# $specmeta->{$yospec} = {arg=>$arg, fqarg=>$fqarg, is_yaml=>1, parsed=>$parsed, %$extra};
script/rsybak view on Meta::CPAN
# !$is_array_of_simple && !$is_hash_of_simple) {
# my $i = 0;
# for (@$val) {
# TRY_PARSING_AS_JSON_YAML:
# {
# my ($success, $e, $decoded);
# if ($per_arg_json) {
# ($success, $e, $decoded) = _parse_json($_);
# if ($success) {
# $_ = $decoded;
# last TRY_PARSING_AS_JSON_YAML;
# } else {
# warn "Failed trying to parse argv #$i as JSON: $e";
# }
# }
# if ($per_arg_yaml) {
# ($success, $e, $decoded) = _parse_yaml($_);
# if ($success) {
# $_ = $decoded;
# last TRY_PARSING_AS_JSON_YAML;
# } else {
# warn "Failed trying to parse argv #$i as YAML: $e";
# }
# }
script/rsybak view on Meta::CPAN
# }
# }
# if (!$arg_spec->{greedy} && !$is_simple) {
# TRY_PARSING_AS_JSON_YAML:
# {
# my ($success, $e, $decoded);
# if ($per_arg_json) {
# ($success, $e, $decoded) = _parse_json($val);
# if ($success) {
# $val = $decoded;
# last TRY_PARSING_AS_JSON_YAML;
# } else {
# warn "Failed trying to parse argv #$arg_spec->{pos} as JSON: $e";
# }
# }
# if ($per_arg_yaml) {
# ($success, $e, $decoded) = _parse_yaml($val);
# if ($success) {
# $val = $decoded;
# last TRY_PARSING_AS_JSON_YAML;
# } else {
# warn "Failed trying to parse argv #$arg_spec->{pos} as YAML: $e";
# }
# }
view all matches for this distribution
view release on metacpan or search on metacpan
FileList/FileList.pm view on Meta::CPAN
file lists.
=head2 Utility functions
The count() function returns the total number of files in the internal
file list (either decoded or encoded).
The fatalError() function returns true if a fatal error has occured
during file decoding. It should be called in the decode loop to
make sure no error has occured.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/procmail/scanvirus.pl view on Meta::CPAN
my $files = shift;
my $tmp_dir = shift;
my $file = shift;
my ($filename) = ($file =~ /\/?([^\/]+)$/);
my $decoded = join("/", $tmp_dir, "$filename\.eml");
open(ENCFILE, "<$file") or return("Can't open $file: $!\n");
open(DECFILE, join("", ">$decoded")) or return("Can't open $decoded: $!\n");
binmode(DECFILE);
while(<ENCFILE>) { print DECFILE rfc822_base64($_); }
close(DECFILE);
close(ENCFILE);
$files->{$decoded} = "";
return("");
}
#---mhtml_exploit---------------------------------------------------------
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/SharedVar.pm view on Meta::CPAN
require JSON;
JSON->import;
};
#my $json_text = encode_json($data);
#my $decoded_data = decode_json($json_text);
=head1 METHODS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Sip.pm view on Meta::CPAN
=head2 is_utf8
Optional, flag to tell if the file is utf8-encoded, default is true.
If true, the line returned by C<read_line> will be decoded.
=head2 index
Index that contains positions of all lines of the file, usage:
view all matches for this distribution
view release on metacpan or search on metacpan
# when I extract the parts between the boundary string and feed this
# to metamail one by one, it works well.
env METAMAIL_TMPDIR=. metamail -d -w jpeg.mm
This message contains 'image/jpeg`-format data.
which is being decoded and written to the file named "./Unknown.jpeg".
If you do not want this data, you probably should delete that file.
Wrote file ./Unknown.jpeg
view all matches for this distribution
view release on metacpan or search on metacpan
# when I extract the parts between the boundary string and feed this
# to metamail one by one, it works well.
env METAMAIL_TMPDIR=. metamail -d -w jpeg.mm
This message contains 'image/jpeg`-format data.
which is being decoded and written to the file named "./Unknown.jpeg".
If you do not want this data, you probably should delete that file.
Wrote file ./Unknown.jpeg
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/ValueFile/Simple/Reader.pm view on Meta::CPAN
The list of supported features. This can be a single format, a arrayref of formats, or C<'all'>.
Formats can be given by ISE or as L<Data::Identifier>.
=item C<utf8>
The UTF-8 flag for the decoded data. If set to true, values are decoded as UTF-8.
If set to (non-C<undef>) false values are decoded as 8-bit strings (binary).
If set to C<auto> the UTF-8 flag is automatically detected using the format and features.
This is the default.
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/FileSystem/LL/FAT.pm view on Meta::CPAN
Returns an empty list unless signature is correct.
=head2 interpret_bootsector($bootsector)
Takes a string containing 512Byte bootsector; returns a hash reference
with decoded fields. The keys include
jump oem sector_size sectors_in_cluster FAT_table_off num_FAT_tables
root_dir_entries total_sectors1 media_type sectors_per_FAT16
sectors_per_track heads hidden_sectors total_sectors2
machine_code FS_type boot_signature volume_label physical_drive
lib/FileSystem/LL/FAT.pm view on Meta::CPAN
extended_bpb head___dirty_flags
=head2 check_bootsector($fields)
Takes a hash reference with decoded fields of a bootsector; returns
TRUE if minimal sanity checks hold; die()s otherwise.
=head2 interpret_directory($dir, $is_fat32, [$keep_del, [$keep_dots, [$keep_labels]]])
($res, $files) = interpret_directory($dir, $is_FAT32);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/FilmAffinity/UserRating.pm view on Meta::CPAN
my ($next, $page) = (1, 1);
while ( $next ){
my $url = $self->p_buildUrl( $page );
my $response = $self->ua->get($url);
if ($response->is_success){
my $content = $response->decoded_content();
$self->parseString($content);
$next = $self->p_isNextPage($content);
$page++;
} else {
$next = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
CryptFile/lib/Filter/Crypto/CryptFile.pm view on Meta::CPAN
given.
=item Can't decode odd-numbered (%d-byte) length hexadecimal text
The hexadecimal encoding of the encrypted source code, consisting of a pair of
hexadecimal digits for each byte of data, could not be decoded because an odd
number of hexadecimal digits were found.
=item Can't decode non-hexadecimal digit (byte %02x at position %d) in
hexadecimal text
The hexadecimal encoding of the encrypted source code, consisting of a pair of
hexadecimal digits for each byte of data, could not be decoded because a byte
other than a hexadecimal digit was found.
=item Can't derive %d-byte key: %s
libcrypto's PKCS#5 v2.0 compatible key derivation algorithm failed to derive a
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Filter/Dockerfile.pm view on Meta::CPAN
if ( -f $uri ) {
local $/ = undef;
open my $fh, $uri || die "$uri: $!";
push @content, join("", <$fh>);
} else {
push @content, $self->{ua}->get($uri)->decoded_content();
}
}
chomp(@content);
@content = merge($merge, \@content, $include, $exclude);
$_ = "print <<'EOM';\n".join("\n", @content)."\nEOM\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Filter/Encoding.pm view on Meta::CPAN
=head1 DESCRIPTION
This module allows your code to be written in any ASCII-based encoding.
Just pass the name of the encoding as an argument to C<use
Filter::Encoding>. The source code will be decoded and treated as though it had been written in UTF-8 with C<use utf8> in effect. That's all this
module does.
It is intended as a simpler, saner replacement for L<encoding.pm|encoding>,
one that does not change the up- and downgrading of strings or touch your
file handles.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/closure/UUdecode.pm view on Meta::CPAN
}
# uudecode the line
$_ = unpack("u", $_) ;
# return the uudecoded data
return $status ;
}
})
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/BTCIndo.pm view on Meta::CPAN
log_trace("JSON API request: %s", $url);
my $res = $self->{_http}->get($url);
die "Can't retrieve $url: $res->{status} - $res->{reason}"
unless $res->{success};
my $decoded;
eval { $decoded = $self->{_json}->decode($res->{content}) };
die "Can't decode response from $url: $@" if $@;
log_trace("JSON API response: %s", $decoded);
$decoded;
}
sub tapi {
my ($self, $method, %args) = @_;
lib/Finance/BTCIndo.pm view on Meta::CPAN
my $url = "$url_prefix/tapi/";
my $res = $self->{_http}->post($url, $options);
die "Can't retrieve $url: $res->{status} - $res->{reason}"
unless $res->{success};
my $decoded;
eval { $decoded = $self->{_json}->decode($res->{content}) };
die "Can't decode response from $url: $@" if $@;
log_trace("TAPI response: %s", $decoded);
die "API response not a hash: $decoded" unless ref $decoded eq 'HASH';
die "API response is not success: $decoded->{error}" unless $decoded->{success};
$decoded;
}
sub _check_pair {
my $pair = shift;
$pair =~ /\A(\w{3,5})_(\w{3,5})\z/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Bank/Kraken.pm view on Meta::CPAN
Sets or gets the API key.
=item $api->secret($secret)
Sets the API secret to C<$secret> or returns the API secret base64 decoded.
=item $result = $api->call(Public, $method)
=item $result = $api->call(Private, $method)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Finance/Bank/LloydsTSB/Account.pm view on Meta::CPAN
if (! $self->_on_account_overview_page) {
# This is the one we want
# my @links = $self->ua->find_all_links;
# my $correct = $links[0]->text;
# GRR! gets decoded into \xa0 by HTML::TokeParser
# (which uses HTML::Entities::decode_entities)
unless ($self->ua->follow_link(text_regex =>
qr/Account[ \xa0]overview/))
{
# my $dumpfile = '/tmp/dump.html';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HAL/Resource.pm view on Meta::CPAN
my $ua = WWW::Mechanize->new();
my $res = $ua->get('https://api.example.com/');
my $r = HAL::Resource->new(
ua => $ua,
%{ decode_json( $res->decoded_content ) },
);
=head1 ABOUT
This module is just a very thin wrapper for HAL resources. If you find this
view all matches for this distribution