view release on metacpan or search on metacpan
t/app/Plack/Request.t view on Meta::CPAN
Returns the protocol (HTTP/1.0 or HTTP/1.1) used for the current request.
=item request_uri
Returns the raw, undecoded request URI path. You probably do B<NOT>
want to use this to dispatch requests.
=item path_info
Returns B<PATH_INFO> in the environment. Use this to get the local
t/app/Plack/Request.t view on Meta::CPAN
$req->logger->({ level => 'debug', message => "This is a debug message" });
=item cookies
Returns a reference to a hash containing the cookies. Values are
strings that are sent by clients and are URI decoded.
If there are multiple cookies with the same name in the request, this
method will ignore the duplicates and return only the first value. If
that causes issues for you, you may have to use modules like
CGI::Simple::Cookie to parse C<$request->header('Cookies')> by
t/app/Plack/Request.t view on Meta::CPAN
Returns a L<Hash::MultiValue> hash reference containing (merged) GET
and POST parameters.
=item content, raw_body
Returns the request content in an undecoded byte string for POST requests.
=item uri
Returns an URI object for the current request. The URI is constructed
using various environment values such as C<SCRIPT_NAME>, C<PATH_INFO>,
view all matches for this distribution
view release on metacpan or search on metacpan
7zip/C/LzmaDec.c view on Meta::CPAN
StopCompilingDueBUG
#endif
#define LZMA_DIC_MIN (1 << 12)
/* First LZMA-symbol is always decoded.
And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization
Out:
Result:
SZ_OK - OK
SZ_ERROR_DATA - Error
view all matches for this distribution
view release on metacpan or search on metacpan
op=cpy; /* correction */
}
/* end of decoding */
if (endOnInput)
return (int) (((char*)op)-dest); /* Nb of output bytes decoded */
else
return (int) (((const char*)ip)-source); /* Nb of input bytes read */
/* Overflow error detected */
_output_error:
}
/*!
* LZ4_setStreamDecode() :
* Use this function to instruct where to find the dictionary.
* This function is not necessary if previous data is still available where it was decoded.
* Loading a size of 0 is allowed (same effect as no dictionary).
* Return : 1 if OK, 0 if error
*/
int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize)
{
}
/*
*_continue() :
These decoding functions allow decompression of multiple blocks in "streaming" mode.
Previously decoded blocks must still be available at the memory position where they were decoded.
If it's not possible, save the relevant part of decoded data into a safe buffer,
and indicate where it stands using LZ4_setStreamDecode()
*/
int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize)
{
LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
view all matches for this distribution
view release on metacpan or search on metacpan
op = cpy; /* correction */
}
/* end of decoding */
if (endOnInput)
return (int) (((char*)op)-dst); /* Nb of output bytes decoded */
else
return (int) (((const char*)ip)-src); /* Nb of input bytes read */
/* Overflow error detected */
_output_error:
}
/*!
* LZ4_setStreamDecode() :
* Use this function to instruct where to find the dictionary.
* This function is not necessary if previous data is still available where it was decoded.
* Loading a size of 0 is allowed (same effect as no dictionary).
* Return : 1 if OK, 0 if error
*/
int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize)
{
}
/*
*_continue() :
These decoding functions allow decompression of multiple blocks in "streaming" mode.
Previously decoded blocks must still be available at the memory position where they were decoded.
If it's not possible, save the relevant part of decoded data into a safe buffer,
and indicate where it stands using LZ4_setStreamDecode()
*/
LZ4_FORCE_O2_GCC_PPC64LE
int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize)
{
view all matches for this distribution
view release on metacpan or search on metacpan
my $encoder=Compress::PPMd::Encoder->new();
my $encoded=$encoder->encode($text);
my $encoded2=$encoder->encode($text2);
my $decoder=Compress::PPMd::Decoder->new();
my $decoded=$encoder->decode($encoded);
my $decoded2=$encoder->decode($encoded2);
=head1 ABSTRACT
This package is a Perl wrapper around Dmitry Shkarin PPMd compression
view all matches for this distribution
view release on metacpan or search on metacpan
zlib-src/zlib.h view on Meta::CPAN
flush options, and so can be used to determine the amount of currently
consumed input in bits.
The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
end of each deflate block header is reached, before any actual data in that
block is decoded. This allows the caller to determine the length of the
deflate block header for later use in random access within a deflate block.
256 is added to the value of strm->data_type when inflate() returns
immediately after reaching the end of the deflate block header.
inflate() should normally be called until it returns Z_STREAM_END or an
zlib-src/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
CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see
below), inflate() will *not* automatically decode concatenated gzip members.
inflate() will return Z_STREAM_END at the end of the gzip member. The state
would need to be reset to continue decoding a subsequent gzip member. This
*must* be done if there is more data after a gzip member, in order for the
zlib-src/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 or Z_TREES 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
src/csnappy.h view on Meta::CPAN
* REQUIRES: start points to compressed data.
* REQUIRES: n is length of available compressed data.
*
* Returns SNAPPY_E_HEADER_BAD on error.
* Returns number of bytes read from input on success.
* Stores decoded length into *result.
*/
int
csnappy_get_uncompressed_length(
const char *start,
uint32_t n,
view all matches for this distribution
view release on metacpan or search on metacpan
ext/zstd/CHANGELOG view on Meta::CPAN
lib : changed : reduced usage of stack memory
lib : fixed : several corner case bugs, by Nick Terrell
cli : new : gzstd, experimental version able to decode .gz files, by Przemyslaw Skibinski
cli : new : preserve file attributes
cli : new : added zstdless and zstdgrep tools
cli : fixed : status displays total amount decoded, even for file consisting of multiple frames (like pzstd)
cli : fixed : zstdcat
zlib_wrapper : added support for gz* functions, by Przemyslaw Skibinski
install : better compatibility with FreeBSD, by Dimitry Andric
source tree : changed : zbuff source files moved to lib/deprecated
view all matches for this distribution
view release on metacpan or search on metacpan
zopflib/src/zopflipng/lodepng/lodepng.cpp view on Meta::CPAN
decode the symbol from the tree. The "readBitFromStream" code is inlined in
the expression below because this is the biggest bottleneck while decoding
*/
ct = codetree->tree2d[(treepos << 1) + READBIT(*bp, in)];
++(*bp);
if(ct < codetree->numcodes) return ct; /*the symbol is decoded, return it*/
else treepos = ct - codetree->numcodes; /*symbol not yet decoded, instead move tree position*/
if(treepos >= codetree->numcodes) return (unsigned)(-1); /*error: it appeared outside the codetree*/
}
}
#endif /*LODEPNG_COMPILE_DECODER*/
zopflib/src/zopflipng/lodepng/lodepng.cpp view on Meta::CPAN
unsigned error = 0;
unsigned i;
unsigned length, string2_begin;
char *key = 0;
ucvector decoded;
ucvector_init(&decoded);
while(!error) /*not really a while loop, only used to break on error*/
{
for(length = 0; length < chunkLength && data[length] != 0; ++length) ;
if(length + 2 >= chunkLength) CERROR_BREAK(error, 75); /*no null termination, corrupt?*/
zopflib/src/zopflipng/lodepng/lodepng.cpp view on Meta::CPAN
string2_begin = length + 2;
if(string2_begin > chunkLength) CERROR_BREAK(error, 75); /*no null termination, corrupt?*/
length = chunkLength - string2_begin;
/*will fail if zlib error, e.g. if length is too small*/
error = zlib_decompress(&decoded.data, &decoded.size,
(unsigned char*)(&data[string2_begin]),
length, zlibsettings);
if(error) break;
ucvector_push_back(&decoded, 0);
error = lodepng_add_text(info, key, (char*)decoded.data);
break;
}
lodepng_free(key);
ucvector_cleanup(&decoded);
return error;
}
/*international text chunk (iTXt)*/
zopflib/src/zopflipng/lodepng/lodepng.cpp view on Meta::CPAN
unsigned error = 0;
unsigned i;
unsigned length, begin, compressed;
char *key = 0, *langtag = 0, *transkey = 0;
ucvector decoded;
ucvector_init(&decoded);
while(!error) /*not really a while loop, only used to break on error*/
{
/*Quick check if the chunk length isn't too small. Even without check
it'd still fail with other error checks below if it's too short. This just gives a different error code.*/
zopflib/src/zopflipng/lodepng/lodepng.cpp view on Meta::CPAN
length = chunkLength < begin ? 0 : chunkLength - begin;
if(compressed)
{
/*will fail if zlib error, e.g. if length is too small*/
error = zlib_decompress(&decoded.data, &decoded.size,
(unsigned char*)(&data[begin]),
length, zlibsettings);
if(error) break;
if(decoded.allocsize < decoded.size) decoded.allocsize = decoded.size;
ucvector_push_back(&decoded, 0);
}
else
{
if(!ucvector_resize(&decoded, length + 1)) CERROR_BREAK(error, 83 /*alloc fail*/);
decoded.data[length] = 0;
for(i = 0; i != length; ++i) decoded.data[i] = data[begin + i];
}
error = lodepng_add_itext(info, key, langtag, transkey, (char*)decoded.data);
break;
}
lodepng_free(key);
lodepng_free(langtag);
lodepng_free(transkey);
ucvector_cleanup(&decoded);
return error;
}
static unsigned readChunk_tIME(LodePNGInfo* info, const unsigned char* data, size_t chunkLength)
view all matches for this distribution
view release on metacpan or search on metacpan
ext/zstd/CHANGELOG view on Meta::CPAN
lib : changed : reduced usage of stack memory
lib : fixed : several corner case bugs, by Nick Terrell
cli : new : gzstd, experimental version able to decode .gz files, by Przemyslaw Skibinski
cli : new : preserve file attributes
cli : new : added zstdless and zstdgrep tools
cli : fixed : status displays total amount decoded, even for file consisting of multiple frames (like pzstd)
cli : fixed : zstdcat
zlib_wrapper : added support for gz* functions, by Przemyslaw Skibinski
install : better compatibility with FreeBSD, by Dimitry Andric
source tree : changed : zbuff source files moved to lib/deprecated
view all matches for this distribution
view release on metacpan or search on metacpan
examples/bzip2_decompressor.pl view on Meta::CPAN
my @zrle;
my $code = '';
my $sel_idx = 0;
my $tree = $huffman_trees[$sels->[$sel_idx]];
my $decoded = 50;
while (!eof($fh)) {
$code .= read_bit($fh, \$buffer);
if (length($code) > $MaxHuffmanBits) {
examples/bzip2_decompressor.pl view on Meta::CPAN
}
push @zrle, $sym;
$code = '';
if (--$decoded <= 0) {
if (++$sel_idx <= $#$sels) {
$tree = $huffman_trees[$sels->[$sel_idx]];
}
else {
die "No more selectors"; # should not happen
}
$decoded = 50;
}
}
}
##say STDERR "ZRLE: (@zrle)";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Conclave/OTK/Backend/4store.pm view on Meta::CPAN
unless ($response->is_success) {
print STDERR "Query failed: ", $response->status_line, "\n";
}
else {
my $tsv = $response->decoded_content;
# FIXME
my @lines = split /\n/, $tsv;
shift @lines;
foreach my $triple (@lines) {
$triple =~ s/[<>]//g;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Concurrent/Data/Serializer.pm view on Meta::CPAN
sub deserialize {
my ($self, $string) = @_;
$string =~ s/\0/\n/mg;
my $decoded = decode_base64 ($string);
return $$self{Method} eq "Dumper" ? eval $decoded : thaw( $decoded );
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Conductrics/Agent.pm view on Meta::CPAN
}
my $response = $ua->get($uri);
if ($response->is_success) {
if ($response->code != 200) {
warn "Content: ", $response->decoded_content; # or whatever
warn "Code: ", $response->code;
warn "Err:", $response->message;
warn "Something get wrong on response";
warn Dumper($response);
}
JSON::MaybeXS::decode_json($response->decoded_content);
} else {
warn "Content: ", $response->decoded_content; # or whatever
warn "Code: ", $response->code;
warn "Err:", $response->message;
die $response->status_line;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Conductrics/Client.pm view on Meta::CPAN
$request->header(Content_Type => 'application/json');
#use Data::Dumper;
#print Dumper($request);
my $response = $ua->request($request);
if ($response->is_success) {
return JSON::MaybeXS::decode_json($response->decoded_content);
} else {
warn "Content: ", $response->decoded_content; # or whatever
warn "Code: ", $response->code;
warn "Err:", $response->message;
die $response->status_line;
}
}
lib/Conductrics/Client.pm view on Meta::CPAN
}
my $request = HTTP::Request->new("DELETE", $uri);
my $response = $ua->request($request);
if ($response->is_success) {
return JSON::MaybeXS::decode_json($response->decoded_content);
} else {
warn "Content: ", $response->decoded_content; # or whatever
warn "Code: ", $response->code;
warn "Err:", $response->message;
die $response->status_line;
}
}
lib/Conductrics/Client.pm view on Meta::CPAN
unless (defined $url) {
$url = 'http://api.conductrics.com/' . $self->ownerCode . '/schema/agent';
}
my $response = $ua->get($url);
if ($response->is_success) {
return $response->decoded_content;
}
warn "Content: ", $response->decoded_content; # or whatever
warn "Code: ", $response->code;
warn "Err:", $response->message;
die $response->status_line;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/App.pm view on Meta::CPAN
);
my $res = $ua->get( $input->{include} );
if ( $res->is_success ) {
return $res->decoded_content;
}
else {
croak 'Failed to get '
. join( ' -> ', map { "\"$_\"" } @{ $input->{sources} } )
. '; '
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/IOD/Base.pm view on Meta::CPAN
}
\@argv;
}
# return ($err, $res, $decoded_val)
sub _parse_raw_value {
my ($self, $val, $needs_res) = @_;
if ($val =~ /\A!/ && $self->{enable_encoding}) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/IOD/Document.pm view on Meta::CPAN
$_merge->() if defined($merge) && $num_seen_section_lines > 1;
$cur_section = $line->[COL_S_SECTION];
$parser->{_cur_section} = $cur_section if $parser->{enable_expr}; #TMP HACK
$res->{$cur_section} //= {};
} elsif ($type eq 'K') {
# the common case is that value are not decoded or
# quoted/bracketed/braced, so we avoid calling _parse_raw_value here
# to avoid overhead
my $key = $line->[COL_K_KEY];
my $val = $line->[COL_K_VALUE_RAW];
if ($val =~ /\A["!\\[\{]/) {
my ($err, $parse_res, $decoded_val) =
$parser->_parse_raw_value($val);
die "IOD document:$linum: Invalid value: $err" if $err;
$val = $decoded_val;
} else {
$val =~ s/\s*[#;].*//; # strip comment
}
if (exists $res->{$cur_section}{$key}) {
lib/Config/IOD/Document.pm view on Meta::CPAN
=item * cond => code
Will only delete key if C<cond> returns true. C<cond> will be called with C<<
($self, %args) >> where the hash will contain these keys: C<linum> (int, line
number), C<parsed> (array, parsed line), C<key> (string, key name), C<value>
(NOT YET IMPLEMENTED), C<raw_value> (str, raw/undecoded value).
=back
=head2 $doc->delete_section([\%opts, ]$section) => $num_deleted
lib/Config/IOD/Document.pm view on Meta::CPAN
=back
=head2 $doc->dump([ \%opts ]) => hoh
Return a hoh (hash of section names and hashes, where each of the second-level
hash is of keys and values), Values will be decoded and merging will be done,
but includes are not processed (even though C<include> directive is active).
Options:
=over
lib/Config/IOD/Document.pm view on Meta::CPAN
Execute C<$code> for each key found in document, in order of occurrence.
C<$code> will be called with arguments C<< ($self, %args) >> where C<%args> will
contain these keys: C<section> (str, current section name), C<key> (str, key
name), C<value> (any, value, NOT YET IMPLEMENTED/AVAILABLE), C<raw_value> (str,
raw/undecoded value), C<linum> (int, line number, 1-based), C<parsed> (array,
parsed line).
Options:
=over
lib/Config/IOD/Document.pm view on Meta::CPAN
If found, will return an arrayref containing directive name and arguments.
Otherwise, will return undef.
=head2 $doc->get_value($section, $key) => $value
Get value. Values are decoded and section merging is respected, but includes are
not processed.
Internally, will do a C<dump()> and cache the result so subsequent
C<get_value()> will avoid re-parsing the whole document. (The cache will
automatically be discarded is one of document-modifying methods like
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/Model/models/Systemd/Common/Exec.pl view on Meta::CPAN
Interface|https://systemd.io/CONTAINER_INTERFACE> documentation for details
about the former. For the latter, pass L<DMI/SMBIOS|https://www.dmtf.org/standards/smbios> OEM string table entries
(field type
11) with a prefix of C<io.systemd.credential:> or
C<io.systemd.credential.binary:>. In both cases a key/value pair separated by
C<=> is expected. In the latter case, the right-hand side is Base64 decoded when
parsed (thus permitting binary data to be passed in). Example
L<qemu|https://www.qemu.org/docs/master/system/index.html> switch: C<-smbios
type=11,value=io.systemd.credential:xx=yy>, or C<-smbios
type=11,value=io.systemd.credential.binary:rick=TmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXA=>. Alternatively,
use the qemu C<fw_cfg> node
lib/Config/Model/models/Systemd/Common/Exec.pl view on Meta::CPAN
Interface|https://systemd.io/CONTAINER_INTERFACE> documentation for details
about the former. For the latter, pass L<DMI/SMBIOS|https://www.dmtf.org/standards/smbios> OEM string table entries
(field type
11) with a prefix of C<io.systemd.credential:> or
C<io.systemd.credential.binary:>. In both cases a key/value pair separated by
C<=> is expected. In the latter case, the right-hand side is Base64 decoded when
parsed (thus permitting binary data to be passed in). Example
L<qemu|https://www.qemu.org/docs/master/system/index.html> switch: C<-smbios
type=11,value=io.systemd.credential:xx=yy>, or C<-smbios
type=11,value=io.systemd.credential.binary:rick=TmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXA=>. Alternatively,
use the qemu C<fw_cfg> node
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/Patch.pm view on Meta::CPAN
###########################################
my($self, $string) = @_;
# Decode a hidden string
$string =~ s/^$self->{comment_char} //gm;
my $decoded = decode_base64($string);
return $decoded;
}
###########################################
sub replstring_extract {
###########################################
view all matches for this distribution
view release on metacpan or search on metacpan
Any code which imports My::Library::Config will use the same API
exported by Config::Tree to access the %volatile, @stack and %default
in My::Library::Config.
Config::Tree subclasses may wish to override _find to modify how the
variables are scanned and how the key is decoded.
A library should normally provide any default values which are
necessary and leave loading & saving to the application using it.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Connector/Proxy/HTTP.pm view on Meta::CPAN
my $response = $self->agent()->request($req);
# error handling
if (!$response->is_success) {
$self->log()->error($response->status_line);
$self->log()->error($response->decoded_content);
die "Unable to upload data to server";
}
$self->log()->debug("Set responded with: " . $response->status_line);
$self->log()->trace($response->decoded_content) if ($self->log()->is_trace());
return 1;
}
sub get_meta {
lib/Connector/Proxy/HTTP.pm view on Meta::CPAN
sub _parse_result {
my $self = shift;
my $response = shift;
my $res = $response->decoded_content;
chomp $res if ($self->chomp_result());
return $res;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Consul/Simple.pm view on Meta::CPAN
foreach my $entry (@entries) {
#The returned entry Value is always base64 encoded
$entry->{Value} = MIME::Base64::decode_base64($entry->{Value});
#the idea below is to try to JSON decode it. If that works,
#return the JSON decoded value. Otherwise, return it un-decoded
my $value;
eval {
$value = JSON::decode_json($entry->{Value});
};
$value = $entry->{Value} unless $value;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Contenticious/Content/Node/Directory.pm view on Meta::CPAN
# does a 'meta' file exist?
my $meta_fn = $self->filename . '/meta';
if (-f -r $meta_fn) {
# open file for decoded reading
open my $meta_fh, '<:encoding(UTF-8)', $meta_fn
or croak "couldn't open $meta_fn: $!";
# slurp
my $meta_fc = do { local $/; <$meta_fh> };
view all matches for this distribution
view release on metacpan or search on metacpan
This command handles the upload response to an "Interface Poll Signal"
message (0x5a) B<read> from the CM11. The module sends "ready" (0xc3) and
receives up to 10 bytes. The first two bytes are size and description of
the remaining bytes. These are used to decode the data bytes, but are not
returned by the B<receive_buffer> function. Each of the data bytes is
decoded as if it was a B<send> command from an external CM11 or equivalent
external source (such as an RF keypad).
$data = &ControlX10::CM11::receive_buffer($serial_port);
# $data eq "A2AK" after an external device turned off A2
print "House B Inputs 1,3,5,7,9 Brightened to 85%\n";
}
The conversion between text_data and percent makes more sense to the code
than to humans. The following table gives representative values. Others
may be received from a CM11 and will be properly decoded.
Percent Text Percent Text
0 M7 50 AA
5 ED 55 I6
10 EC 60 NF
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/ASCII/Armour.pm view on Meta::CPAN
NzuZ
=MxpZvjkrv5XyhkVCuXmsBQ==
-----END COMPRESSED FOO RECORD-----
my $decoded = $converter->unarmour( $message )
|| die $converter->errstr();
=head1 DESCRIPTION
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/ASN1/asn1c.pm view on Meta::CPAN
=head2 $values = decode('pduname', $pdu);
The decode function takes the name of a template (the directory where to find
those templates can be modified with set_templatedir($dir)) and a binary pdu.
It will match the variables in the template against the decoded binary pdu and
return a reference to a hash which contains these values.
For each variable $myvalue the hash will contain four keys:
=head3 $values->{'myvalue'}
The decoded value if we could "guess" myvalues type because it was
specified as i.e. INTEGER or BIT STRING in the asn1 pdu.
=head3 $values->{'myvalue_orig'}
The original value as it was found in the unber -p output. Note that these
lib/Convert/ASN1/asn1c.pm view on Meta::CPAN
# we will parse the packet description
# to find out which "nodes" in the tag tree are interesting for us
# and we will construct a list of those interesting nodes (and how to "reach" them,
# i.e. which parent nodes they are located under. In the second step we will
# iterate over the decoded ASN data, if we are in an inetersting leaf we will decode it's value.
foreach (@lines) {
if (m/<C .*?T=\"(.*?)\"/) { push @stack, $1; }
if (m/<\/C /) { pop @stack; }
if (m/<P .*?T=\"(.*?)\"/) { push @stack, $1; }
lib/Convert/ASN1/asn1c.pm view on Meta::CPAN
# we will parse the packet description
# to find out which "nodes" in the tag tree are interesting for us
# and we will construct a list of those interesting nodes (and how to "reach" them,
# i.e. which parent nodes they are located under. In the second step we will
# iterate over the decoded ASN data, if we are in an inetersting leaf we will decode it's value.
foreach (@lines) {
if (m/<C .*?T=\"(.*?)\"/) { push @stack, $1; }
if (m/<\/C /) { pop @stack; }
if (m/<P .*?T=\"(.*?)\"/) { push @stack, $1; }
view all matches for this distribution
view release on metacpan or search on metacpan
examples/tsa3161 view on Meta::CPAN
open TSAKEY, "<$filename" or &dieif(1,"cannot open TSAKeyFile '$filename'");
binmode TSAKEY;
my $tsa_key_pem;
read TSAKEY, $tsa_key_pem, $size;
close TSAKEY;
$tsa_key = Crypt::OpenSSL::RSA->new_private_key($tsa_key_pem) or &dieif(1,"TSAKeyFile '$filename' cannot be decoded");
}
# some magic
my $time = Time::HiRes::gettimeofday() ;
my $now = int($time);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/Ascii85.pm view on Meta::CPAN
=head1 SYNOPSIS
use Convert::Ascii85;
my $encoded = Convert::Ascii85::encode($data);
my $decoded = Convert::Ascii85::decode($encoded);
use Convert::Ascii85 qw(ascii85_encode ascii85_decode);
my $encoded = ascii85_encode($data);
my $decoded = ascii85_decode($encoded);
=head1 DESCRIPTION
This module implements the I<Ascii85> (also known as I<Base85>) algorithm for
encoding binary data as text. This is done by interpreting each group of four
view all matches for this distribution
view release on metacpan or search on metacpan
An I<opList> is a list of I<operator>-I<value> pairs. An operator can
be any of those defined below, or any defined by sub-classing
C<Convert::BER>, which will probably be derived from the primitives
given here.
The I<value>s depend on whether BER is being encoded or decoded:
=over 4
=item Encoding
BOOLEAN => 1,
) or die;
=item Decoding
The decoded I<value>s will be either 1 or 0.
# Decode a boolean value into $bval
$ber->decode(
BOOLEAN => \$bval,
) or die;
INTEGER => -123456,
) or die;
=item Decoding
The I<value> will be the decoded integer value.
$ber->decode(
INTEGER => \$ival,
) or die;
BIT_STRING8 => pack('B8', '10110101'),
) or die;
=item Decoding
The I<value> will be the decoded packed bits.
$ber->decode(
BIT_STRING8 => \$bval,
) or die;
REAL => 3.14159265358979,
) or die;
=item Decoding
The I<value> will be the decoded floating-point value.
$ber->decode(
REAL => \$rval,
);
values in different types, like a C structure.
=head2 SEQUENCE
A SEQUENCE is a complex type that contains other types, a bit like a C
structure. Elements inside a SEQUENCE are encoded and decoded in the
order given.
=over 4
=item Encoding
=item Decoding
I<value> should be a reference to a scalar, which will contain a
C<Convert::BER> object. This object will contain the remainder of the
current sequence or set being decoded.
# After this, ber2 will contain the encoded INTEGER B<and> STRING.
# sval will be ignored and left undefined, but bval will be decoded. The
# decode of ber2 will return the integer and string values.
$ber->decode(
SEQUENCE => [
BER => \$ber2,
STRING => \$sval,
=back
=head2 ANY
This is like the C<BER> operator except that when decoding only the
next item is decoded and placed into the C<Convert::BER> object
returned. There is no difference when encoding.
=over 4
=item Decoding
I<value> should be a reference to a scalar, which will contain a
C<Convert::BER> object. This object will only contain the next single
item in the current sequence being decoded.
# After this, ber2 will decode further, and ival and sval
# will be decoded.
$ber->decode(
INTEGER = \$ival,
ANY => \$ber2,
STRING => \$sval,
);
]
);
=item Decoding
The contents of I<value> are decoded if possible, if not then decode
continues at the next I<operator>-I<value> pair.
$ber->decode(
SEQUENCE => [
INTEGER => \$ival1,
=back
=head2 CHOICE
The I<opList> is a list of alternate I<operator>-I<value> pairs. Only
one will be encoded, and only one will be decoded.
=over 4
=item Encoding
) or die;
=item Decoding
A reference to a scalar at the start of the I<opList> is used to store
which alternative is decoded (0 for the first one, 1 for the second
one, etc.) Pass undef instead of the ref if you don't care about this,
or you store all the alternate values in different variables.
# Decode the above.
# Afterwards, $alt will be set to 2, $str will be set to 'BMP/Unicode'.
=head2 DEFINING NEW PACKING OPERATORS
As well as defining new operators which inherit from existing
operators it is also possible to define a new operator and how data is
encoded and decoded. The interface for doing this is still changing
but will be documented here when it is done. To be continued ...
=head1 LIMITATIONS
Convert::BER cannot support tags that contain more bits than can be
view all matches for this distribution