view release on metacpan or search on metacpan
lib/Dist/Zilla/Util/SimpleMunge.pm view on Meta::CPAN
The callback will be called as appropriate.
=over 4
=item * C<$content> will contain the content, I<decoded if possible>
=item * C<$encoding> will be either C<text> or C<bytes>, the latter if decoding is not possible.
=item * C<InMemory> will apply the code immediately
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Document/Manager.pm view on Meta::CPAN
foreach my $filename (keys %files) {
my $content = $files{$filename};
next unless $content;
($filename) = (File::Spec->splitpath($filename))[2];
my $local_filename = catfile('/tmp', $filename);
my $decoded = decode_base64($content);
if (! open(FILE, ">$local_filename") ) {
warn "Error: Could not open file '$local_filename' for writing: $!\n";
next;
}
binmode(FILE);
print FILE $decoded;
if (! close(FILE) ) {
warn "Error: Could not close file '$local_filename': $!\n";
}
$doc_id = $self->_repo()->add($local_filename);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Document/eSign/Docusign/sendRequest.pm view on Meta::CPAN
"An undefined method was used, only use GET, POST, PUT, or DELETE"
};
}
if ( $method =~ /GET|POST/ && $response->is_success ) {
return $json->decode( $response->decoded_content );
}
elsif ( $response->is_success )
{ #Calls that simply do something and are not expected to return data.
return { Status => $response->status_line };
}
view all matches for this distribution
view release on metacpan or search on metacpan
App-Domain-1.230280/_Deparsed_XSubs.pm view on Meta::CPAN
sub zip_shortest;
}
package MIME::Base64 {
sub decode($) ;
sub decode_base64($) ;
sub decoded_base64_length($) ;
sub encode($;$) ;
sub encode_base64($;$) ;
sub encoded_base64_length($;$) ;
}
package MIME::QuotedPrint {
view all matches for this distribution
view release on metacpan or search on metacpan
util/update-default.pl view on Meta::CPAN
sub retrieve_suffix {
my $ua = LWP::UserAgent->new(timeout => 10);
my $response = $ua->get('https://publicsuffix.org/list/public_suffix_list.dat');
if ($response->is_success()) {
return $response->decoded_content((charset => 'UTF-8'));
} else {
die 'Unable to retrieve suffix: ' . $response->status_line;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DomainOperations/ResellerClubHTTP.pm view on Meta::CPAN
# $pretty_printed_unencoded = $coder->encode ($perl_scalar);
my $perl_scalar = $coder->decode( $res->content );
# print Dumper $perl_scalar;
#$res->decoded_content;
return { $self->formatdomains($perl_scalar), 'error' => 0, };
}
else {
# print Dumper $req;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DracPerl/Client.pm view on Meta::CPAN
my $logout_page = $self->ua->post( $self->url . "/data/logout" );
$self->token(0);
$self->ua->default_header( "ST2", $self->token );
$self->log->debug( "Logging out : " . $logout_page->decoded_content );
return 1;
}
sub saveSession {
my ($self) = @_;
lib/DracPerl/Client.pm view on Meta::CPAN
return 0 unless $response->is_success;
# We don't really care about parsing the XML here, we just want to make sure
# it is returning *something*
return 0 unless $response->decoded_content =~ m/<TreeNodes>/;
return 1;
}
lib/DracPerl/Client.pm view on Meta::CPAN
}
);
if ( $response_raw->is_success ) {
$auth_model = DracPerl::Models::Auth->new(
xml => $response_raw->decoded_content );
$logged = !$auth_model->auth_result;
}
$need_to_retry = 0 if $logged;
$need_to_retry = 0 if $current_tries > $self->max_retries - 1;
lib/DracPerl/Client.pm view on Meta::CPAN
die( "Logging failed after " . $self->max_retries . " attempts" )
unless $logged;
$self->log->debug(
"Login Step 1 response : " . $response_raw->decoded_content );
my @tokens_parts = reverse split( "=", $auth_model->forward_url );
$self->log->info( "Success while opening session / " . $tokens_parts[0] );
lib/DracPerl/Client.pm view on Meta::CPAN
}
else {
$self->log->error("Error while fetching $query");
}
my $raw_response = $response->decoded_content;
return $self->_parse_response( $commands, $collections, $raw_response );
}
sub _parse_response {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Drupal/Admin.pm view on Meta::CPAN
with_fields => { name => $params{user}, pass => $params{password} }
);
$self->_die("Login failed -- reason unkown") unless $self->mech->success; # FIXME
$self->_die("Login failed -- wrong username/password")
unless $self->mech->response->decoded_content !~ /unrecognized username or password/;
}
# WARNING this has a dependency on an English string
sub offline {
my($self) = @_;
lib/Drupal/Admin.pm view on Meta::CPAN
$self->log_trace("Entering update()");
my $url = $self->{baseurl} . '/update.php';
my $response = $self->mech->get($url);
$self->_die('Access denied to update.php')
if $self->mech->response->decoded_content =~ /access denied/i;
$self->_update_check_errors;
$self->_die('No "Continue" button on page')
unless $self->mech->look_down('_tag', 'input', 'type', 'submit', 'value', 'Continue');
$self->mech->click_button(value => 'Continue');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dubber/API.pm view on Meta::CPAN
ssl_opts => { verify_hostname => $self->strict_ssl },
);
}
# ------------------------------------------------------------------------
method _clear_state () { $self->clear_decoded_response; $self->clear_response; }
# ------------------------------------------------------------------------
__PACKAGE__->meta->make_immutable;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DustyDB/Meta/Attribute.pm view on Meta::CPAN
This is a subroutine used to transform a Perl object into a something else you want to store. Since we use L<DBM::Deep> to store the objects, this can be much more flexible than just a scalar.
Be careful, though, not to store a hash with a C<class_name> key or very bad things might happen.
This subroutine should expect the decoded value in C<$_> and return whatever value should be stored.
=cut
has encode => (
is => 'rw',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EBook/FB2/Binary.pm view on Meta::CPAN
if (@nodes) {
$self->content_type($nodes[0]->getValue());
}
# XXX: eval this, it might fail with invalid data
my $decoded = MIME::Base64::decode($node->string_value());
$self->data($decoded)
}
1;
__END__
lib/EBook/FB2/Binary.pm view on Meta::CPAN
Returns id of binary element
=item data()
Returns content of binary element (base64-decoded)
=item content_type()
Returns content-type of binary element
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EBook/Ishmael/Decode.pm view on Meta::CPAN
B<EBook::Ishmael::Decode> does not export any subroutines by default.
=head2 $d = palmdoc_decode($data)
Decodes PalmDoc lz77-encoded C<$data>, returning the decoded data.
=head1 AUTHOR
Written by Samuel Young, E<lt>samyoung12788@gmail.comE<gt>.
view all matches for this distribution
view release on metacpan or search on metacpan
- encoding is now binmode syntax
0.42 2012-05-03
- we get decoded pod, so we have to ensure to write the file with
correct encoding (thx to reneeb)
0.41 2012-04-18
- stop spamming /tmp
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EBook/Tools/LZSS.pm view on Meta::CPAN
The eBookwise .IMP format typically compresses with 3 length bits.
Note that the actual length of the LZSS reference in bytes is greater
than the value stored in the length bits. The actual number of bytes
returned is the decoded length bits value plus C<maxuncoded> plus 1,
=item * C<offsetbits>
The number of bits used to encode the offset to a LZSS reference.
This also determines the size of the sliding window of reference data.
lib/EBook/Tools/LZSS.pm view on Meta::CPAN
spaces.
=item * C<windowstart>
The first byte position in the window that will be overwritten by
decoded text. If not specified, defaults to 0.
=item * C<maxuncoded>
The maximum number of uncoded bytes (?). This currently isn't used
for that purpose, but determines the actual length of a LZSS reference.
view all matches for this distribution
view release on metacpan or search on metacpan
Evas/Evas.xs view on Meta::CPAN
void
evas_object_text_style_pad_get(Evas_Object *obj, int *l, int *r, int *t, int *b)
int
evas_string_char_next_get(char *str, int pos, int *decoded)
int
evas_string_char_prev_get(char *str, int pos, int *decoded)
int
evas_string_char_len_get(char *str)
void
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-engines.t view on Meta::CPAN
use Encode;
use File::Basename;
use Scalar::Util qw(tainted);
my $encoded_text = "\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88";
my $decoded_text = decode_utf8($encoded_text);
my $unicode_notation = "\\u30C6\\u30B9\\u30C8";
my $invalid_text = "Invalid: \xFF";
my $sanitized_text = "Invalid: \xEF\xBF\xBD";
my $tainted_text = do {
open(my $in, dirname(__FILE__).'/data/tainted.txt') or die "$!: tainted.txt";
t/02-engines.t view on Meta::CPAN
close $in;
$tmp;
};
ok !Encode::is_utf8($encoded_text);
ok Encode::is_utf8($decoded_text);
isnt Encode::decode_utf8($invalid_text), $invalid_text;
ok tainted($tainted_text);
for my $engine (@EJS::Template::JSAdapter::SUPPORTED_ENGINES) {
eval {EJS::Template::JSAdapter->create($engine)};
t/02-engines.t view on Meta::CPAN
'C', 3, sub {'III'},
{str => 'F', num => 6, func => sub {'VI'}},
['G', 7, sub {'VII'}],
],
encoded => $encoded_text,
decoded => $decoded_text,
invalid => $invalid_text,
tainted => $tainted_text,
};
my $config = {engine => $engine};
t/02-engines.t view on Meta::CPAN
no strict 'refs';
my $sanitize_utf8 = ${"EJS::Template::JSAdapter::".$engine."::SANITIZE_UTF8"};
my $preserve_utf8 = ${"EJS::Template::JSAdapter::".$engine."::PRESERVE_UTF8"};
use strict 'refs';
my $decoded_text_expected = ($preserve_utf8 ? $decoded_text : $encoded_text);
my $invalid_text_expected = ($sanitize_utf8 ? $sanitized_text : $invalid_text);
ejs_test('<%= encoded %>', $encoded_text, $variables, $config);
ejs_test('<%= decoded %>', $decoded_text_expected, $variables, $config);
SKIP: {
if ($preserve_utf8) {
ejs_test("<%= '$unicode_notation' %>", $decoded_text, $variables, $config);
} else {
skip "$engine cannot preserve unicode", 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-basic.t view on Meta::CPAN
sub test_enums {
my $elf;
for (qw: executable shared relocatable core :) {
$elf= ELF::Writer->new(type => $_);
is( $elf->type_sym, $_, "enum type=$_ decoded" );
is( $elf->type, $ELF::Writer::type_from_sym{$_}, "enum type=$_ correct value" );
}
$elf= ELF::Writer->new(type => 42);
is( $elf->type, 42, "enum type=42 allowed" );
is( $elf->type_sym, 42, "enum type=42 decoded as self" );
for (qw: 32bit 64bit :) {
$elf= ELF::Writer->new(class => $_);
is( $elf->class_sym, $_, "enum class=$_ decoded" );
is( $elf->class, $ELF::Writer::class_from_sym{$_}, "enum class=$_ correct value" );
}
for (qw: 2LSB 2MSB :) {
$elf= ELF::Writer->new(data => $_);
is( $elf->data_sym, $_, "enum data=$_ decoded" );
is( $elf->data, $ELF::Writer::data_from_sym{$_}, "enum data=$_ correct value" );
}
for (qw: Linux Solaris :) {
$elf= ELF::Writer->new(osabi => $_);
is( $elf->osabi_sym, $_, "enum osabi=$_ decoded" );
is( $elf->osabi, $ELF::Writer::osabi_from_sym{$_}, "enum osabi=$_ correct value" );
}
for (qw: x86-64 :) {
$elf= ELF::Writer->new(machine => $_);
is( $elf->machine_sym, $_, "enum machine=$_ decoded" );
is( $elf->machine, $ELF::Writer::machine_from_sym{$_}, "enum machine=$_ correct value" );
}
for (qw: note :) {
my $seg= ELF::Writer::Segment->new(type => $_);
is( $seg->type_sym, $_, "enum segment.type=$_ decoded" );
is( $seg->type, $ELF::Writer::Segment::type_from_sym{$_}, "enum segment.type=$_ correct value" );
}
};
subtest simple_x86_64_elf => \&test_return_42;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ELab/Client.pm view on Meta::CPAN
file => [ $args{file} ]
},
Content_Type => 'form-data',
Authorization => $self->token(),
);
return decode_json $self->getUseragent()->request($request)->decoded_content();
}
sub upload_to_item {
lib/ELab/Client.pm view on Meta::CPAN
file => [ $args{file} ]
},
Content_Type => 'form-data',
Authorization => $self->token(),
);
return decode_json $self->getUseragent()->request($request)->decoded_content();
}
sub create_event {
view all matches for this distribution
view release on metacpan or search on metacpan
script/ecs_token view on Meta::CPAN
redirect_uri => $redirect_uri,
grant_type => 'authorization_code',
]);
die "Error - Access token request failed: " . $response->status_line . $/ .
$response->decoded_content . $/
unless $response->is_success;
print $OUT $response->decoded_content . $/;
# parse JSON response content
my $parsed_content = decode_json($response->decoded_content);
die "Error - Unexpected response content: " . ref($parsed_content) . $/
unless ref($parsed_content) eq 'HASH';
die "Error - Refresh token not received$/"
script/ecs_token view on Meta::CPAN
die "Error - Access token not received$/"
unless exists $parsed_content->{access_token};
if(not $nocache) {
store_cached_token($response->decoded_content, $token_request_timestamp);
}
}
if($command eq 'credentials') {
# using client credentials flow ... (with client secret, not cert-based JWT)
script/ecs_token view on Meta::CPAN
scope => $scope,
grant_type => 'client_credentials',
]);
die "Error - Access token request failed: " . $response->status_line . $/ .
$response->decoded_content . $/
unless $response->is_success;
# parse JSON response content
my $parsed_content = decode_json($response->decoded_content);
die "Error - Unexpected response content: " . ref($parsed_content) . $/
unless ref($parsed_content) eq 'HASH';
die "Error - Access token not received$/"
unless exists $parsed_content->{access_token};
if(not $nocache) {
store_cached_token($response->decoded_content, $token_request_timestamp);
}
# print access token
print $parsed_content->{access_token}, $/;
}
script/ecs_token view on Meta::CPAN
refresh_token => $refresh_token,
grant_type => 'refresh_token',
]);
die "Error - Access token request failed: " . $response->status_line . $/ .
$response->decoded_content . $/
unless $response->is_success;
# parse JSON response content
my $parsed_content = decode_json($response->decoded_content);
die "Error - Unexpected response content: " . ref($parsed_content) . $/
unless ref($parsed_content) eq 'HASH';
# if indicated, store new refresh token
script/ecs_token view on Meta::CPAN
die "Error - Access token not received$/"
unless exists $parsed_content->{access_token};
if(not $nocache) {
store_cached_token($response->decoded_content, $token_request_timestamp);
}
# print access token
print $parsed_content->{access_token}, $/;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EPFL/Net/ipv6Test.pm view on Meta::CPAN
my $ua = p_createUserAgent();
my $url = p_buildUrl( $api, $domain, $withScheme );
my $response = p_getUrl( $ua, $url );
if ( $response->is_success ) {
my $struct = from_json( $response->decoded_content );
return $struct;
}
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EPFL/Sciper/List.pm view on Meta::CPAN
my $ua = p_createUserAgent();
foreach my $letter (@alphabet) {
my $response = p_getUrl( $ua, p_buildUrl($letter) );
if ( $response->is_success ) {
my $struct = from_json( $response->decoded_content );
push @listPersons, @{ $struct->{result} };
}
}
my %hash = ();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ETL/Yertl/Adapter/graphite.pm view on Meta::CPAN
$url->query_form( %form );
#; say "Fetching $url";
my $res = $self->http_client->GET( $url )->get;
#; say $res->decoded_content;
if ( $res->is_error ) {
die sprintf "Error fetching metric '%s': " . $res->decoded_content . "\n", $metric;
}
my $result = decode_json( $res->decoded_content );
my @points;
for my $series ( @{ $result } ) {
for my $point ( @{ $series->{datapoints} } ) {
push @points, {
metric => $series->{target},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EZID.pm view on Meta::CPAN
my %metadata;
my $ua = LWP::UserAgent->new;
my $r = $ua->get("http://ezid.cdlib.org/id/$identifier");
if ($r->is_success) {
$response = { _parse($r->decoded_content) };
} else {
$self->{_error_msg} = $r->decoded_content;
}
return $response;
}
lib/EZID.pm view on Meta::CPAN
'Content-Type' => "text/plain; charset=UTF-8",
'Content' => $content);
my $response;
if ($r->is_success) {
$response = { _parse($r->decoded_content) };
} else {
$self->{_error_msg} = $r->decoded_content;
}
return $response;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Egg/Model/Auth/Crypt/CBC.pm view on Meta::CPAN
=head1 METHODS
=head2 password_check ([CRYPT_PASSWORD], [INPUT_PAWWORD])
CRYPT_PASSWORD is decoded and whether it agrees is confirmed with INPUT_PAWWORD.
=head2 create_password ([PLAIN_PASSWORD])
PLAIN_PASSWORD is encrypted.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Eixo/Rest/Request.pm view on Meta::CPAN
sub send {die ref($_[0]) . "::send: MUST BE DEFINED"}
sub unmarshall{
my ($self, $response) = @_;
my $content = $response->decoded_content(
default_charset=> 'UTF-8'
);
# nowadays (HTTP::Message v6.11)
# decoded_content isn't decoding utf8 charset
# if content_type is application/json
if($response->content_type eq 'application/json'){
use Encode;
$content = Encode::decode('UTF-8', $content);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Elastic/Model/Types.pm view on Meta::CPAN
has 'binary_field' => (
is => 'ro',
isa => Binary
);
Inherits from the C<Defined> type. Is automatically Base64 encoded/decoded.
=head2 GeoPoint
use Elastic::Model::Types qw(GeoPoint);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ElasticEmail.pm view on Meta::CPAN
push(@{$allTheData[0]}, ($fieldName, [$file, $localFileName]));
$num++;
}
$response = $ua->post($fullURL, Content_Type => 'multipart/form-data', Content => @allTheData);
}
my $content = $response->decoded_content();
return $content;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ElasticSearchX/Model/Generator.pm view on Meta::CPAN
returns the content of the URL at C<mapping_url>
=head2 _build__mapping_data
returns the decoded data from C<JSON> stored in C<_mapping_content>
=head1 AUTHOR
Kent Fredric <kentfredric@gmail.com>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Elastijk.pm view on Meta::CPAN
=head2 Elastijk::request( $args :HashRef ) : ($status :Int, $response :HashRef)
Making a request to the Elasticsearch server specified in C<$args>. It returns 2
values. C<$status> is the HTTP status code of the response, and the C<$response>
decoded as HashRef. Elasticsearch API always respond a single HashRef as JSON
text, this might or might not be changed in the future, if it is changed then
this function will be adjusted accordingly.
The C<$args> is a HashRef takes contains the following key-value pairs:
lib/Elastijk.pm view on Meta::CPAN
=head2 Elastijk::request_raw( $args :HashRef ) : ($status :Int, $response :Str)
Making a request to the Elasticsearch server specified in C<$args>. The main
difference between this function and C<Elastijk::request> is that
C<$args->{body}> s expected to be a String scalar, rather then a HashRef. And
the $response is not decoded from JSON. This function can be used if users wish
to use their own JSON parser to parse response, or if they wish to delay the
parsing to be done latter in some bulk-processing pipeline.
=head1 OBJECT
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Email/Abstract.pm view on Meta::CPAN
=head2 as_string
my $string = $email->as_string;
This returns the whole email as a decoded string.
=head2 cast
my $mime_entity = $email->cast('MIME::Entity');
lib/Email/Abstract.pm view on Meta::CPAN
#pod
#pod =head2 as_string
#pod
#pod my $string = $email->as_string;
#pod
#pod This returns the whole email as a decoded string.
#pod
#pod =head2 cast
#pod
#pod my $mime_entity = $email->cast('MIME::Entity');
#pod
view all matches for this distribution