view release on metacpan or search on metacpan
lib/BT368i/NMEA/GP/GGA.pm view on Meta::CPAN
Parse a GPGGA sentance.
=item $gga->print();
Print a decoded output of a GPGGA sentance.
=item $gga->log($filename);
Log the GPGGA sentance to a file.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Backblaze/B2/v1/AnyEvent.pm view on Meta::CPAN
my $res = $b2->json_request(...)->then(sub {
my( $ok, $message, @stuff ) = @_;
});
Helper routine that expects a JSON formatted response
and returns the decoded JSON structure.
=cut
sub json_request {
my( $self, %options ) = @_;
lib/Backblaze/B2/v1/AnyEvent.pm view on Meta::CPAN
)->then(sub {
my( $body, $headers ) = @_;
my $d = deferred;
my @decoded = $self->decode_json_response($body, $headers);
my $result = $d->promise;
$d->resolve( @decoded );
$result
});
}
view all matches for this distribution
view release on metacpan or search on metacpan
zlib/zlib.h view on Meta::CPAN
above on the use in deflateInit2() applies to the magnitude of windowBits.
windowBits can also be greater than 15 for optional gzip decoding. Add
32 to windowBits to enable zlib and gzip decoding with automatic header
detection, or add 16 to decode only the gzip format (the zlib format will
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
a crc32 instead of an adler32.
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
is set to null if there is no error message. inflateInit2 does not perform
zlib/zlib.h view on Meta::CPAN
inflateGetHeader() requests that gzip header information be stored in the
provided gz_header structure. inflateGetHeader() may be called after
inflateInit2() or inflateReset(), and before the first call of inflate().
As inflate() processes the gzip stream, head->done is zero until the header
is completed, at which time head->done is set to one. If a zlib stream is
being decoded, then head->done is set to -1 to indicate that there will be
no gzip header information forthcoming. Note that Z_BLOCK can be used to
force inflate() to return immediately after header processing is complete
and before any actual data is decompressed.
The text, time, xflags, and os fields are filled in with the gzip header
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Badger.pm view on Meta::CPAN
Delegates to the L<Badger::Hub> L<codec()|Badger::Hub/codec()> method to
return a L<Badger::Codec> object.
my $base64 = Badger->codec('base64');
my $encoded = $base64->encode($uncoded);
my $decoded = $base64->decode($encoded);
=head2 config()
Delegates to the L<Badger::Hub> L<codec()|Badger::Hub/codec()> method to
return a L<Badger::Config> object. This is still experimental.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BalanceOfPower/Role/WebMaster.pm view on Meta::CPAN
if ($response->is_success) {
if($bare)
{
return $response->decoded_content;
}
else
{
my $json = JSON->new->allow_nonref;
return $json->decode( $response->decoded_content );
}
}
else {
return undef;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BankDetails/India.pm view on Meta::CPAN
return if ( !$self->ping_api );
my $request_url = $self->api_url.$ifsc_code;
my $response = $self->user_agent->get($request_url);
$file_name ||= "bankdetails_$ifsc_code.json";
open(my $fh, '>', $file_name) or die $!;
print $fh $response->decoded_content;
close($fh);
}
sub download_xml {
my ($self, $ifsc_code, $file_name) = @_;
return if ( !$self->ping_api );
my $request_url = $self->api_url.$ifsc_code;
my $response = $self->user_agent->get($request_url);
my $response_data = decode_json($response->decoded_content);
$self->_convert_json_boolean($response_data);
my $xml = XMLout($response_data, RootName => 'data', NoAttr => 1);
$file_name ||= "bankdetails_$ifsc_code.xml";
open(my $fh, '>', $file_name) or die $!;
print $fh $xml;
lib/BankDetails/India.pm view on Meta::CPAN
} else {
my $response = $self->user_agent->get($request_url);
my $response_content;
if ($response->is_success) {
$response_content = $response->decoded_content;
} else {
croak "Failed to fetch data: " . $response->status_line;
}
$response_data = decode_json($response_content);
$self->_convert_json_boolean($response_data);
view all matches for this distribution
view release on metacpan or search on metacpan
Initializes the object with a newly scanned string.
=item C<-E<gt>type()>
Returns the type of barcode decoded. For known :CueCat numbers, this
will be ':C1'.
=item C<-E<gt>code()>
Returns the actual number decoded in the barcode. Codes in the
proprietary :CueCat format are converted automatically to a
sequence of digits.
=item C<-E<gt>serial()>
view all matches for this distribution
view release on metacpan or search on metacpan
collect results:
my @symbols = $image->get_symbols();
foreach my $sym (@symbols) {
print("decoded: " . $sym->get_type() . ":" . $sym->get_data());
}
=head1 DESCRIPTION
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BarefootJS/Evaluator.pm view on Meta::CPAN
# helpers in BarefootJS.pm, so the contract is unambiguous and the two
# template adapters stay byte-equal with each other and with Go.
# evaluate($node, $env)
#
# Evaluate a decoded ParsedExpr node (a hashref keyed by `kind`) against the
# environment hashref ($env), returning a Perl value (number, string,
# JSON::PP::Boolean, undef for null, arrayref, hashref). The matching JSON
# entry point is eval_json() below.
sub evaluate ($node, $env) {
return undef unless ref $node eq 'HASH';
lib/BarefootJS/Evaluator.pm view on Meta::CPAN
return ($prop, $callee->{object}, $arrow);
}
# _array_callback($method, $object_node, $arrow_node, $env): evaluate the
# receiver (`$object_node`) against $env, then map/filter it through the
# arrow's body. `params` in the decoded JSON is an array ref of plain
# strings (e.g. `["t"]` or `["t","i"]`) â 1 param binds the element, 2
# params bind (element, index). The child env is a COPY of the parent env
# (never mutated in place across sibling iterations), with the param
# name(s) bound per call â matches Go's per-call `inner` env copy.
sub _array_callback ($method, $object_node, $arrow_node, $env) {
lib/BarefootJS/Evaluator.pm view on Meta::CPAN
my $node = JSON::PP->new->decode($json);
return evaluate($node, $env);
}
# ---------------------------------------------------------------------------
# JS value classification. JSON-decoded strings carry the string flag (POK)
# but no numeric flag; JSON-decoded numbers carry IOK/NOK. This lets the
# evaluator tell the JS *string* "10" from the JS *number* 10 â essential for
# the `+` overload and relational comparison â which looks_like_number alone
# cannot (it is true for both).
# ---------------------------------------------------------------------------
lib/BarefootJS/Evaluator.pm view on Meta::CPAN
return 0;
}
# _same_value_zero: `Array.prototype.includes` membership test â `===`
# except `NaN` equals itself (and +0/-0 are not distinguished, which the
# JSON-decoded values here can't represent anyway). Reuses `_strict_eq`'s
# type/value rules and only special-cases the two-NaN case that `_strict_eq`
# (deliberately, for `===`) reports as unequal.
sub _same_value_zero ($l, $r) {
if (_is_number($l) && _is_number($r)) {
my ($lf, $rf) = ($l + 0, $r + 0);
lib/BarefootJS/Evaluator.pm view on Meta::CPAN
return \@out;
}
# ---------------------------------------------------------------------------
# JSON-string seams â the adapters emit `bf->filter_eval($recv, '<json>', â¦)`;
# the predicate body arrives as a JSON string here, decoded then handed to the
# helper above (mirroring fold_json / sort_by_json).
# ---------------------------------------------------------------------------
sub filter_json ($items, $pred_json, $param, $base_env = undef) {
require JSON::PP;
view all matches for this distribution
view release on metacpan or search on metacpan
beamer-reveal-example_files/libs/revealjs/dist/reveal.esm.js.map view on Meta::CPAN
{"version":3,"file":"reveal.esm.js","sources":["../js/utils/util.js","../js/utils/device.js","../node_modules/fitty/dist/fitty.module.js","../js/controllers/slidecontent.js","../js/utils/constants.js","../js/controllers/slidenumber.js","../js/control...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Beanstalk/Client.pm view on Meta::CPAN
=item B<decoder ([$decoder])>
Set/get the serialization decoder. C<$decoder> is a reference to a
subroutine that will be called when data from the beanstalkd server needs to be
decoded. The subroutine will be passed the data fetched from the beanstalkd
server and should return a list of values the application can use.
(Default: YAML::Syck::Load)
=item B<error>
view all matches for this distribution
view release on metacpan or search on metacpan
share/SpamAssassin/easy_ham/00204.5c64400ff51925eb0ca4bc7bdab0bc09 view on Meta::CPAN
hextab ["4"] = 4; hextab ["C"] = 12;
hextab ["5"] = 5; hextab ["D"] = 13;
hextab ["6"] = 6; hextab ["E"] = 14;
hextab ["7"] = 7; hextab ["F"] = 15;
decoded = "";
i = 1;
len = length (str);
while ( i <= len ) {
c = substr (str, i, 1);
# check for usual start of URI hex encoding chars
share/SpamAssassin/easy_ham/00204.5c64400ff51925eb0ca4bc7bdab0bc09 view on Meta::CPAN
}
# + is space apparently
} else if ( c == "+" ) {
c = " "
}
decoded = decoded c;
++i;
}
return decoded
}
> Cheers,
> Dave.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bencode.pm view on Meta::CPAN
use Bencode qw( bencode bdecode );
my $bencoded = bencode { 'age' => 25, 'eyes' => 'blue' };
print $bencoded, "\n";
my $decoded = bdecode $bencoded;
=head1 DESCRIPTION
This module implements the BitTorrent I<bencode> serialisation format,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bib/CrossRef.pm view on Meta::CPAN
my $req = HTTP::Request->new(GET => 'https://api.crossref.org/works?mailto=doug@leith.ie&rows=1&query='.$cites_clean);
my $ua = LWP::UserAgent->new;
my $res = $ua->request($req);
if ($res->is_success) {
# extract json response
my $json = decode_json($res->decoded_content);
#use Data::Dumper;
#print Dumper($json->{'message'}{'items'});
my $ref={};
# keep a record of the query string we used
$ref->{'query'} = $cites;
lib/Bib/CrossRef.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new;
my $res = $ua->request($req);
if ($res->is_success) {
# now parse the xml
my $xs = XML::Simple->new();
my $data = $xs->XMLin($res->decoded_content);
my $cite = $data->{'query_result'}->{'body'}->{'query'}->{'doi_record'}->{'crossref'};
my $cc = undef;
if (exists($cite->{'conference'})) {
$self->_setgenre('proceeding');
if (exists($cite->{'conference'}->{'proceedings_metadata'})) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bib/Tools.pm view on Meta::CPAN
$ua->agent('Mozilla/5.0');
my $req = HTTP::Request->new(GET => $url);
my $res = $ua->request($req);
if ($res->is_success) {
my $tree= HTML::TreeBuilder::XPath->new;
$tree->parse($res->decoded_content);
my @atitles=$tree->findvalues('//tr[@class="gsc_a_tr"]/td/a[@class="gsc_a_at"]');
my @authors=$tree->findvalues('//tr[@class="gsc_a_tr"]/td/div[@class="gs_gray"][1]');
my @jtitles=$tree->findvalues('//tr[@class="gsc_a_tr"]/td/div[@class="gs_gray"][2]');
my $len1 = @atitles; my $len2 = @authors; my $len3 = @jtitles;
if (($len1 != $len2) || ($len1 != $len3) || ($len2 != $len3)) {$self->_err("Problem parsing google page: mismatched $len1 titles/$len2 authors/$len3 journals.");return []}
lib/Bib/Tools.pm view on Meta::CPAN
$ua->agent('Mozilla/5.0');
my $req = HTTP::Request->new(GET => $url);
my $res = $ua->request($req);
if ($res->is_success) {
my $tree= HTML::TreeBuilder::XPath->new;
$tree->parse($res->decoded_content);
my @atitles=$tree->findvalues('//div[@class="gs_ri"]/h3/a');
my @authors=$tree->findvalues('//div[@class="gs_a"]');
my $len1 = @atitles; my $len2 = @authors;
if ($len1 != $len2) {$self->_err("Problem parsing google page: mismatched $len1 titles/$len2 authors.");return [];}
my @cites=();
lib/Bib/Tools.pm view on Meta::CPAN
$ua->agent('Mozilla/5.0');
my $req = HTTP::Request->new(GET => $url);
my $res = $ua->request($req);
if ($res->is_success) {
my $xs = XML::Simple->new();
my $data = $xs->XMLin($res->decoded_content);
my @cites; my @ctemp;
if (defined $data->{'r'}) {
# a person page
@cites = $data->{'r'};
} elsif (defined $data->{'article'}) {
lib/Bib/Tools.pm view on Meta::CPAN
my $req = HTTP::Request->new(GET => "http://pub.orcid.org/$orcid_id/orcid-works/");
my $res = $ua->request($req);
if ($res->is_success) {
my $xs = XML::Simple->new();
# the orcid response is utf8 xml
my $data = $xs->XMLin($res->decoded_content);
my @cites = $data->{'orcid-profile'}->{'orcid-activities'}->{'orcid-works'}->{'orcid-work'};
foreach my $cite (@{$cites[0]}) {
my $entry = undef;
if ($cite->{'work-citation'}->{'work-citation-type'} =~ m/bibtex/) {
# we have a bibtex reference, extract some extra info
lib/Bib/Tools.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new;
$q =~ s/\s+/+/g;
my $req = HTTP::Request->new(GET => "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?usehistory=y&db=pubmed&term=".$q);
my $res = $ua->request($req);
if ($res->is_success) {
my $web = $1 if ($res->decoded_content =~ /<WebEnv>(\S+)<\/WebEnv>/);
my $key = $1 if ($res->decoded_content =~ /<QueryKey>(\d+)<\/QueryKey>/);
$req = HTTP::Request->new(GET => "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&query_key=$key&WebEnv=$web");
$res = $ua->request($req);
if ($res->is_success) {
my $xs = XML::Simple->new();
my $data = $xs->XMLin($res->decoded_content);
my @cites = $data->{'DocSum'};
foreach my $cite (@{$cites[0]}) {
my $c = $cite->{'Item'};
if (ref($c) ne "ARRAY") {next;}
my $r = Bib::CrossRef->new;
view all matches for this distribution
view release on metacpan or search on metacpan
To get a feel for how all this works, take a look at the scripts
in the pl/ directory (especially pl/ISO-msg-t-dumper.pm, which creates
the test cases for messages, and pl/ISO-t-dumper.pm, which creates
the test cases for basic types (if you want to dig that deeply)).
Messages are encoded to / decoded from BER-encoded files.
For encoding of messages, the module uses Convert::ASN1, which expects
a hash containing the data. The objects implement an as_asn() method
which returns this hash (and is invoked in the message-type object's
encode() method).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Biblio/RFID/SmartX.pm view on Meta::CPAN
return unless $data;
die "expecting array of sectors" unless ref $data eq 'ARRAY';
my $decoded;
foreach ( 4 .. 6 ) {
warn "# $_: ",
$decoded->[$_] = bcd( $data->[$_] );
}
my $hash;
$hash->{SXID} = substr( $decoded->[4], 0, 20 );
$hash->{JMBAG} = substr( $decoded->[4], 22, 10 );
$hash->{OIB} = substr( $decoded->[5], 16, 11 );
$hash->{SPOL} = substr( $data->[5], 14, 1 ); # char, not BCD!
$hash->{INST_ID} = substr( $decoded->[6], 0, 12 );
$hash->{CARD_V} = substr( $decoded->[6], 12, 4 );
warn "## hash = ",dump($hash);
return $hash;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bifcode.pm view on Meta::CPAN
# 37 3a 69 6e 74 65 67 65 72 2c 49 32 7:integer,I2
# 35 2c 55 35 3a 75 6e 64 65 66 2c 7e 5,U5:undef,~
# 55 34 3a 75 74 66 38 2c 55 32 3a c3 U4:utf8,U2:.
# 9f 2c 7d .,}
my $decoded = decode_bifcode $bifcode;
=head1 DESCRIPTION
B<Bifcode> implements the I<bifcode> serialisation format, a mixed
binary/text encoding with support for the following data types:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Binance/API/Request.pm view on Meta::CPAN
$response = $self->$method($url, %data);
} else {
$response = $self->$method($url);
}
if ($response->is_success) {
$response = eval { decode_json($response->decoded_content); };
if ($@) {
$self->{logger}->error(
"Error decoding response. \nStatus => " . $response->code . ",\n"
. 'Content => ' . ($response->content ? $response->content : '')
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bing/Translate.pm view on Meta::CPAN
$request->header(Authorization=>$authToken);
my $response = $ua->request($request);
#print $response->as_string, "\n";
if ($response->is_success) {
#print $response->decoded_content;
my $content = $response->decoded_content;
if ($content =~ />(.*)<\/string>/) {
return $1;
}
} else {
return "translate fail";
lib/Bing/Translate.pm view on Meta::CPAN
# my $content = $ua->request($request)->as_string() or die;
my $response = $ua->request($request);
my $content;
my $authToken;
if ($response->is_success) {
#print $response->decoded_content;
$content = $response->decoded_content;
my $accessToken = &decodeJSON($content);
$authToken = "Bearer" . " " . "$accessToken";
} else {
die $response->status_line;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bio/DB/BigWigSet.pm view on Meta::CPAN
unless ($response->is_success) {
warn "Web fetch of $dir failed: ",$response->status_line;
return;
}
my $html = $response->decoded_content;
my $base = $response->base;
my @wigfiles = map {URI::URL->new($_=>$base)->abs} $html =~ /href="([^\"]+\.bw)"/ig;
my @indices = map {URI::URL->new($_=>$base)->abs} $html =~ /href="(meta[^\"]*)"/ig;
return (\@wigfiles,\@indices);
}
lib/Bio/DB/BigWigSet.pm view on Meta::CPAN
my $r = $ua->get($file);
die "Couldn't read $file: ",$r->status_line unless $r->is_success;
eval "require IO::String; 1"
or die "IO::String module is required for remote directories"
unless IO::String->can('new');
$f = IO::String->new($r->decoded_content);
}
else {
$f = IO::File->new($file) or die "$file: $!";
}
my ($current_path,%wigs);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bio/BioVeL/Service.pm view on Meta::CPAN
# location is a URL
if ( $location =~ m#^(?:http|ftp|https)://# ) {
my $ua = LWP::UserAgent->new;
my $response = $ua->get($location);
if ( $response->is_success ) {
my $content = $response->decoded_content;
open my $fh, '<', \$content;
return $fh;
}
}
else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bio/EBI/RNAseqAPI.pm view on Meta::CPAN
my $response = $userAgent->get( $url );
# If the request was successful, return the parsed JSON.
if( $response->is_success ) {
return parse_json( $response->decoded_content );
}
# Otherwise, log an error and return undef.
else {
$logger->error(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bio/EnsEMBL/Utils/Net.pm view on Meta::CPAN
my ($url) = @_;
throw "Cannot perform action as LWP::UserAgent is not available" unless $LWP;
my $ua = LWP::UserAgent->new();
$ua->env_proxy;
my $response = $ua->get($url);
return $response->decoded_content if $response->is_success;
return;
}
sub _get_lwp_to_file {
my ($url, $filename) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/get_abundance_profile view on Meta::CPAN
if ($res->is_success){
if ($res->header('Content-Type') eq "application/json") {
my $json = JSON->new->allow_nonref;
my $biom = $json->decode( $res->decoded_content );
# transform biom into plain list
if ($biom->{matrix_type} eq "dense" and $format eq "plain"){
my $counter = 0;
scripts/get_abundance_profile view on Meta::CPAN
$counter++;
exit if ($debug and $counter == 20) ;
}
}
else{
print $res->decoded_content , "\n";
}
}
else{
print $res->decoded_content , "\n";
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bio/Phylo/CIPRES.pm view on Meta::CPAN
my $res = $ua->post( $url . '/job/' . $self->user, $load, @head );
if ( $res->is_success ) {
# run submission, parse result
my $status_url;
my $result = $res->decoded_content;
DEBUG $result;
XML::Twig->new(
'twig_handlers' => {
'jobstatus/selfUri/url' => sub { $status_url = $_->text }
}
lib/Bio/Phylo/CIPRES.pm view on Meta::CPAN
my $res = $ua->get( $url, @head );
if ( $res->is_success ) {
# post request, fetch result
my ( $status, $outfiles );
my $result = $res->decoded_content;
DEBUG $result;
XML::Twig->new(
'twig_handlers' => {
'jobstatus/resultsUri/url' => sub { $outfiles = $_->text },
'jobstatus/terminalStage' => sub { $status = $_->text }
lib/Bio/Phylo/CIPRES.pm view on Meta::CPAN
my $ua = $self->ua;
my @head = $self->headers(0);
my $res = $ua->get( $url, @head );
my %out_url;
if ( $res->is_success ) {
my $result = $res->decoded_content;
DEBUG $result;
XML::Twig->new(
'twig_handlers' => {
'results/jobfiles/jobfile' => sub {
my $node = $_;
lib/Bio/Phylo/CIPRES.pm view on Meta::CPAN
for my $name ( keys %out ) {
my $location = $out_url{ $name };
$res = $ua->get( $location, @head );
if ( $res->is_success ) {
open my $fh, '>', $out{ $name } or die $!;
print $fh $res->decoded_content;
}
else {
throw 'NetworkError' => $res->status_line;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bio/Phylo/NeXML/Entities.pm view on Meta::CPAN
Bio::Phylo::NeXML::Entities - Functions for dealing with XML entities
=head1 DESCRIPTION
This package provides subroutines for dealing with characters that need to be
encoded as XML entities, and decoded in other formats. For example: C<&> needs
to be encoded as C<&> in XML. The subroutines have the same signatures and
the same names as those in the commonly-used module L<HTML::Entities>. They are
re-implemented here to avoid introducing dependencies.
=head1 SUBROUTINES
lib/Bio/Phylo/NeXML/Entities.pm view on Meta::CPAN
Decodes XML entities into the characters they code for
Type : Utility function
Title : decode_entities
Usage : my $decoded = decode_entities('string with & or >')
Function: decodes encoded entities in argument string(s)
Returns : Array of decoded strings
Args : One or more encoded strings
=back
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bio/PhyloTastic/DateLife.pm view on Meta::CPAN
my $response = $ua->get($url);
if ( $response->is_success ) {
$log->info("success: " . $response->status_line);
# read result, this should be a single number
my $age = $response->decoded_content;
chomp($age);
if ( looks_like_number $age ) {
$log->info("age: $age");
return $age;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bio/Polloc/LocusIO/gff3.pm view on Meta::CPAN
The value to decode (str)
=head3 Returns
The decoded value (str)
=cut
sub _gff3_decode {
my($self,$value) = @_;
view all matches for this distribution