view release on metacpan or search on metacpan
XMMSClientResult.xs view on Meta::CPAN
=over 4
=item Arguments: $string
=item Return Value: $decoded_url
=back
my $decoded_url = $result->decode_url($url);
my $decoded_url = Audio::XMMSClient::Result->decode_url($url);
Decode an URL-encoded C<$string>.
Some strings (currently only the url of media) has no known encoding, and must
be encoded in an UTF-8 clean way. This is done similar to the url encoding web
browsers do. This functions decodes a string encoded in that way. OBSERVE that
the decoded string HAS NO KNOWN ENCODING and you cannot display it on screen in
a 100% guaranteed correct way (a good heuristic is to try to validate the
decoded string as UTF-8, and if it validates assume that it is an UTF-8 encoded
string, and otherwise fall back to some other encoding).
Do not use this function if you don't understand the implications. The best
thing is not to try to display the url at all.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Audio/aKodePlayer.pm view on Meta::CPAN
Closes the player and releases the output sink.
=item load(filename)
Loads the file from a given filename and prepares it for
playing. Returns false if the file cannot be loaded or decoded.
=item setDecoderPlugin(plugin_name)
Sets the decoder plugin to use. Default is auto-detect.
view all matches for this distribution
view release on metacpan or search on metacpan
Aut/Ticket.pm view on Meta::CPAN
=head3 C<decrypt(ciphertext) --E<gt> string>
=over 1
Decrypts text using L<Aut::Crypt>, after it has been decoded
with L<Aut::Base64>. If the decryption is valid, it returns
the decrypted string, otherwise C<undef> is returned.
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Auth/Yubikey_Decrypter.pm view on Meta::CPAN
my $token_bin = &yubikey_modhex_decode($token);
# Decrypt the token using it's key
my $cipher = Crypt::Rijndael->new( $aeskey_bin );
my $token_decoded_bin = $cipher->decrypt($token_bin);
my $token_decoded_hex = unpack "H*", $token_decoded_bin;
# get all the values from the decoded token
my $secretid_hex = substr($token_decoded_hex,0,12);
my $counter_dec = ord(substr($token_decoded_bin,7,1))*256+ord(substr($token_decoded_bin,6,1));
my $timestamp_dec = ord(substr($token_decoded_bin,10,1))*65536+ord(substr($token_decoded_bin,9,1))*256+ord(substr($token_decoded_bin,8,1));
my $session_use_dec = ord(substr($token_decoded_bin,11,1));
my $random_dec = ord(substr($token_decoded_bin,13,1))*256+ord(substr($token_decoded_bin,12,1));
my $crc_dec = ord(substr($token_decoded_bin,15,1))*256+ord(substr($token_decoded_bin,14,1));
my $crc_ok = &yubikey_crc_check($token_decoded_bin);
return ($publicID,$secretid_hex,$counter_dec,$timestamp_dec,$session_use_dec,$random_dec,$crc_dec,$crc_ok);
}
=head2 yubikey_modhex_decode
Input : the modhex code
Output : decoded modhex code in hex
=cut
sub yubikey_modhex_decode
{
my $mstring = $_[0];
my $cset="cbdefghijklnrtuv";
my $decoded="";
my $hbyte=0;
my $pos;
for (my $i=0; $i<length($mstring);$i++)
{
$pos=index($cset,substr($mstring,$i,1));
if ($i/2 != int($i/2))
{
$decoded .= chr($hbyte+$pos);
$hbyte=0;
}
else
{
$hbyte=$pos*16;
}
}
return $decoded;
}
=head2 yubikey_crc_check
Performs a crc check on the decoded data
=cut
sub yubikey_crc_check
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/CAS/External/UserAgent.pm view on Meta::CPAN
# The previous response can determine what occurred
return;
}
# Parse the forms on the page
my @forms = HTML::Form->parse($response->decoded_content, $response->base);
# Find the login form
my $login_form;
FORM: foreach my $form (@forms) {
if (defined $form->find_input('lt')
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/CAS/UserAgent.pm view on Meta::CPAN
# default heuristic for finding login parameters
my $defaultLoginParamsHeuristic = sub {
my ($service, $response, $ua, $h, @params) = @_;
# find all input controls on the submit form
my $content = $response->decoded_content;
while($content =~ /(\<input.*?\>)/igs) {
my $input = $1;
my $name = $input =~ /name=\"(.*?)\"/si ? $1 : undef;
my $value = $input =~ /value=\"(.*?)\"/si ? $1 : undef;
lib/Authen/CAS/UserAgent.pm view on Meta::CPAN
return $1;
}
}
#check for a javascript window.location.href redirect
if($response->decoded_content =~ /window\.location\.href="[^"]*ticket=([^&"]*?)"/sg) {
return $1;
}
return;
};
lib/Authen/CAS/UserAgent.pm view on Meta::CPAN
'targetService' => $service,
);
# fetch proxy ticket and parse response xml
my $response = $ua->simple_request(HTTP::Request::Common::GET($ptUri));
my $doc = eval {XML::LibXML->new()->parse_string($response->decoded_content('charset' => 'none'))};
if($@ || !$doc) {
$h->{'error'} = ERROR_PROXY_INVALIDRESPONSE;
push @{$h->{'errors'}}, $h->{'error'};
return;
}
lib/Authen/CAS/UserAgent.pm view on Meta::CPAN
#retrieve a ticket for the requested service
my $ticketResponse = $ua->simple_request(HTTP::Request::Common::POST($tgtUri, [
'service' => $service,
]));
return if($ticketResponse->code != 200);
return $ticketResponse->decoded_content;
};
##Static Methods
#return the default user agent for this class
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/Passphrase/Argon2.pm view on Meta::CPAN
params
# Only one of these must be defined for the salt value. An error will be thrown if none or more than one is defined.
salt - plain text salt value
salt_hex - salt in hex value that gets decoded.
salt_base64 - salt value encoded in base64 that gets decoded.
salt_random - a random salt will be generated using Data::GUID.
# Only one of these must be defined for the crypt value. An error will be thrown if none or more than one is defined.
passphrase - plain text passpord that will be converted to argon2
hash - plain text argon2 value
view all matches for this distribution
view release on metacpan or search on metacpan
sub _decode_value {
my ( $self, $vendor, $id, $type, $name, $value, $has_tag ) = @_;
if ( defined $type ) {
if ( exists $decoder{$type} ) {
my ($decoded, $tag) = $decoder{$type}->( $self, $vendor, $id, $name, $value, $has_tag );
return wantarray ? ($decoded, $tag) : $decoded;
}
else {
if ($debug) {
print {*STDERR} "Unsupported type '$type' for attribute with id: '$id'.\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/SASL/Perl/NTLM.pm view on Meta::CPAN
#
sub client_step {
my ( $self, $challenge ) = @_;
if ( defined $challenge ) {
# The challenge has been decoded but Authen::NTLM expects it encoded
$challenge = MIME::Base64::encode_base64($challenge);
# Empty challenge string needs to be undef if we want
# Authen::NTLM::challenge() to generate a type 1 message
$challenge = undef if $challenge eq q{};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/Simple/WebForm.pm view on Meta::CPAN
if ($self->trace)
{
print STDERR ("-"x80)."\n";
print STDERR "TRACE: initial response, response code [".$res->code."]\n";
print STDERR "TRACE: initial response, cookies [".$ua->cookie_jar->as_string()."]\n";
print STDERR $res->decoded_content;
print STDERR "\n\n\n";
print STDERR ("-"x80)."\n";
}
# make sure status code is ok?
if ($self->check_initial_status_code)
lib/Authen/Simple/WebForm.pm view on Meta::CPAN
{
my $expect = $self->initial_expect;
unless (ref($expect) eq 'Regexp') {
$expect = qr/\Q$expect\E/;
}
unless ($res->decoded_content =~ /$expect/)
{
$self->log->error("Initial url didn't return expected results.") if $self->log;
return 0;
}
}
lib/Authen/Simple/WebForm.pm view on Meta::CPAN
if ($self->trace)
{
print STDERR ("-"x80)."\n";
print STDERR "TRACE: initial response, response code [".$res->code."]\n";
print STDERR "TRACE: initial response, cookies [".$ua->cookie_jar->as_string()."]\n";
print STDERR $res->decoded_content;
print STDERR "\n\n\n";
print STDERR ("-"x80)."\n";
}
# make sure status code is ok?
lib/Authen/Simple/WebForm.pm view on Meta::CPAN
{
my $expect = $self->login_expect;
unless (ref($expect) eq 'Regexp') {
$expect = qr/\Q$expect\E/;
}
unless ($res->decoded_content =~ /$expect/)
{
$self->log->debug("Failed to authenticate user '$full_username'. Reason: Login page response did not match expected value.")
if $self->log;
return 0;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/Ticket/Client.pm view on Meta::CPAN
=over 4
=item decode_cookie($class, $ticket)
This subroutine returns the decoded version of the ticket. This is the
place to put decryption of the cookie or other checks that do not
depend on understanding the information within the ticket. The default
version decodes from base 64. The return value is the decoded
string representation of the ticket.
=item deconstruct_cookie($class, $ticket)
This subroutine breaks the ticket apart into field values. The return
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Authen/WebAuthn.pm view on Meta::CPAN
};
}
sub getAttestationObject {
my ($dat) = @_;
my $decoded = decode_base64url($dat);
my $res = {};
my $h = decode_cbor($decoded);
$res->{authData} = getAuthData( $h->{authData} );
$res->{authDataRaw} = $h->{authData};
$res->{attStmt} = $h->{attStmt};
$res->{fmt} = $h->{fmt};
return $res;
view all matches for this distribution
view release on metacpan or search on metacpan
t/03_bin_decode.t view on Meta::CPAN
my $dec = Avro::BinaryDecoder->decode(
writer_schema => $w_enum,
reader_schema => $r_enum,
reader => $reader,
);
is $dec, $data, "decoded!";
}
for my $data (qw/a z/) {
Avro::BinaryEncoder->encode(
schema => $w_enum,
t/03_bin_decode.t view on Meta::CPAN
writer_schema => $w_schema,
reader_schema => $r_schema,
reader => $reader,
);
is_deeply $dec, $data, "decoded!";
}
## map resolution
{
my $w_schema = Avro::Schema->parse(<<EOP);
t/03_bin_decode.t view on Meta::CPAN
my $dec = Avro::BinaryDecoder->decode(
writer_schema => $w_schema,
reader_schema => $w_schema,
reader => $reader,
);
is_deeply $dec, $data, "decoded succeeded!";
}
## schema upgrade
{
my $w_schema = Avro::Schema->parse(<<EOP);
t/03_bin_decode.t view on Meta::CPAN
my $dec = Avro::BinaryDecoder->decode(
writer_schema => $w_schema,
reader_schema => $w_schema,
reader => $reader,
);
is_deeply $dec, $data, "decoded succeeded! +upgrade";
is $dec->{one}[0], 1.0, "kind of dumb test";
}
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
WebUtils.pm view on Meta::CPAN
Returns the name of the authenticated user.
=head2 C<<web:password/>>
If the current request is protected by Basic authentication, this tag
will return the decoded password sent by the client.
=head2 C<<web:request_parsed_uri>>
This tag allows you to get the fully parsed URI for the current request.
In contrast to <web:request_uri/> the parsed URI will always include things like
view all matches for this distribution
view release on metacpan or search on metacpan
demo/webmail/xmlmail-display.xsl view on Meta::CPAN
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="htmlpart[@pre='1']">
<!-- <div class="marker">HTML Part (decoded to text):</div> -->
<pre>
<xsl:apply-templates/>
</pre>
</xsl:template>
<xsl:template match="htmlpart">
<!-- <div class="marker">HTML Part (decoded to text):</div> -->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="textpart">
<!-- <div class="marker">Plain Text Part:</div> -->
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BBCode/Util.pm view on Meta::CPAN
} elsif(/^ (\d+) $/x) {
$ch = 0+$1;
}
return sprintf "#x%X", $ch if defined $ch;
my $decoded = HTML::Entities::decode("&$_;");
return undef if $decoded eq "&$_;";
return $_;
}
BEGIN { _export qw(parseListType parse) }
my %listtype = (
view all matches for this distribution
view release on metacpan or search on metacpan
(birthday "6/15")
)
nil The cache vector - always nil
]
After this is decoded it will be returned as a reference to a BBDB
object. The internal structure of the BBDB object mimics the lisp
structure of the BBDB string. It consists of a reference to an array
with 9 elements The Data::Dumper output of the above BBDB string would
just replaces all of the ()s with []s. It can be accessed by using
the C<$bbdb->part('all')> method. For completeness, here is the output
In version 2.32 of BBDB, despite what the documentation says, it seems
that zip codes are always stored quoted strings, even though it seems
to be impossible to enter anything other than an integer.
Phone numbers may be converted from strings to integers if they are
decoded and encoded. This should not affect the operation of BBDB.
Also a null last name is converted from "" to nil, which also doesn't
hurt anything.
You might ask why I use arrays instead of hashes to encode the data in
the BBDB file. The answer is that order matters in the bbdb file, and
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BBS/DiscuzX2.pm view on Meta::CPAN
$self->{site} = $opt{site};
$res = $self->{browser}->get($opt{site}.'forum.php');
return unless($res->is_success);
($self->{formhash}) = $res->decoded_content =~ m/formhash=(\w+)">/s;
return 1;
}
sub post_thread {
my ($self, $data) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BBS/Perm/Plugin/Feed.pm view on Meta::CPAN
=item text
Get the contents of user's input, it's either a command's output or a file's
contents.
Caveat: command output and file contents are decoded by your system LANG or
LC_ALL setting. So, you'd better update the encoding of your file in
accordance with your system settings.
=item widget
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-perl.t view on Meta::CPAN
[
131, 104, 3, 100, 0, 4, 98, 101, 114, 116, 100, 0, 4, 100, 105, 99, 116,
108, 0, 0, 0, 1, 104, 2, 109, 0, 0, 0, 2, 111, 115, 109, 0, 0, 0, 5, 108,
105, 110, 117, 120, 106
], 'hash encode');
my $decoded = decode_bert($bert);
isa_ok($decoded, 'BERT::Dict');
is_deeply($decoded, BERT::Dict->new([ os => 'linux' ]), 'hash decode');
my %decoded = @{ $decoded->value };
is_deeply(\%decoded, $perl, 'hash decode');
# ordered hash
SKIP: {
eval { require Tie::IxHash };
skip 'Tie::IxHash not install', 4 if $@;
t/02-perl.t view on Meta::CPAN
131, 104, 3, 100, 0, 4, 98, 101, 114, 116, 100, 0, 4, 100, 105, 99, 116,
108, 0, 0, 0, 2, 104, 2, 109, 0, 0, 0, 5, 102, 110, 97, 109, 101, 109, 0,
0, 0, 4, 74, 117, 97, 110, 104, 2, 109, 0, 0, 0, 5, 108, 110, 97, 109,
101, 109, 0, 0, 0, 5, 84, 97, 109, 97, 100, 106
], 'ordered hash encode');
my $decoded = decode_bert($bert);
isa_ok($decoded, 'BERT::Dict');
is_deeply($decoded, BERT::Dict->new([ fname => 'Juan', lname => 'Tamad' ]), 'ordered hash decode');
my %decoded = @{ $decoded->value };
is_deeply(\%decoded, $perl, 'ordered hash decode');
}
view all matches for this distribution
view release on metacpan or search on metacpan
Returns an (unsorted) array of pids of all the running processes
on the system. Note: fleet-footed processes may have disappeared
between the time the snapshot is taken and the time the code
subsequently gets around to asking for more information about
them. On the other hand, getting this list is very fast. If you
want the set of current processes on the system decoded as
C<BSD::Process> objects, you should be looking at the C<all>
meta-constructor.
The routine C<list> is not exportable. It may be exported under
the name C<process_info>.
Amount of real time used by the children processes (if any) of the
process. B<F5+>
=item process_flags, flag
A bitmap of process flags (decoded in the following methods as 0
or 1).
=item posix_advisory_lock, advlock
Flag indicating whether the process holds a POSIX advisory lock. B<F5+>
Flag indicating that the process is a session leader. B<F5+>
=item process_status, stat
Numeric value indicating the status of the process, decoded via the
following attibutes. B<F5+>
=item is_being_forked, stat_1
Status indicates that the process is being forked. B<F5+>
view all matches for this distribution
view release on metacpan or search on metacpan
variable represents a heterogeneous collection of values (for
instance, C<kern.clockrate>, C<vm.vmtotal>). In these cases, the
hash key names are reasonably self-explanatory, however, passing
familiarity with kernel data structures is expected.
A certain number of opaque variables are fully decoded (and the
results are returned as hashes), whereas the C<sysctl> binary renders
them as a raw hexdump (for example, C<net.inet.tcp.stats>).
=item sysctl_set
=item iterator
Creates an iterator that may be used to walk through the sysctl
variable tree. If no parameter is given, the iterator defaults
to the first entry of the tree. Otherwise, if a paramter is
given, it is decoded as a sysctl variable. If the decoding
fails, undef is returned.
my $k = BSD::Sysctl->iterator( 'kern' );
while ($k->next) {
print $k->name, '=', $k->value, "\n";
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/TestUtils.pm view on Meta::CPAN
->allow_bignum
->allow_blessed
->convert_blessed;
sub normalize_json {
my $decoded = $json_codec->decode(shift);
return $json_codec->encode($decoded);
}
sub to_extjson {
my $data = BSON->perl_to_extjson($_[0], { relaxed => $_[1] });
return $json_codec->encode($data);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BSON.pm view on Meta::CPAN
#pod =attr wrap_dbrefs
#pod
#pod If set to true, during decoding, documents with the fields C<'$id'> and
#pod C<'$ref'> (literal dollar signs, not variables) will be wrapped as
#pod L<BSON::DBRef> objects. If false, they are decoded into ordinary hash
#pod references (or ordered hashes, if C<ordered> is true).
#pod
#pod The default is true.
#pod
#pod =cut
lib/BSON.pm view on Meta::CPAN
#pod
#pod $doc = $codec->decode_one( $byte_string );
#pod $doc = $codec->decode_one( $byte_string, \%options );
#pod
#pod Takes a byte string with a BSON-encoded document and returns a
#pod hash reference representing the decoded document.
#pod
#pod An optional hash reference of options may be provided. Valid options include:
#pod
#pod =for :list
#pod * dt_type â overrides codec default
lib/BSON.pm view on Meta::CPAN
=head2 wrap_dbrefs
If set to true, during decoding, documents with the fields C<'$id'> and
C<'$ref'> (literal dollar signs, not variables) will be wrapped as
L<BSON::DBRef> objects. If false, they are decoded into ordinary hash
references (or ordered hashes, if C<ordered> is true).
The default is true.
=head2 wrap_numbers
lib/BSON.pm view on Meta::CPAN
$doc = $codec->decode_one( $byte_string );
$doc = $codec->decode_one( $byte_string, \%options );
Takes a byte string with a BSON-encoded document and returns a
hash reference representing the decoded document.
An optional hash reference of options may be provided. Valid options include:
=over 4
view all matches for this distribution
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