view release on metacpan or search on metacpan
lib/Encode/Safename.pm view on Meta::CPAN
use Encode qw(decode encode);
use Encode::Safename;
$encoded = encode('safename', 'Foo Bar Baz.txt');
# $encoded is now '{f}oo_{b}ar_{b}az.txt'
$decoded = decode('safename', $encoded);
# $decoded is now 'Foo Bar Baz.txt'
=head1 DESCRIPTION
A filename is encoded as follows:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Decode/ARGV.pm view on Meta::CPAN
=head1 DESCRIPTION
This module provides simple in-place decoding of command-line arguments in the global array
L<@ARGV|perlvar/"@ARGV">. As with most input and output, command-line arguments are provided to the
script in bytes, and must be decoded to characters before performing string operations like
C<length> or regex matches.
The C<-CA> switch for Perl performs a similar function, but this has some deficiencies. It assumes
via the C<:utf8> internal layer that the arguments are valid UTF-8 bytes, ignoring invalid Unicode,
and even resulting in malformed strings if the bytes do not happen to be well-formed UTF-8. This
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-decode.t view on Meta::CPAN
is $wechsler->decode( 'xq4_27deee6' ),
".**....
**.****
.******
..****.
", 'xq4_27deee6 decoded correctly';
is $wechsler->decode( 'xs31_0ca178b96z69d1d96' ),
"...**.**.
..*.*.*.*
.*..*...*
t/01-decode.t view on Meta::CPAN
.........
.*****...
*.....*..
*.*.*.*..
.**.**...
", 'xs31_0ca178b96z69d1d96 decoded correctly';
is $wechsler->decode( 'xp30_w33z8kqrqk8zzzx33' ),
"..**...
..**...
.......
t/01-decode.t view on Meta::CPAN
.......
.......
...**..
...**..
.......
", 'xp30_w33z8kqrqk8zzzx33 decoded correctly';
is $wechsler->decode( 'xp2_31a08zy0123cko' ),
"**........
*.*.......
..........
t/01-decode.t view on Meta::CPAN
....*.*...
.....**...
.......**.
.......*.*
........**
", 'xp2_31a08zy0123cko decoded correctly';
#is $wechsler->decode( 'xp30_ccx8k2s3yagzy3103yaheha4xcczyk1' ),
#"
#", 'xp30_ccx8k2s3yagzy3103yaheha4xcczyk1 decoded correctly';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Encode/ZapCP1252.pm view on Meta::CPAN
fix_cp1252; # Modify $_ in-place.
my $zapped = zap_cp1252; # Copy $_ and return zapped
my $fixed = zap_cp1252; # Copy $_ and return fixed
In Perl 5.8.8 and higher, the conversion will work even when the string is
decoded to Perl's internal form (usually via C<decode 'ISO-8859-1', $text>) or
the string is encoded (and thus simply processed by Perl as a series of
bytes). The conversion will even work on a string that has not been decoded
but has had its C<utf8> flag flipped anyway (usually by an injudicious use of
C<Encode::_utf8_on()>. This is to enable the highest possible likelihood of
removing those CP1252 gremlins no matter what kind of processing has already
been executed on the string.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Encoding/BER.pm view on Meta::CPAN
Unlike many other BER encoder/decoders, this module uses tree structured data
as the interface to/from the encoder/decoder.
The decoder does not require any form of template or description of the
data to be decoded. Given arbitrary BER encoded data, the decoder produces
a tree shaped perl data structure from it.
The encoder takes a perl data structure and produces a BER encoding from it.
=head1 METHODS
lib/Encoding/BER.pm view on Meta::CPAN
# example: warn for warnings
warn => sub{ warn "how odd! $_[1]\n" }
=item decoded_callback
coderef called for every element decoded. will be called with 2 parameters,
the Encoding::BER object, and the decoded data. [see DECODED DATA]
# example: bless decoded results into a useful class
decoded_callback => sub{ bless $_[1], MyBER::Result }
=item debug
boolean. if true, large amounts of useless gibberish will be sent to stderr regarding
the encoding or decoding process.
lib/Encoding/BER.pm view on Meta::CPAN
$result->{type} = $typdat;
$result->{tagnum} = $tagnum;
$result->{identval} = $typval;
if( my $c = $me->{decoded_callback} ){
$result = $c->( $me, $result ) || $result; # make sure the brain hasn't fallen out
}
return( $result, $tlen );
}
view all matches for this distribution
view release on metacpan or search on metacpan
%% @doc Yet another JSON (RFC 4627) library for Erlang. mochijson2 works
%% with binaries as strings, arrays as lists (without an {array, _})
%% wrapper and it only knows how to decode UTF-8 (and ASCII).
%%
%% JSON terms are decoded as follows (javascript -> erlang):
%% <ul>
%% <li>{"key": "value"} ->
%% {struct, [{<<"key">>, <<"value">>}]}</li>
%% <li>["array", 123, 12.34, true, false, null] ->
%% [<<"array">>, 123, 12.34, true, false, null]
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Etcd3/Role/Actions.pm view on Meta::CPAN
return $self;
}
=head2 get_value
returns single decoded value or the first.
=cut
sub get_value {
my ($self) = @_;
lib/Etcd3/Role/Actions.pm view on Meta::CPAN
'value' => 'bar',
'create_revision' => '3',
'key' => 'foo0'
}
where key and value have been decoded for your pleasure.
=cut
sub all {
my ($self) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ethereum/RPC/Contract.pm view on Meta::CPAN
has max_priority_fee_per_gas => (is => 'rw');
has gas => (is => 'rw');
has contract_decoded => (
is => 'rw',
default => sub { {} },
);
=head2 BUILD
lib/Ethereum/RPC/Contract.pm view on Meta::CPAN
=cut
sub BUILD {
my ($self) = @_;
my @decoded_json = @{decode_json($self->contract_abi // "[]")};
for my $json_input (@decoded_json) {
if ($json_input->{type} =~ /^function|event|constructor$/) {
push(@{$self->contract_decoded->{$json_input->{name} // $json_input->{type}}}, $json_input->{inputs});
}
}
unless ($self->contract_decoded->{constructor}) {
push(@{$self->contract_decoded->{constructor}}, []);
}
return;
}
lib/Ethereum/RPC/Contract.pm view on Meta::CPAN
=cut
sub get_function_id {
my ($self, $function_name, $params_size) = @_;
my @inputs = @{$self->contract_decoded->{$function_name}};
my $selected_data = first { (not $_ and not $params_size) or ($params_size and scalar @{$_} == $params_size) } @inputs;
$function_name .= sprintf("(%s)", join(",", map { $_->{type} } grep { $_->{type} } @$selected_data));
lib/Ethereum/RPC/Contract.pm view on Meta::CPAN
=cut
sub encode {
my ($self, $function_name, $params) = @_;
my $inputs = $self->contract_decoded->{$function_name}->[0];
# no inputs
return "" unless $inputs;
my $offset = $self->get_function_offset($inputs);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Eve/Json.pm view on Meta::CPAN
use Eve::Json;
my $json = Eve::Json->new();
my $json_string = $json->encode(reference => $reference);
my $decoded_reference = $json->decode(string => $json_string);
=head1 DESCRIPTION
The B<Eve::Json> class adapts the functionality of the JSON::XS
module to provide JSON encoding and decoding features service.
lib/Eve/Json.pm view on Meta::CPAN
return $result;
}
=head2 B<decode()>
Decodes a JSON string and returns a reference to its decoded contents.
=head3 Arguments
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EveOnline/Api.pm view on Meta::CPAN
die "Error: " . $res->status_line . "\n";
}
my $text = $res->decoded_content;
return $text;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Event/RPC/Message/Negotiate.pm view on Meta::CPAN
sub get_storable_fallback_ok { $STORABLE_FALLBACK_OK }
sub set_storable_fallback_ok { $STORABLE_FALLBACK_OK = $_[1] }
sub encode_message {
my $self = shift;
my ($decoded) = @_;
my $ok = $decoded->{ok} || "";
my $msg = $decoded->{msg} || "";
my $cmd = $decoded->{cmd} || "";
s,/\d/,,g for ( $ok, $msg, $cmd );
return "/0/E:R:M:N/1/$ok/2/$msg/3/$cmd/0/";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Evented/API/Engine.pm view on Meta::CPAN
$api->Log($mod_name, "Load FAILED: JSON parsing of $path failed: $@");
$api->Debug($mod_name, "JSON text: $slurp");
return;
}
# JSON was decoded successfully at this point.
# developer mode is disabled, so return the manifest.
elsif (!$api->{developer}) {
$use_manifest++;
}
# JSON was decoded successfully, but we're in developer mode.
# check the modification times. only use the manifest if the module's
# main package has not been modified since the manifest was written.
else {
my $pkg_modified = (stat "$mod_dir/$mod_last_name.pm" )[9];
my $man_modified = (stat "$mod_dir/$mod_last_name.json")[9];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Excel/PowerPivot/Utils.pm view on Meta::CPAN
If none is supplied, a simple logger is automatically created from L<Log::Dispatch>.
=item UTF8
A boolean flag for setting the L<Win32::OLE> codepoint option to UTF8, so that
strings are properly encoded/decoded between Perl and the OLE server.
It is highly recommended to I<systematically set this option to true>, since
this module is mostly used together with L<YAML>, which uses UTF8 encoding.
This option will automatically trigger C<< Win32::OLE->Option(CP => CP_UTF8) >>
at object construction time, and will set it back to the previous value at object
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Excel/Writer/XLSX/Worksheet.pm view on Meta::CPAN
###############################################################################
#
# _get_range_data
#
# Returns a range of data from the worksheet _table to be used in chart
# cached data. Strings are returned as SST ids and decoded in the workbook.
# Return undefs for data that doesn't exist since Excel can chart series
# with data missing.
#
sub _get_range_data {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Exception/Stringy.pm view on Meta::CPAN
my $value = $exception->$xfield('field_name');
$exception->$xfield(field_name => $value);
Set or get the given field. If the value contains one of the following
caracters, then it is transparently base64 encoded and decoded.
The list of forbidden caracters are:
=over
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Exercises/API.pm view on Meta::CPAN
}
sub _request( $self, $uri ) {
my $response = $self->ua->get($uri);
if ( $response->is_success ) {
return decode_json( $response->decoded_content );
}
else {
my $code = $response->code;
confess "Exercises API status code ($code)\n"
. "Error: "
view all matches for this distribution
view release on metacpan or search on metacpan
public/javascripts/vendor/backbone/backbone.js view on Meta::CPAN
// The default interval to poll for hash changes, if necessary, is
// twenty times a second.
interval: 50,
// Gets the true hash value. Cannot use location.hash directly due to bug
// in Firefox where location.hash will always be decoded.
getHash: function(windowOverride) {
var loc = windowOverride ? windowOverride.location : window.location;
var match = loc.href.match(/#(.*)$/);
return match ? match[1] : '';
},
view all matches for this distribution
view release on metacpan or search on metacpan
bundled/JSON-PP/JSON/PP.pm view on Meta::CPAN
This section supposes that your perl vresion is 5.8 or later.
If you know a JSON text from an outer world - a network, a file content, and so on,
is encoded in UTF-8, you should use C<decode_json> or C<JSON> module object
with C<utf8> enable. And the decoded result will contain UNICODE characters.
# from network
my $json = JSON::PP->new->utf8;
my $json_text = CGI->new->param( 'json_data' );
my $perl_scalar = $json->decode( $json_text );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/perlxstut.pod view on Meta::CPAN
=over 4
=item *
The INIT: directive contains code that will be placed immediately after
the argument stack is decoded. C does not allow variable declarations at
arbitrary locations inside a function,
so this is usually the best way to declare local variables needed by the XSUB.
(Alternatively, one could put the whole C<PPCODE:> section into braces, and
put these declarations on top.)
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-extism.t view on Meta::CPAN
ok($fplugin);
my $hello = "Hello, World!";
$highlevel[0] = $fplugin->call("count_vowels", $hello);
$highlevel[1] = $fplugin->call("count_vowels", $hello);
}
my @decoded = map {decode_json $_} @highlevel;
ok($decoded[0]{count} == 3);
ok($decoded[0]{count} == $decoded[1]{count});
ok($decoded[0]{total} == 3);
ok($decoded[1]{total} == 6);
# Verify both sets of results are the same
is($highlevel[0], $lowlevel[0]);
is($highlevel[1], $lowlevel[1]);
view all matches for this distribution
view release on metacpan or search on metacpan
$h->header($key => $value);
}
my $r = HTTP::Response->new(200, 'OK', $h, $body);
ok($h->content_encoding() eq 'gzip');
$body = $r->decoded_content();
if($^O eq 'MSWin32') {
ok($body =~ /\\web\\English\\test4.cgi\\.+\.html"/m);
} else {
ok($body =~ /"\/web\/English\/test4.cgi\/.+\.html"/m);
}
view all matches for this distribution
view release on metacpan or search on metacpan
ffmpeg-6036.c view on Meta::CPAN
typedef struct AVInputStream {
int file_index;
int index;
AVStream *st;
int discard; /* true if stream data should be discarded */
int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
int64_t sample_index; /* current sample */
int64_t start; /* time when read started */
unsigned long frame; /* current frame */
int64_t next_pts; /* synthetic pts for cases where pkt.pts
view all matches for this distribution
view release on metacpan or search on metacpan
deps/hidapi/linux/hid.c view on Meta::CPAN
return ret;
}
/* Set the last global error to be reported by hid_error(NULL).
* The given error message will be copied (and decoded according to the
* currently locale, so do not pass in string constants).
* The last stored global error message is freed.
* Use register_global_error(NULL) to indicate "no error". */
static void register_global_error(const char *msg)
{
deps/hidapi/linux/hid.c view on Meta::CPAN
last_global_error_str = utf8_to_wchar_t(msg);
}
/* Set the last error for a device to be reported by hid_error(device).
* The given error message will be copied (and decoded according to the
* currently locale, so do not pass in string constants).
* The last stored global error message is freed.
* Use register_device_error(device, NULL) to indicate "no error". */
static void register_device_error(hid_device *dev, const char *msg)
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Games/Freelancer/UTF.pm view on Meta::CPAN
},
'jc_defender.3db' => { #A model, a file can have multiple .3db (model) files in them
'Hardpoints' => { #The game lets you mount things on this Points
'Fixed' => { #Not rotatebale
'HpEngine01' => {
#These are just packed vectors, can be easily decoded using unpack("f*",this)
'Orientation' => '???',
'Position' => 'IK¿×A' #also a vector: unpack("f*",this)
},
}
'Revolute' => { #For weapons mostly, follow the cursor.
view all matches for this distribution
view release on metacpan or search on metacpan
# $data = { a => .., b => .. }
# Or, more concisely:
my $data = fu->query(a => {anybool => 1}, b => {});
To fetch all query paramaters as decoded by C<query_decode()>, use:
my $data = fu->query({type=>'any'});
=item fu->cookie(...)
=item fu->json(...)
Like C<< fu->query() >> but parses the request body as JSON. Returns the raw
(unvalidated!) JSON Unicode string if no arguments are given. To retrieve the
decoded JSON data without performing further validation, use:
my $data = fu->json({type=>'any'});
=item fu->formdata(...)
view all matches for this distribution
view release on metacpan or search on metacpan
This method starts the server listening on it's port and returns the IP which it is listening on.
=item $s->addCallback( $message, $coderef );
This method registers the referenced subroutine as a handler for the specified message. When the server receives that message from the client, it checks it's handler hash and dispatches the decoded message to the sub. The sub should handle the follow...
C<( $userid, $msg, $params )>
$userid contains the internal connection id for the client session. You can use this id to associate logins with clients. The $msg parameter contains the message the client sent. This allows one routine to handle more than one message. Messages from ...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Facebook/Graph/AccessToken/Response.pm view on Meta::CPAN
}
);
sub _retrieve_error_message {
my $response = shift;
my $content = eval { from_json($response->decoded_content) };
if ($@) {
return $response->message;
}
else {
return $content->{error}{message};
view all matches for this distribution
view release on metacpan or search on metacpan
t/003_publish/04_create_test_users.t view on Meta::CPAN
is $args{url}, 'https://graph.facebook.com/', 'end point';
is $args{method}, 'POST', 'method';
is_deeply $args{headers}, ['Authorization', 'OAuth 12345qwerty'], 'headers';
ok $args{content}->{batch};
my $decoded_content = decode_json($args{content}->{batch});
my $body = +{URI->new('?'.$decoded_content->[0]->{body})->query_form};
is_deeply $body, +{
permissions => 'publish_actions',
installed => 'true',
locale => 'en_US',
}, 'body';
is $decoded_content->[0]->{relative_url}, '/1234556/accounts/test-users', 'relative_url';
is uc $decoded_content->[0]->{method}, 'POST', 'method';
is_deeply $args{content}->{access_token}, '12345qwerty', 'access_token';
return (
1,
200,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Fancazzista/Scrap/DevtoScrapper.pm view on Meta::CPAN
my $response = $ua->request($r);
my @posts = ();
if ( $response->is_success ) {
my $responseContent = decode_json $response->decoded_content;
my @children = @{$responseContent};
foreach (@children) {
my $text = $_->{title};
$text =~ s/^\s+|\s+$//g;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Feed/Data/Stream.pm view on Meta::CPAN
$req->header( 'Accept-Encoding', 'gzip' );
my $res = $ua->request($req) or croak "Failed to fetch URI: $stream";
if ( $res->code == 410 ) {
croak "This feed has been permantly removed";
}
my $content = $res->decoded_content(charset => 'utf8');
return \$content;
}
sub open_file {
my ($self) = $validate->open_file->(@_);
view all matches for this distribution