view release on metacpan or search on metacpan
print "Connecting... " if $verbose;
my $response = $browser->get($self->{url}.'&devid='.$sn);
if($response->is_success)
{
print "OK\n" if $verbose;
my $answer=$response->decoded_content;
if($answer eq 'OK:GEN')
{
print "No defined model, using Generics.\n" if $verbose;
if(my $host=$self->getgeneric)
{
$printers++;
print "Printer found: $sn\n" if $verbose;
my $response = $browser->get($self->{url}.'&devid='.$sn);
if($response->is_success)
{
my $answer=$response->decoded_content;
if($answer eq 'OK:GEN')
{
print "No model identified, using Generics.\n" if $verbose;
if(my $host=$self->getgeneric)
{
view all matches for this distribution
view release on metacpan or search on metacpan
src/catch.hpp view on Meta::CPAN
break;
}
// UTF-8 territory
// Check if the encoding is valid and if it is not, hex escape bytes.
// Important: We do not check the exact decoded values for validity, only the encoding format
// First check that this bytes is a valid lead byte:
// This means that it is not encoded as 1111 1XXX
// Or as 10XX XXXX
if (c < 0xC0 ||
c >= 0xF8) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CPU/Z80/Disassembler.pm view on Meta::CPAN
session, and the outout is the <bin_file>.asm. After each run, the user studies the output
.asm file, and includes new commands in the control file to add information to the
.asm file on the next run.
This function creates a template control file that contains just the hex dump of the
binary file and the decoded assembly instruction at each address, e.g.
0000 :F <bin_file>
0000 D3FD out ($FD),a
0002 01FF7F ld bc,$7FFF
0005 C3CB03 jp $03CB
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CSAF/Util/CVSS.pm view on Meta::CPAN
sub decode_cvss_vector_string {
my $vector_string = shift;
my $decoded = {};
if ($vector_string =~ /^CVSS:3[.][0-1]\/(.*)/) {
my %cvss = split /[:\/]/, $1;
lib/CSAF/Util/CVSS.pm view on Meta::CPAN
if (defined $CVSS3_METRIC_LABEL->{$metric}) {
my $value = $cvss{$metric};
my $label = $CVSS3_METRIC_LABEL->{$metric};
$decoded->{$label} = $CVSS3_METRIC_VALUES->{$metric}->{$value} || $value;
}
}
}
lib/CSAF/Util/CVSS.pm view on Meta::CPAN
if (defined $CVSS2_METRIC_LABEL->{$metric}) {
my $value = $cvss{$metric};
my $label = $CVSS2_METRIC_LABEL->{$metric};
$decoded->{$label} = $CVSS2_METRIC_VALUES->{$metric}->{$value} || $value;
}
}
}
return $decoded;
}
1;
lib/CSAF/Util/CVSS.pm view on Meta::CPAN
=item decode_cvss_vector_string
Decode the provided CVSS (v2.0 or v3.x) vector string.
my $decoded = decode_cvss_vector_string('CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:L/E:F/RL:O/RC:C');
say $decoded->{attackVector}; # LOCAL
=back
=head1 SUPPORT
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CSS/DOM.pm view on Meta::CPAN
If this is specified and set to a true value, then CSS::DOM will treat the
CSS code as a string of bytes, and try to decode it based on @charset rules
and byte order marks.
By default it assumes that it is already in Unicode (i.e., decoded).
=item encoding_hint
Use this to provide a hint as to what the encoding might be.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CSS/Inliner.pm view on Meta::CPAN
# fetch and retrieve the remote content
my ($content,$baseref,$ctcharset) = $self->_fetch_url({ url => $$params{url} });
my $charset = $self->detect_charset({ content => $content, charset => $$params{charset}, ctcharset => $ctcharset });
my $decoded_html;
if ($charset) {
$decoded_html = $self->decode_characters({ content => $content, charset => $charset });
}
else {
# no good hints found, do the best we can
if ($self->_fixlatin()) {
Encoding::FixLatin->import('fix_latin');
$decoded_html = fix_latin($content);
}
else {
$decoded_html = $self->decode_characters({ content => $content, charset => 'ascii' });
}
}
my $html = $self->_absolutize_references({ content => $decoded_html, baseref => $baseref });
$self->read({ html => $html, charset => $charset });
return();
}
lib/CSS/Inliner.pm view on Meta::CPAN
open FILE, "<", $$params{filename} or die $!;
my $content = do { local( $/ ) ; <FILE> };
my $charset = $self->detect_charset({ content => $content, charset => $$params{charset} });
my $decoded_html;
if ($charset) {
$decoded_html = $self->decode_characters({ content => $content, charset => $charset });
}
else {
# no good hints found, do the best we can
if ($self->_fixlatin()) {
Encoding::FixLatin->import('fix_latin');
$decoded_html = fix_latin($content);
}
else {
$decoded_html = $self->decode_characters({ content => $content, charset => 'ascii' });
}
}
$self->read({ html => $decoded_html, charset => $charset });
return();
}
=head2 read
lib/CSS/Inliner.pm view on Meta::CPAN
}
my $content = $$params{content};
my $charset = $$params{charset};
my $decoded_html;
eval {
$decoded_html = decode($charset,$content);
};
if (!$decoded_html) {
croak('Error decoding content with character set "'.$$params{charset}.'"');
}
return $decoded_html;
}
=head2 inlinify
Processes the html data that was entered through either 'read' or
lib/CSS/Inliner.pm view on Meta::CPAN
my ($self,$params) = @_;
$self->_check_object();
# we are going to parse an html document as ascii that is not necessarily ascii - silence the warning
local $SIG{__WARN__} = sub { my $warning = shift; warn $warning unless $warning =~ /^Parsing of undecoded UTF-8/ };
# parse document and pull out key header elements
my $extract_tree = new CSS::Inliner::TreeBuilder();
$self->_configure_tree({ tree => $extract_tree });
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CSS/Object.pm view on Meta::CPAN
use CSS::Object;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $resp = $ua->get( $style_uri );
die( $resp->message ) if( $resp->is_error );
my $style = $resp->decoded_content;
my $css = CSS::Object->new;
$css->read_string( $style );
$css->rules->foreach(sub
{
my $rule = shift( @_ );
lib/CSS/Object.pm view on Meta::CPAN
use HTML::Object::XQuery;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $resp = $ua->get( $document_uri );
die( $resp->message ) if( $resp->is_error );
my $html = $resp->decoded_content;
my $parser = HTML::Object->new;
my $doc = $parser->parse( $html ) || die( $parser->error );
my $styles = $doc->find( 'style' ) || die( $doc->error );
say "Nothing found", exit(0) unless( $styles->length > 0 );
my $data = $styles->children->first->text();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CSS/Prepare.pm view on Meta::CPAN
my $resp = $http->get( $url );
my $code = $resp->code();
given ( $code ) {
when ( 200 ) { return $resp->decoded_content(); }
default { return; }
}
}
sub copy_file_to_staging {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/Ehcache.pm view on Meta::CPAN
sub get {
my $self = shift;
my ($key) = @_;
my $res = $self->ua->get( $self->_make_url($key) );
if ( $res->is_success ) {
return $res->decoded_content;
}
elsif ( $res->code != HTTP_NOT_FOUND ) {
warn $res->status_line . "\n";
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/TSVRPC/Client.pm view on Meta::CPAN
],
method => 'POST',
content => $content,
special_headers => \%special_headers,
);
my $decoded_body;
if (my $content_type = $special_headers{'content-type'}) {
my $res_encoding = TSVRPC::Util::parse_content_type( $content_type );
$decoded_body = defined($res_encoding) ? TSVRPC::Parser::decode_tsvrpc( $body, $res_encoding ) : undef;
}
return ($code, $decoded_body, $msg);
}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
t/11datetime.t view on Meta::CPAN
if($test->{invalid}) {
is($date,undef,"date failed to encode [@{$test->{array}}] correctly");
} else {
ok($date,"date encoded [@{$test->{array}}]");
my @date = decode_date($date);
is_deeply(\@date,$test->{array},"date decoded [@{$test->{array}}]");
}
}
foreach my $test (@diffs) {
my ($date1,$date2);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/data/MHistoryRelaxedEncoding.js view on Meta::CPAN
/**
* Decodes a fragment identifier into a string
*
* @param value {String} The fragment identifier
* @return {String} The decoded fragment identifier
*/
_decode: function(value) {
if (qx.lang.Type.isString(value)) {
return decodeURI(value);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CanvasCloud/API/Account/Report.pm view on Meta::CPAN
sleep 20; ## sleep 20 seconds and try again
$attempts--;
}
}
die $resp->status_line unless ( $resp->is_success );
return $resp->decoded_content( charset => 'none' );
}
warn sprintf('Report->get ASSERT: id(%s) returned last status (%s)', $result->{id}, $result->{status} );
return undef; ## never should but nothing would be retured
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Captcha/NocaptchaMailru.pm view on Meta::CPAN
sub _get_json_by_url {
my $agent = LWP::UserAgent->new();
my $resp = $agent->get($_[0]);
return 'request failed' unless $resp->is_success;
my $json = eval {
decode_json($resp->decoded_content);
};
return 'JSON parsing failed' if $@;
return $json;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Captcha/reCAPTCHA/V3.pm view on Meta::CPAN
# Enable LWP debugging
use LWP::Debug qw(+);
my $res = $ua->post( $self->{'verify_api'}, $params );
if ( $res->is_success ) {
return decode_json( $res->decoded_content );
} else {
croak $res->status_line;
}
}
lib/Captcha/reCAPTCHA/V3.pm view on Meta::CPAN
The default I<query_name> is 'g-recaptcha-response' and it is stocked in constructor.
But now string-context provides you to get I<query_name> so we don't have to care about it.
The response contains JSON so it returns decoded value from JSON.
unless ( $content->{'success'} ) {
# code for failing like below
die 'fail to verify reCAPTCHA: ', @{ $content->{'error-codes'} }, "\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Caroline.pm view on Meta::CPAN
my $c = ReadKey(0);
return undef unless defined $c;
return $c unless $IS_WIN32;
# Win32 API always return the bytes encoded with ACP. So it must be
# decoded from double byte sequence. To detect double byte sequence, it
# use Win32 API IsDBCSLeadByte.
require Win32::API;
require Encode;
require Term::Encoding;
$self->{isleadbyte} ||= Win32::API->new(
view all matches for this distribution
view release on metacpan or search on metacpan
t/20-meth-decipher.t view on Meta::CPAN
# decipher_child_error() by sub-classing.
#-----
sub decipher_child_error {
my( $self ) = @_;
$self->fixed('decoded');
return;
}
no Moose;
__PACKAGE__->meta->make_immutable;
}
t/20-meth-decipher.t view on Meta::CPAN
#-----
throws_ok{ fatal1 'handler' }
qr{
^
\Q *** Description ***\E \r? \n
\Q decoded\E \r? \n
}xm,
'Subclassed decipher_child_header() overrides base';
}
view all matches for this distribution
view release on metacpan or search on metacpan
if (use_hashes) {
HV *this_row = newHV();
av_push(RETVAL, newRV_noinc((SV*)this_row));
for (j = 0; j < col_count; j++) {
SV *decoded = newSV(0);
hv_store_ent(this_row, columns[j].name, decoded, columns[j].name_hash);
decode_cell(aTHX_ ptr, size, &pos, &columns[j].type, decoded);
}
} else {
AV *this_row = newAV();
av_push(RETVAL, newRV_noinc((SV*)this_row));
for (j = 0; j < col_count; j++) {
SV *decoded = newSV(0);
av_push(this_row, decoded);
decode_cell(aTHX_ ptr, size, &pos, &columns[j].type, decoded);
}
}
}
OUTPUT:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Authentication/Credential/Crowd.pm view on Meta::CPAN
return $user;
} else {
$c->stash( auth_error_msg => 'Authenticated user, but could not locate in store!' );
return;
}
} elsif ($response->code == 403 && $response->decoded_content =~ m|<h1>HTTP Status 403 - (.*?)</h1>|i) {
# indicates a tomcat problem, should probably do something else here?
$c->log->warn("Problem comunicating with crowd server: " . $response->code );
$c->stash( auth_error_msg => 'tomcat problem: ' . $1 );
} else {
$c->stash( auth_error_msg => $response->decoded_content );
}
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Authentication/Store/Crowd.pm view on Meta::CPAN
sub find_user {
my ($self, $info) = @_;
my $response = $self->_crowd_get_user( $info->{username} );
if ( $response->is_success ){
my $crowd_user_info = from_json( $response->decoded_content );
return Catalyst::Authentication::Store::Crowd::User->new({
info => $crowd_user_info
});
}
return;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Controller/DBIC/API.pm view on Meta::CPAN
lazy_build => 1,
);
sub _build__json {
# no ->utf8 here because the request params get decoded by Catalyst
return JSON::MaybeXS->new;
}
with 'Catalyst::Controller::DBIC::API::StoredResultSource',
'Catalyst::Controller::DBIC::API::StaticArguments';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Controller/SimpleCAS/Role/TextTranscode.pm view on Meta::CPAN
## MIME header, but I'm no expert on Unicode). Below we're basically trying
## all of the functions of HTML::Encoding until we find one that gives us
## an answer, and if we do get an answer, we apply it to the MIME object before
## calling ->body_str() which will then use it to decode to text.
##
my $decoded = $MainPart->body; # <-- decodes from base64 (or whatever) to *bytes*
my $char_set =
HTML::Encoding::encoding_from_html_document ($decoded) ||
HTML::Encoding::encoding_from_byte_order_mark ($decoded) ||
HTML::Encoding::encoding_from_meta_element ($decoded) ||
HTML::Encoding::xml_declaration_from_octets ($decoded) ||
HTML::Encoding::encoding_from_first_chars ($decoded) ||
HTML::Encoding::encoding_from_xml_declaration ($decoded) ||
HTML::Encoding::encoding_from_content_type ($decoded) ||
HTML::Encoding::encoding_from_xml_document ($decoded);
$MainPart->charset_set( $char_set ) if ($char_set);
## ------
my $html = $MainPart->body_str; # <-- decodes to text using the character_set
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/TestApp/Controller/Action/Chained.pm view on Meta::CPAN
sub star_search : Chained('view') PathPart('search') Args(0) { }
sub doc_star : Chained('/') PathPart('chained/doc') Args(1) {}
sub return_arg : Chained('view') PathPart('return_arg') Args(1) {}
sub return_arg_decoded : Chained('/') PathPart('chained/return_arg_decoded') Args(1) {
my ($self, $c) = @_;
$c->req->args([ map { decode_entities($_) } @{ $c->req->args }]);
}
sub roundtrip_urifor : Chained('/') PathPart('chained/roundtrip_urifor') CaptureArgs(1) {}
view all matches for this distribution
view release on metacpan or search on metacpan
t/live_engine_request_parameters.t view on Meta::CPAN
ok( my $response = request("http://localhost/dump/request?q=foo%2bbar"),
'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->content_type, 'text/plain', 'Response Content-Type' );
ok( eval '$creq = ' . $response->content );
is $creq->{parameters}->{q}, 'foo+bar', '%2b not double decoded';
}
{
my $creq;
ok( my $response = request("http://localhost/dump/request?q=foo=bar"),
view all matches for this distribution
view release on metacpan or search on metacpan
0.06 - 0-10; Beta
Api and internals may still change, but changes are smaller now.
Misc
- Error handling
Handle situation when getting non-decoded content back
- Serializers
Is it possible to send json and receive yaml? Should I handle it?
- Find a way to overwrite request object so it will be possible to use in
controller tests (?)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Authentication/Credential/GooglePlus.pm view on Meta::CPAN
=back
=head3 RETURNS
User found by calling L<Catalyst::Authentication::Realm/find_user> with the
decoded token's information, if any.
=cut
sub authenticate {
my ($self, $c, $realm, $authinfo) = @_;
lib/Catalyst/Plugin/Authentication/Credential/GooglePlus.pm view on Meta::CPAN
}
=head2 retrieve_certs
Retrieves a pair of JSON-encoded certificates from the given $url (defaults to
Google's public cert url), and returns the decoded JSON object.
If a cache plugin is loaded, the certificate pair is cached; however one of the
certificates is expired, a new pair is fetched from $url.
=head3 ARGUMENTS
lib/Catalyst/Plugin/Authentication/Credential/GooglePlus.pm view on Meta::CPAN
return time > $expiry;
}
=head2 decode
Returns the decoded information contained in a user's token.
=head3 ARGUMENTS
=over
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/ConfigLoader/Environment.pm view on Meta::CPAN
Double colons are converted into double underscores. For
compatibility's sake, support for the 0.01-style use of
bourne-incompatible variable names is retained.
Values are JSON-decoded if they look like JSON arrays or objects
(i.e. if they're enclosed in []s or {}s). Taking advantage of that, we
can write the same example this way:
MYAPP_name=MyApp
MYAPP_title=This is My App!
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/EncryptID.pm view on Meta::CPAN
=head2 encrypt_data
C<encrypt_data(ID [,PREFIX])> - Encrypt the given ID, returns the encoded hash value.
If "PREFIX" is given, it will be added to the ID before encoding.
It can be used when decoding to verify the decoded value is valid.
=cut
sub encrypt_data {
my( $c, $text, $prefix ) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/HTML/Scrubber.pm view on Meta::CPAN
# Firstly, if an entry in ignore_urls matches, then we don't want to
# scrub anything for this request...
return if ($c->_req_path_exempt_from_scrubbing($conf));
# If there's body_data - for e.g. a POSTed JSON body that was decoded -
# then we need to walk through it, scrubbing as appropriate; don't call
# body_data unless the content type is one there's a data handler for
# though, otherwise we'll trigger an exception (see GH#4)
if (exists $c->req->data_handlers->{ $c->req->content_type }) {
if (my $body_data = $c->request->body_data) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/live_expiry_threshold.t view on Meta::CPAN
my $ua = MiniUA->new('SessionExpiry');
my $res = $ua->get( "http://localhost/session_data_expires" );
ok($res->is_success, "session_data_expires");
my $expiry = $res->decoded_content + 0;
$res = $ua->get( "http://localhost/session_expires" );
ok($res->is_success, "session_expires");
is($res->decoded_content, $expiry, "session_expires == session_data_expires");
sleep(1);
$res = $ua->get( "http://localhost/session_data_expires" );
ok($res->is_success, "session_data_expires");
is($res->decoded_content, $expiry, "expiration not updated");
$res = $ua->get( "http://localhost/session_expires" );
ok($res->is_success, "session_expires");
is($res->decoded_content, $expiry, "session_expires == session_data_expires");
#
$res = $ua->get( "http://localhost/update_session" );
ok($res->is_success, "update_session");
$res = $ua->get( "http://localhost/session_data_expires" );
ok($res->is_success, "session_data_expires");
my $updated = $res->decoded_content + 0;
ok($updated > $expiry, "expiration updated");
$expiry = $updated;
$res = $ua->get( "http://localhost/session_data_expires" );
ok($res->is_success, "session_data_expires");
is($res->decoded_content, $expiry, "expiration not updated");
$res = $ua->get( "http://localhost/session_expires" );
ok($res->is_success, "session_expires");
is($res->decoded_content, $expiry, "session_expires == session_data_expires");
sleep(10);
$res = $ua->get( "http://localhost/session_data_expires" );
ok($res->is_success, "session_data_expires");
$updated = $res->decoded_content + 0;
ok($updated > $expiry, "expiration updated");
$res = $ua->get( "http://localhost/session_expires" );
ok($res->is_success, "session_expires");
is($res->decoded_content, $updated, "session_expires == session_data_expires");
done_testing;
view all matches for this distribution