view release on metacpan or search on metacpan
As a rule of thumb, all data you pass to this module to be sent to F<mpv>
is expected to be in unicode. To pass something that isn't, you need to
escape it using C<escape_binary>.
Data received from F<mpv>, however, is I<not> decoded to unicode, as data
returned by F<mpv> is not generally encoded in unicode, and the encoding
is usually unspecified. So if you receive data and expect it to be in
unicode, you need to first decode it from UTF-8, but note that this might
fail. This is not a limitation of this module - F<mpv> simply does not
specify nor guarantee a specific encoding, or any encoding at all, in its
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Net/Amazon/S3/Client/Object.pm view on Meta::CPAN
# TODO: _content_sub might become more async manner?
# NOTE: exists and delete have HIGH risk.
use Module::AnyEvent::Helper::Filter -as => __PACKAGE__, -target => 'Net::Amazon::S3::Client::Object',
-transformer => 'Net::Amazon::S3::Client::Object',
-translate_func => [qw(exists _get get get_decoded get_filename _put put put_filename delete
initiate_multipart_upload complete_multipart_upload abort_multipart_upload put_part)],
-replace_func => [qw(_send_request_raw _send_request _send_request_xpc)]
;
1;
lib/AnyEvent/Net/Amazon/S3/Client/Object.pm view on Meta::CPAN
=item exists_async
=item get_async
=item get_decoded_async
=item get_filename_async
=item put_async
view all matches for this distribution
view release on metacpan or search on metacpan
eg/yada-crawler.pl view on Meta::CPAN
return if not $self->response->is_success
or not $self->response->content_is_html;
my $doc = scraper {
process q(html title), title => q(text);
process q(a), q(links[]) => q(@href);
}->scrape($self->response->decoded_content => $self->final_url);
printf qq(%-64s %s\n), $self->final_url, $doc->{title} =~ s/\r?\n/ /rsx;
$self->queue->prepend([
grep { $_->can(q(host)) and $_->host eq $self->initial_url->host }
@{$doc->{links} // []}
] => __SUB__);
view all matches for this distribution
view release on metacpan or search on metacpan
eg/google-oauth.pl view on Meta::CPAN
my $access_token = $auth->get_access_token($req->parameters->{code});
my $res = $access_token->get('https://www.googleapis.com/oauth2/v1/userinfo');
my $user_info = decode_json $res->decoded_content;
print "Hello, $user_info->{name}.\n";
view all matches for this distribution
view release on metacpan or search on metacpan
t/AnyEvent/ProcessPool/Task.t view on Meta::CPAN
ok $task->execute, 'execute';
ok my $line = $task->encode, 'encode';
is scalar(split(qr/[\r\n]/, $line)), 1, 'no line breaks';
ok my $decoded = AnyEvent::ProcessPool::Task->decode($line), 'decode';
is $decoded->result, 42, 'result';
};
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/RPC/Enc.pm view on Meta::CPAN
}
sub decode_response {
my $self = shift;
my $res = shift; # don't decode
return $res->decoded_content( charset => 'none' );
}
sub decode {
my $self = shift;
my $rpc = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Radius/Server.pm view on Meta::CPAN
if ($h{on_read_raw}) {
# dump raw data
$h{on_read_raw}->($obj, $data, $from);
}
# how to decoded $from
# my($port, $host) = AnyEvent::Socket::unpack_sockaddr($from);
# my $ip = format_ipv4($host);
my ($type, $req_id, $authenticator, $av_list) = $obj->packer()->parse($data);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Riak.pm view on Meta::CPAN
$_[0]->timeout_reset;
$_[0]->timeout(0);
my ( $response_code, $response_body ) = unpack( 'c a*', $_[1] );
if ($response_code == $message_codes->{RpbErrorResp}) {
my $decoded_message = RpbErrorResp->decode($response_body);
return $callback->(undef, { error_code => $decoded_message->errcode,
error_message => $decoded_message->errmsg });
}
if ($response_code != $expected_response_code) {
return $callback->(undef, {
error_code => -2,
error_message => "wrong response (got: '$response_code', "
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/RipeRedis/Cluster.pm view on Meta::CPAN
Disabled by default.
=item utf8 => $boolean
If enabled, all strings will be converted to UTF-8 before sending to nodes,
and all results will be decoded from UTF-8.
Enabled by default.
=item connection_timeout => $fractional_seconds
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/RipeRedis.pm view on Meta::CPAN
The default database index is C<0>.
=item utf8 => $boolean
If enabled, all strings will be converted to UTF-8 before sending to
the server, and all results will be decoded from UTF-8.
Enabled by default.
=item connection_timeout => $fractional_seconds
view all matches for this distribution
view release on metacpan or search on metacpan
isa_ok $h => 'AnyEvent::Handle', 'handler got a handle,';
ok (!$error, 'no handler error') or diag "handler got error '$error'";
async {
is_deeply $env, $expected_env, 'correctly decoded env';
is $$content_ref, $content, 'correct content';
$h->push_write("any old response\r\n");
$h->push_shutdown();
$h->on_drain(sub { $done->end });
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/STOMP/Client.pm view on Meta::CPAN
cb => sub {
my ($handle, $header_string) = @_;
my $header_hashref = header_string2hash($header_string);
my $args;
# The headers of the CONNECTED frame are not en-/decoded
# for backwards compatibility with STOMP 1.0
unless ($command eq 'CONNECTED') {
$header_hashref = decode_header($header_hashref);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/SlackBot.pm view on Meta::CPAN
verify_hostname => 0
);
my $response=$ua->request($request);
$self->{timer}=undef;
if($response->code==200) {
my $data=eval { from_json($response->decoded_content) };
if($@) {
return $self->new_false("Failed to decode response, error was: $@");
}
unless(exists $data->{url} and $data->{self}) {
my $msg=exists $data->{error} ? $data->{error} : 'unknown slack error';
lib/AnyEvent/SlackBot.pm view on Meta::CPAN
++$self->stats->{http_posts_sent};
$self->stats->{running_posts}--;
if($response->code!=200) {
$self->log_error("Failed to send Message,error was: ".$response->status_line) ;
} else {
my $json=eval { from_json($response->decoded_content) };
if($@) {
$self->log_error("Failed to parse json response, error was: $@")
} else {
$self->{ignore}->{$json->{ts}}++;
$self->log_error("Slack Responded with an eror: $json->{error}".Dumper($json)) unless $json->{ok};
view all matches for this distribution
view release on metacpan or search on metacpan
- Support multiple post parameters for 'filter'.
... I thought this has been there for a while but it wasn't.
- Support partner-only endpoints: links and retweet
0.11 Mon Mar 1 17:12:37 PST 2010
- Added 'no_decode_json' option that passes the undecoded raw JSON to the callback
0.10 Sat Feb 6 17:55:28 PST 2010
- Fixed a possible memory leak (hidekiy)
0.09 Mon Dec 7 16:45:06 PST 2009
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Twitter.pm view on Meta::CPAN
This module is L<AnyEvent::HTTP> style, so you have to pass the callback (coderef).
Passed callback will be called with C<$header>, C<$response>, C<$reason> and C<$error_response>.
If something is wrong with the response from Twitter API, C<$response> will be C<undef>.
On non-2xx HTTP status code, you can get the decoded response via C<$error_response>.
So you can check the value like below.
my $callback = sub {
my ($header, $response, $reason, $error_response) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
TODO: geckodriver/chromedriver autostart classes
TODO: enforce duration values ot be integers
TODO: more move/source/duration examples
1.2 Sat Mar 28 18:05:59 CET 2020
- INCOMPATIBLE CHANGE: screenshots are now decoded and are no longer
in base64 (or data urls), but a biary png image.
- INCOMPAITBLE CHANGE: this module now uses the second key table
from the spec which contains shifted variants of the keys, which
allows for shifted characters and to distinguish between e.g.
left and right Alt keys, but causes some key names to change.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/WebSocket/Message.pm view on Meta::CPAN
has body => ( is => 'ro', required => 1 );
has opcode => ( is => 'ro', default => 1 );
sub decoded_body
{
Encode::decode("UTF-8", shift->body)
}
lib/AnyEvent/WebSocket/Message.pm view on Meta::CPAN
The integer code for the type of message.
=head1 METHODS
=head2 decoded_body
my $body = $message->decoded_body;
Returns the body decoded from UTF-8.
=head2 is_text
my $bool = $message->is_text;
view all matches for this distribution
view release on metacpan or search on metacpan
t/12-session-ser-cryptbase64.t view on Meta::CPAN
ok(Apache::AppSamurai::Session::Serialize::CryptBase64::serialize($sess), "serialize() - Serialized (encoded and encrypted) data");
# Clear session data before reloading
$sess->{data} = '';
ok((Apache::AppSamurai::Session::Serialize::CryptBase64::unserialize($sess)) && ($sess->{data}->{pass} eq $pass), "unserialize() - Correctly unserialized (decrypted and decoded) saved data");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/AuthCookie.pm view on Meta::CPAN
return $r->dir_config("${auth_name}RequiresEncoding");
}
sub decoded_user {
my ($self, $r) = @_;
my $user = $r->connection->user;
if (is_blank($user)) {
lib/Apache/AuthCookie.pm view on Meta::CPAN
return $user;
}
sub decoded_requires {
my ($self, $r) = @_;
my $reqs = $r->requires or return;
my $encoding = $self->requires_encoding($r);
lib/Apache/AuthCookie.pm view on Meta::CPAN
$r->log_error($auth_type . " auth type is " . $r->auth_type)
if ($debug >= 3);
return DECLINED;
}
my $reqs_arr = $auth_type->decoded_requires($r) or return DECLINED;
my $user = $auth_type->decoded_user($r);
if (is_blank($user)) {
# authentication failed
$r->log_reason("No user authenticated", $r->uri);
return FORBIDDEN;
}
lib/Apache/AuthCookie.pm view on Meta::CPAN
=head2 requires_encoding($r): string
Return the ${auth_name}RequiresEncoding setting that is in effect for this request.
=head2 decoded_user($r): string
If you have set ${auth_name}Encoding, then this will return the decoded value of
C<< $r->connection->user >>.
=head2 decoded_requires($r): arrayref
This method returns the C<< $r->requires >> array, with the C<requirement>
values decoded if C<${auth_name}RequiresEncoding> is in effect for this
request.
=head2 handle_cache(): void
If C<${auth_name}Cache> is defined, this sets up the response so that the
lib/Apache/AuthCookie.pm view on Meta::CPAN
The internal pure-perl params processing subclass will be used, even if
libapreq is installed. libapreq does not handle encoding.
=item *
POST/GET data intercepted by AuthCookie will be decoded to perl's internal
format using L<Encode/decode>.
=item *
The value stored in C<< $r-E<gt>connection-E<gt>user >> will be encoded as
B<bytes>, not characters using the configured encoding name. This is because
the value stored by mod_perl is a C API string, and not a perl string. You can
use L</decoded_user()> to get user string encoded using B<character> semantics.
=back
This does has some caveats:
=over 4
=item *
your L</authen_cred()> and L</authen_ses_key()> function is expected to return
a decoded username, either by passing it through L<Encode/decode()>, or, by
turning on the UTF8 flag if appropriate.
=item *
Due to the way HTTP works, cookies cannot contain non-ASCII characters.
lib/Apache/AuthCookie.pm view on Meta::CPAN
returned by L</authen_cred()>.
=item *
Similarly, you must reverse this escaping process in L</authen_ses_key()> and
return a L<Encode/decode()> decoded username. If your L</authen_cred()>
function already only generates ASCII-only session keys then you do not need to
worry about any of this.
=item *
The value stored in C<< $r-E<gt>connection-E<gt>user >> will be encoded using
bytes semantics using the configured B<Encoding>. If you want the decoded user
value, use L</decoded_user()> instead.
=back
=head2 Requires
view all matches for this distribution
view release on metacpan or search on metacpan
0.15 9. Apr 2002
- Added patch from Brian Paulsen which causes correct handling of
non unicode charset (needed for some versions of win9x) and
more verbose debugging output (decoded flags)
0.14 26. Feb 2002
- fixed a problem that page content of Perl sometimes goes to the
stderr instead of stdout
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/BalancerManager.pm view on Meta::CPAN
sub _build_index_content {
my $self = shift;
my $response = $self->_get($self->url);
if ($response->is_success) {
return $response->decoded_content;
}
else {
die $response->status_line;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Hadoop/Watcher/Base.pm view on Meta::CPAN
$ua = LWP::UserAgent->new;
$res = $ua->get ( $opts{'url'} );
return 'error' unless $res->is_success;
$content = $res->decoded_content;
return $content;
}
sub _port {
my (%opts) = (@_);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Template/PSP.pm view on Meta::CPAN
# {
# my @list = split(/ /, $ENV{HTTP_AUTHORIZATION});
# if (lc($list[0]) eq "basic")
# {
# my $encoded = pop(@list);
# my $decoded = decode_base64($encoded);
#
# ($AUTH->{username}, $AUTH->{password}) = split(/:/, $decoded);
# }
# }
return 1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
=head1 DESCRIPTION
I<Apache::Request::I18N> adds transparent support over I<Apache::Request> for
internationalized GET/POST parameters. Form field names and values are
automatically decoded and converted either to Perl's internal UTF-8 format, or
to another character encoding.
Since this module inherits from I<Apache::Request>, it can be used as a
drop-in replacement. (It is not a B<perfect> replacement, though; see
L<"COMPATIBILITY ISSUES"> below.) It can also be used in a I<PerlHandler>
=head1 HANDLER
This module provides a simple Apache handler that can be used in a
I<PerlHandler> directive. This is useful when used in combination with other
handlers, which will then automatically access the decoded values. (This
works as long as each handler takes care to call B<instance>() instead of
creating a new object.)
For example, you can use this module in combination with Mason:
field names and filenames as specified by RFC 2184 is currently not supported.
(This is due to a limitation in I<libapreq>.)
Conversely, since some user-agents are known to encode such values via RFC
2047, we attempt decoding if possible. This means that a value supplied by a
standard-compliant user-agent may be wrongly decoded.
=item *
When using the B<multipart/form-data> encoding, each form field value may have
its character encoding specified via the I<charset> parameter of its
Similarly, the I<Content-Transfer-Encoding> header is also ignored.
=item *
When using upload hooks, the upload object supplied to UPLOAD_HOOK will not
have had its I<name>() and I<filename>() decoded yet.
=item *
When using the B<multipart/form-data> encoding, this module will get confused
if a form field appears in both the query string B<and> the request body. In
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SdnFw/js/tinymce/changelog.txt view on Meta::CPAN
Fixed bug where focus of images could be lost in IE if you focused the accessibility confirm dialog in the advimage plugin.
Fixed bug where nestled font elements would produce odd output like missing font elements.
Fixed bug where text colors and styles got removed if invalid_elements included the font element.
Fixed bug where text-decoration set to underline or line-through would remove other styles from span elements.
Fixed bug where editor contents like \n\n would be incorrectly handled and processed as real line feeds.
Fixed bug where incorrectly encoded urls with ampersands in them would be decoded incorrectly.
Optimized the DOMUtils decode method to be a lot faster if the string doesn't have any entities to decode.
Version 3.0.2.1 (2008-02-26)
Fixed alert/confirm dialogs so they display correctly.
Version 3.0.2 (2008-02-26)
Added new body_id option that enables you to specify the id of the body inside the editor iframe based on ideas by David Bildström (ChronoZ).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/Serialize/SOAPEnvelope.pm view on Meta::CPAN
}
sub unserialize {
my $session = shift;
my $deserializer = SOAP::Deserializer->new();
my $decoded = $deserializer->decode($session->{serialized});
$session->{data} = $deserializer->decode_object($decoded);
}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Solr/JSON.pm view on Meta::CPAN
# again.
my $endpoint = $self->endpoint('select', params => $params);
my $result = Apache::Solr::Result->new(%$args, params => $params, endpoint => $endpoint, core => $self);
$self->request($endpoint, $result);
if(my $dec = $result->decoded)
{ # JSON uses different names!
my $r = $dec->{result} = delete $dec->{response};
$r->{doc} = delete $r->{docs};
}
$result;
lib/Apache/Solr/JSON.pm view on Meta::CPAN
{ my ($self, $terms) = @_;
my $endpoint = $self->endpoint('terms', params => $terms);
my $result = Apache::Solr::Result->new(params => $terms, endpoint => $endpoint, core => $self);
$self->request($endpoint, $result);
my $table = $result->decoded->{terms} || {};
$table = {@$table} if ref $table eq 'ARRAY'; # bug in Solr 1.4
while(my ($field, $terms) = each %$table)
{ # repack array-of-pairs into array-of-arrays-of-pair
my @pairs = @$terms;
lib/Apache/Solr/JSON.pm view on Meta::CPAN
# At least until Solr 4.0 response ct=text/plain while producing JSON
my $ct = $resp->content_type;
$ct =~ m/json/i
or error __x"Answer from solr server is not json but {type}", type => $ct;
$self->json->decode($resp->decoded_content || $resp->content);
}
sub simpleUpdate($$;$)
{ my ($self, $command, $attrs, $content) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Tika.pm view on Meta::CPAN
);
# Check for errors
# TODO
return decode_utf8($response->decoded_content(charset => 'none'));
}
sub meta {
my ($self, $bytes, $contentType) = @_;
my $meta = $self->_request(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/API.pm view on Meta::CPAN
# or
return( $api->bailout( @some_reasons ) );
# 100kb
$api->compression_threshold(102400);
my $decoded = $api->decode_base64( $b64_string );
my $ref = $api->decode_json( $json_data );
my $decoded = $api->decode_url;
my $perl_utf8 = $api->decode_utf8( $data );
my $b64_string = $api->encode_base64( $data );
my $json_data = $api->encode_json( $ref );
my $encoded = $api->encode_url( $uri );
my $utf8 = $api->encode_utf8( $data );
lib/Apache2/API.pm view on Meta::CPAN
If an error occurs, it will return undef and set an exception that can be accessed with the L<error|Module::Generic/error> method.
=head2 decode_url( $string )
Given a url-encoded string, this returns the decoded string using L<APR::Request/decode>
=head2 decode_utf8( $data )
Decode some data from ut8 into perl internal utf8 representation using L<Encode>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/ASP/SimpleCGI.pm view on Meta::CPAN
Returns a URL-encoded version of C<$str>.
=head2 unescape( $str )
Returns a URL-decoded version of C<$str>.
=head2 upload( $field_name )
Returns all of the information we have about a file upload named C<$field_name>.
view all matches for this distribution