view release on metacpan or search on metacpan
t/01_unit.t view on Meta::CPAN
);
}
};
my $resp2 = $client->item_properties( path => $path );
my $scalar = decode_json( $resp2->decoded_content );
is_deeply( $scalar->{properties}, $properties, 'properties are correct' );
my $artifact_url = "$artifactory:$port/$repository$path";
my $resp3 = $client->get($artifact_url);
is( $resp3->decoded_content, $content, 'content matches' );
};
subtest 'set_item_properties on non-existing artifact', sub {
my $client = setup();
my $properties = {
t/01_unit.t view on Meta::CPAN
'HTTP::Response'
);
};
my $resp = $client->item_properties( path => '/unique_path', properties => ['that'] );
my $scalar = decode_json( $resp->decoded_content );
is_deeply( $scalar->{properties}, { that => ['one'] }, 'property content is correct' );
};
subtest 'retrieve artifact', sub {
my $client = setup();
t/01_unit.t view on Meta::CPAN
'HTTP::Response'
);
};
my $resp = $client->retrieve_artifact('/unique_path');
is( $resp->decoded_content, $content, 'artifact retrieved successfully' );
};
subtest 'all_builds', sub {
my $client = setup();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeBarCodeCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeCellsCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeDiagramCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeEmailCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeImagingCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeOcrCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposePdfCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeSlidesCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
lib/AsposeSlidesCloud/ApiClient.pm view on Meta::CPAN
my $_response = $self->{ua}->request($_request);
unless ($_response->is_success) {
my $content = sprintf("%s", $_response->content);
croak(sprintf "API Exception(%s): %s\n%s", 401, $_response->message, $content);
}
my $decoded_data = decode_json $_response->content;
$self->{config}{access_token} = $decoded_data->{access_token};
}
if (defined $self->{config}{access_token} && $self->{config}{access_token} ne "") {
$header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token};
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeStorageCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeTasksCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeThreeDCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AsposeWordsCloud/ApiClient.pm view on Meta::CPAN
return undef;
} elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash
if ($class =~ /^HASH\[(.*),(.*)\]$/) {
my ($key_type, $type) = ($1, $2);
my %hash;
my $decoded_data = decode_json $data;
foreach my $key (keys %$decoded_data) {
if (ref $decoded_data->{$key} eq 'HASH') {
$hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key});
} else {
$hash{$key} = $self->deserialize($type, $decoded_data->{$key});
}
}
return \%hash;
} else {
#TODO log error
view all matches for this distribution
view release on metacpan or search on metacpan
t/write_module.t view on Meta::CPAN
my $content = path($p)->slurp_raw;
write_module( $p, $paths{$p}, $tmpdir );
use_ok( $paths{$p} );
{
no strict 'refs';
eq_or_diff( ${"$paths{$p}::content"}, $content, "Loaded and decoded copy of $p" );
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/Coords/Angle.pm view on Meta::CPAN
"d", "m" or "s", "degrees" if the supplied number is greater than 2*PI
(6.28), and "radians" for all other values. Negative angles are supported.
The options for range are documented in the C<range> method.
If the angle can not be decoded (if a string), the constructor will fail.
=cut
sub new {
my $proto = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/DSS/JPEG.pm view on Meta::CPAN
}
my $res = $self->_get_dss(_process_options(%opts));
if ($res->is_success) {
return $res if $opts{filename};
return $res->decoded_content;
} else {
die "*ERROR* Could not access DSS at: ".$res->request->uri
."\nHTTP Response:\n".$res->status_line;
}
}
lib/Astro/DSS/JPEG.pm view on Meta::CPAN
my $res = $self->{ua}->get(
$self->{simbad_url}."?output.format=ASCII&Ident=".$opts{target}
);
if ($res->is_success) {
my $simbad = $res->decoded_content;
if ($simbad =~ /\(ICRS,ep=J2000,eq=2000\): (\S+ \S+ \S+)\s+(\S+ \S+ \S+)/) {
$opts{ra} = $1;
$opts{dec} = $2;
} else {
die "*ERROR* Could not parse SIMBAD output:\n$simbad";
view all matches for this distribution
view release on metacpan or search on metacpan
palsrc/palDfltin.c view on Meta::CPAN
* void palDfltin( const char * string, int *nstrt,
* double *dreslt, int *jflag );
* Arguments:
* string = const char * (Given)
* String containing number to be decoded.
* nstrt = int * (Given and Returned)
* Character number indicating where decoding should start.
* On output its value is updated to be the location of the
* possible next value. For compatibility with SLA the first
* character is index 1.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Mock/LWP/UserAgent.pm view on Meta::CPAN
The canned response file is a JSON representaton of a hash keyed by URL
and, within URL, by HTTP method (C<GET>, C<POST>, and so on). The actual
responses are four-element arrays that constitute the arguments to
C<< HTTP::Response->new() >>.
Assuming the given file can be opened, read, and decoded, any request
will be satisfied by an L<HTTP::Response|HTTP::Response> object
generated from the data in the file. If the URL and method do not appear
in the file, a 404 response is generated.
=head1 METHODS
inc/Mock/LWP/UserAgent.pm view on Meta::CPAN
=head2 __load_data
This subroutine loads data from a JSON file and returns a reference to a
two-element hash. Key C<{path}> contains the path to the file, and key
C<{data}> contains the data in the file, after it has been decoded from
JSON.
The path to the file comes from
C<$Mock::LWP::UserAgent::CANNED_DATA_FILE>. If that is C<undef> (which
it is by default), F<t/data/Mock-LWP-UserAgent/resp.json> is read.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/Coord/ECI/TLE.pm view on Meta::CPAN
Users of JSON functionality (if any!) should be aware of a potential
problem in the way L<JSON::XS|JSON::XS> encodes numbers. The problem
basically is that the locale leaks into the encoded JSON, and if the
locale uses commas for decimal points the encoded JSON can not be
decoded. As I understand the discussion on the associated Perl ticket
the problem has always been there, but changes introduced in Perl 5.19.8
made it more likely to manifest.
Unfortunately the nature of the JSON interface is such that I have no
control over the issue, since the workaround needs to be applied at the
lib/Astro/Coord/ECI/TLE.pm view on Meta::CPAN
The default is 1 (i.e. true).
=item bstardrag (numeric, parse)
This attribute contains the B* drag term, decoded into a number.
=item classification (string, parse)
This attribute contains the security classification. You should
expect to see only the value 'U', for 'Unclassified.'
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/Event/Interval.pm view on Meta::CPAN
=head1 SYNOPSIS
Here's an example of a simple asynchronous event that fetches JSON data from a
website every two seconds using a shared scalar variable to hold the decoded
JSON hashref, while allowing the main application to continue running in the
foreground. Multiple events can be used simultaneously if desired.
See the L</SCENARIOS/EXAMPLES> section for further usage examples.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/Redis.pm view on Meta::CPAN
return $data;
}
# Non-throwing decoder used by the unified reader. Classifies each frame
# as one of:
# ('ok', $decoded_value) - normal response
# ('redis_error', $error_object) - -ERR frame from Redis
# ('protocol_error', $error_object) - fatal desync (malformed)
sub _decode_response_result {
my ($self, $msg) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
Resumes a previous session using stored tokens and metadata.
=head2 C<get( $method, [ \%params ] )>
Calls an XRPC query (GET). Returns the decoded JSON response.
=head2 C<post( $method, [ \%data ] )>
Calls an XRPC procedure (POST). Returns the decoded JSON response.
=head2 C<subscribe( $method, $callback )>
Connects to a WebSocket stream (Firehose).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Attean/API/Model.pm view on Meta::CPAN
if ($resp->is_success) {
my $ct = $resp->header('Content-Type');
my $pclass = Attean->get_parser( media_type => $ct, filename => $url ) // Attean->get_parser('ntriples');
if ($pclass) {
my $p = $pclass->new(base => iri($url));
my $str = $resp->decoded_content;
my $bytes = encode('UTF-8', $str, Encode::FB_CROAK);
my $iter = eval { $p->parse_iter_from_bytes( $bytes ) };
if ($@) {
die "Failed to parse URL $url: $@";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Attribute/Handlers.pm view on Meta::CPAN
};
}
else { $data = undef }
}
# now call the handler with the $data decoded (maybe)
$pkg->$handler($sym,
(ref $sym eq 'GLOB' ? *{$sym}{ref $ref}||$ref : $ref),
$attr,
$data,
$phase,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Audio/Digest/MP3.pm view on Meta::CPAN
Sometimes you want to know if you have duplicate MP3 files on your disks. But
as soon as you start editing the ID3 tags, the file contents changes, and you
can no longer trust a plain MD5 checksum on the file, nor the file size, to
compare them.
This module scans the MP3 file, only including the audio stream (undecoded!) to
calculate the message digest.
While it scans, it compiles more metadata about the file, such as playing time,
either in seconds or as formatted string, bitrate (in kbits/sec), stream size
in bytes, and whether the file is a CBR or a VBR file.
view all matches for this distribution
view release on metacpan or search on metacpan
libsamplerate/doc/api_full.html view on Meta::CPAN
output frames.
</P>
<P>
The <B>src_process</B> function returns non-zero if an error occurs.
The non-zero error return value can be decoded into a text string using the function
documented <A HREF="api_misc.html#ErrorReporting">here</A>.
</P>
<A NAME="Reset"></A>
<H3><BR>Reset</H3>
libsamplerate/doc/api_full.html view on Meta::CPAN
<B>src_callback_process</B>.
<p/>
<P>
This function returns non-zero on error and the error return value can be
decoded into a text string using the function documented
<A HREF="api_misc.html#ErrorReporting">here</A>.</P>
<!-- <A HREF="mailto:aldel@mega-nerd.com">For the spam bots</A> -->
</DIV>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Audio/M4P.pm view on Meta::CPAN
print "Artist is $tags->{ARTIST}\n" if $tags->{ARTIST};
use Audio::M4P::Decrypt;
my $outfile = 'mydecodedfile';
my $deDRMS = new Audio::M4P::Decrypt;
$deDRMS->DeDRMS($mp4file, $outfile);
See also the individual pod documentation for Audio::M4P::QuickTime
and Audio::M4P::Decrypt.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Audio/MPC.pm view on Meta::CPAN
Returns the newly created object or C<undef> in case of an error. In this case,
check C<< Audio::MPC->errstr >>.
=item B<decode> (buffer, [ MPC_LITTLE_ENDIAN || MPC_BIG_ENDIAN ])
Reads data from the audio-stream and puts the decoded PCM-samples into
I<buffer> which must not be readonly. The PCM data will be stereo (that is, two
channels) and 44.1 kHZ with each sample 16 bit wide.
The optional second argument specifies the byte-order of each sample. If not
specified, I<MPC_LITTLE_ENDIAN> is assumed.
Returns the length of I<buffer>, "0 but true" if the stream was succesfully
decoded with no more samples left and false in case of an error.
=item B<errstr>
This class method returns a string telling you what kind of error occured.
Currently, only use this method after the constructor C<new> failed to return a
lib/Audio/MPC.pm view on Meta::CPAN
=item * canseek (reader)
The function is expected to return a true value if the underlying filehandle
is seekable. However, experiments showed that non-seekable streams cannot be
decoded and are therefore not handled at all:
sub canseek {
my $reader = shift;
return seek $reader->fh, 0, SEEK_CUR; # test if seek succeeded
}
view all matches for this distribution
view release on metacpan or search on metacpan
=item B<new>()
This creates a new object. Each object has it's own private context, so
it is possible to have more than one object created at a time.
Once a stream has started to be decoded, the object may only be used for
that stream (due to state information kept in the object).
=item B<$len> = B<buffer>(I<$data>)
This method adds an arbitrary "chunk" of input MP3 data to the internal
buffering pool. Typically, this is at least 4KB of data. A good length
of data to pass is 40KB (approximately 1 second of audio encoded at 320kbps
or 2.5 seconds of audio encoded at 128KBs).
Method returns the length of data, in bytes, that has not be decoded yet.
=item B<decode_frame>()
This method will process the next MP3 frame of the data that has been
buffered with B<buffer>(), prepares it for PCM synthesis. The prepared
data is stored in the object. Do not use both this function and
B<decode_frame_header>() on the same object.
Method returns 1 if a frame was decoded (successfully or not), and 0
if it ran out of data before finishing decoding.
Upon return, program should interrogate I<$obj->err>. If it is > 0, then
a decoding error has occurred, and no PCM synthesis is possible (i.e. frame
should be skipped). See the EXAMPLES section later in this document.
Returns an English string describing the error condition.
=item B<current_frame>()
Returns the current MP3 frame that was decoded.
=item B<total_frames>()
Returns the total number of MP3 frames decoded. Used after decoding has
been completed.
=item B<frame_duration>()
Returns the length of the frame, in seconds, that was decoded.
=item B<total_duration>()
Returns the total duration, in seconds, that was decoded. Used after decoding
has been completed.
=item B<bit_rate>()
Returns the bitrate, in kbs, of the frame that was decoded.
=item B<average_bit_rate>()
Returns the average bitrate of the decoded frames. Used after decoding has
been completed.
=item B<sample_rate>()
Returns the samplerate, in Hertz, of the decoded frame.
=item B<layer>()
Returns the MPEG audio layer number of the decoded frame.
=item B<channels>()
Returns the number of PCM channels that were decoded (1 or 2) of the
decoded frame.
=item B<pcm>()
Returns the synthesized PCM structure of the decoded/synthesized frame.
This format is in a 24bit fixed-point format, and is only intended for
passing to an B<Audio::MPEG::Output> object. It is also intended to be
used by a planned future filtering object.
=back
=item B<header>($I<datasize>)
This method will return a header (first few bytes of data) that is valid
for the output type. $I<datasize> refers to the length of audio data in bytes.
If not passed the length, B<header>() will output a valid header, except that
the embedded length will be zero. After the sample is decoded, header is
typically called again, and re-written to the beginning of the file (see
the EXAMPLE section of the document). If called with an object type that
does not have a header, this returns an empty scalar.
Currently, only Sun mulaw and WAV formats have headers.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Audio/Mad/Frame.pm view on Meta::CPAN
=item * bitrate
=item * samplerate
These functions retrieve the information from the currently
decoded frame header. layer, mode, and flags correspond
to the MAD_LAYER_, MAD_MODE_, and MAD_FLAG_ constants.
bitrate and samplerate are represented as integers.
=item * duration
Returns the duration of the currently decoded frame as an
Audio::Mad::Timer object. See Audio::Mad::Timer's manpage
for details on what this means.
=item * NCHANNELS
view all matches for this distribution