view release on metacpan or search on metacpan
lib/AnyEvent/Monitor/CPU.pm view on Meta::CPAN
1;
__END__
=encoding utf8
=head1 NAME
AnyEvent::Monitor::CPU - monitors your process CPU usage, with high/low watermark triggers
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/MultiDownload.pm view on Meta::CPAN
#!/usr/bin/perl
package AnyEvent::MultiDownload;
use strict;
use utf8;
use Moo;
use AE;
use Asset::File;
use AnyEvent::Digest;
use List::Util qw/shuffle/;
lib/AnyEvent/MultiDownload.pm view on Meta::CPAN
__END__
=pod
=encoding utf8
=head1 NAME
AnyEvent::MultiDownload - éé»å¡çå¤çº¿ç¨å¤å°åæä»¶ä¸è½½ç模å
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/MySQL/ConnPool.pm view on Meta::CPAN
sub {
my($dbh) = @_;
if( $dbh ) {
warn "Connect success!";
$dbh->pre_do("set names latin1");
$dbh->pre_do("set names utf8");
}
else {
warn "Connect fail: $AnyEvent::MySQL::errstr ($AnyEvent::MySQL::err)";
$end->send;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/MySQL.pm view on Meta::CPAN
use 5.006;
use strict;
use warnings;
=encoding utf8
=head1 NAME
AnyEvent::MySQL - Pure Perl AnyEvent socket implementation of MySQL client
lib/AnyEvent/MySQL.pm view on Meta::CPAN
my $dbh = AnyEvent::MySQL->connect("DBI:mysql:database=test;host=127.0.0.1;port=3306", "ptest", "pass", { PrintError => 1 }, sub {
my($dbh) = @_;
if( $dbh ) {
warn "Connect success!";
$dbh->pre_do("set names latin1");
$dbh->pre_do("set names utf8");
}
else {
warn "Connect fail: $AnyEvent::MySQL::errstr ($AnyEvent::MySQL::err)";
$end->send;
}
lib/AnyEvent/MySQL.pm view on Meta::CPAN
or tried but failed.
If failed, the $dbh in the $cb's args will be undef.
You can do some connection initialization here, such as
set names utf8;
But you should NOT rely on this for work flow control,
cause the reconnection can occur anytime.
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
eg/CrawlApache.pm view on Meta::CPAN
package CrawlApache;
use strict;
use utf8;
use warnings qw(all);
use feature qw(say);
use Moo;
use MooX::Types::MooseLike::Base qw(InstanceOf);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/TestBase.pm view on Meta::CPAN
$self->requires('Filter::Util::Call');
}
1;
=encoding utf8
#line 70
view all matches for this distribution
view release on metacpan or search on metacpan
example/ex.pl view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use v5.10;
use lib 'lib';
use AnyEvent;
view all matches for this distribution
view release on metacpan or search on metacpan
use 5.008_001;
use strict;
use warnings;
use utf8;
use Module::Build;
use File::Basename;
use File::Spec;
use CPAN::Meta;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Redis/RipeRedis.pm view on Meta::CPAN
our $VERSION = '1.62';
use AnyEvent;
use AnyEvent::Handle;
use Encode qw( find_encoding is_utf8 );
use Scalar::Util qw( looks_like_number weaken );
use Digest::SHA qw( sha1_hex );
use Carp qw( croak );
my %ERROR_CODES;
lib/AnyEvent/Redis/RipeRedis.pm view on Meta::CPAN
my $cmd_str = '';
foreach my $token ( $cmd->{kwd}, @{ $cmd->{args} } ) {
unless ( defined $token ) {
$token = '';
}
elsif ( defined $self->{encoding} && is_utf8( $token ) ) {
$token = $self->{encoding}->encode( $token );
}
$cmd_str .= '$' . length( $token ) . EOL . $token . EOL;
}
$cmd_str = '*' . ( scalar( @{ $cmd->{args} } ) + 1 ) . EOL . $cmd_str;
lib/AnyEvent/Redis/RipeRedis.pm view on Meta::CPAN
lazy => 1,
connection_timeout => 5,
read_timeout => 5,
reconnect => 1,
min_reconnect_interval => 5,
encoding => 'utf8',
on_connect => sub {
# handling...
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Redis.pm view on Meta::CPAN
use AnyEvent::Redis;
my $redis = AnyEvent::Redis->new(
host => '127.0.0.1',
port => 6379,
encoding => 'utf8',
on_error => sub { warn @_ },
on_cleanup => sub { warn "Connection closed: @_" },
);
# callback based
lib/AnyEvent/Redis.pm view on Meta::CPAN
Optional. The server port.
=item encoding => <ENCODING>
Optional. Encode and decode data (when storing and retrieving, respectively)
according to I<ENCODING> (C<"utf8"> is recommended or see L<Encode::Supported>
for details on possible I<ENCODING> values).
Omit if you intend to handle raw binary data with this connection.
=item on_error => $cb->($errmsg)
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/TestBase.pm view on Meta::CPAN
$self->requires('Filter::Util::Call');
}
1;
=encoding utf8
#line 70
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/RipeRedis/Cluster.pm view on Meta::CPAN
$self->{on_node_disconnect} = $params{on_node_disconnect};
$self->{on_node_error} = $params{on_node_error};
$self->on_error( $params{on_error} );
my %node_params;
foreach my $name ( qw( password utf8 connection_timeout read_timeout
reconnect reconnect_interval handle_params ) )
{
next unless defined $params{$name};
$node_params{$name} = $params{$name};
}
lib/AnyEvent/RipeRedis/Cluster.pm view on Meta::CPAN
}
sub crc16 {
my $data = shift;
unless ( utf8::downgrade( $data, 1 ) ) {
utf8::encode($data);
}
my $crc = 0;
foreach my $char ( split //, $data ) {
$crc = ( $crc << 8 & 0xff00 )
lib/AnyEvent/RipeRedis/Cluster.pm view on Meta::CPAN
If enabled, the client will try to send read-only commands to slave nodes.
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.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/RipeRedis.pm view on Meta::CPAN
$self->{host} = $params{host} || D_HOST;
$self->{port} = $params{port} || D_PORT;
$self->{password} = $params{password};
$self->{database}
= defined $params{database} ? $params{database} : D_DB_INDEX;
$self->{utf8} = exists $params{utf8} ? $params{utf8} : 1;
$self->{lazy} = $params{lazy};
$self->{reconnect} = exists $params{reconnect} ? $params{reconnect} : 1;
$self->{handle_params} = $params{handle_params} || {};
$self->{on_connect} = $params{on_connect};
$self->{on_disconnect} = $params{on_disconnect};
lib/AnyEvent/RipeRedis.pm view on Meta::CPAN
return $self->{$name};
};
}
foreach my $name ( qw( utf8 reconnect on_connect on_disconnect ) ) {
*{$name} = sub {
my $self = shift;
if (@_) {
$self->{$name} = shift;
lib/AnyEvent/RipeRedis.pm view on Meta::CPAN
return;
}
$reply = substr( $handle->{rbuf}, 0, $str_len, '' );
substr( $handle->{rbuf}, 0, EOL_LENGTH, '' );
if ( $self->{utf8} ) {
utf8::decode($reply);
}
undef $str_len;
}
else {
lib/AnyEvent/RipeRedis.pm view on Meta::CPAN
my @tokens = ( @{ $cmd->{kwds} }, @{ $cmd->{args} } );
foreach my $token (@tokens) {
unless ( defined $token ) {
$token = '';
}
elsif ( $self->{utf8} ) {
utf8::encode($token);
}
$cmd_str .= '$' . length($token) . EOL . $token . EOL;
}
$cmd_str = '*' . scalar(@tokens) . EOL . $cmd_str;
lib/AnyEvent/RipeRedis.pm view on Meta::CPAN
connection by using C<SELECT> command. The client remembers last selected
database after reconnection and switches to it automaticaly.
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.
lib/AnyEvent/RipeRedis.pm view on Meta::CPAN
=head2 database()
Gets selected database index.
=head2 utf8( [ $boolean ] )
Enables or disables UTF-8 mode.
=head2 connection_timeout( [ $fractional_seconds ] )
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/SKKServ.pm view on Meta::CPAN
}
1;
__END__
=encoding utf8
=head1 NAME
AnyEvent::SKKServ - Lightweight skkserv implementation for AnyEvent
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/SSH2.pm view on Meta::CPAN
1;
__END__
=pod
=encoding utf8
=head1 NAME
AnyEvent::SSH2 - åºäº AnyEvent ç SSH2 çéé»å¡äºä»¶é©±å¨çå®ç°
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/STOMP/Client.pm view on Meta::CPAN
unless ($self->is_connected or $command eq 'CONNECT') {
croak "Have you considered connecting to a STOMP broker first before "
."trying to send something?";
}
utf8::encode($command);
my $header;
if ($command eq 'CONNECT') {
$header = header_hash2string($header_hashref);
}
else {
$header = header_hash2string(encode_header($header_hashref));
}
utf8::encode($header);
my $frame;
if ($command eq 'SEND') {
$body = '' unless defined $body;
$frame = $command.$EOL.$header.$EOL.$EOL.$body.$NULL;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
use MooX::Types::MooseLike::Base qw(:all);
use Data::Dumper;
use JSON qw(to_json from_json);
use HTTP::Request::Common qw(POST);
use Ref::Util qw(is_plain_arrayref is_plain_hashref);
use URI::Escape qw(uri_escape_utf8);
use namespace::clean;
use Scalar::Util qw(looks_like_number);
use AnyEvent;
BEGIN {
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
my $headers=$self->default_headers;
my @args;
while(my ($key,$value)=splice @list,0,2) {
push @args,uri_escape_utf8($key).'='.uri_escape_utf8($value);
}
my $args=join '&',@args;
$uri .=$args;
$uri=~ s/\?$//s;
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
my $headers=$self->default_headers;
my @args;
while(my ($key,$value)=splice @list,0,2) {
push @args,uri_escape_utf8($key).'='.uri_escape_utf8($value);
}
my $args=join '&',@args;
$uri .=$args;
my $get=new HTTP::Request(HEAD=>$uri,$self->default_headers);
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
my $headers=$self->default_headers;
my @args;
while(my ($key,$value)=splice @list,0,2) {
push @args,uri_escape_utf8($key).'='.uri_escape_utf8($value);
}
my $args=join '&',@args;
$uri .=$args;
my $get=new HTTP::Request(DELETE=>$uri,$self->default_headers);
view all matches for this distribution
view release on metacpan or search on metacpan
use 5.008_001;
use strict;
use warnings;
use utf8;
use Module::Build;
use File::Basename;
use File::Spec;
use CPAN::Meta;
view all matches for this distribution
view release on metacpan or search on metacpan
eg/print_feed_titles.pl view on Meta::CPAN
use AnyEvent::Superfeedr;
use Encode;
die "$0 <jid> <pass>" unless @ARGV >= 2;
binmode STDOUT, ":utf8";
my $end = AnyEvent->condvar;
my $sf = AnyEvent::Superfeedr->new(
debug => $ENV{DEBUG},
jid => shift,
eg/print_feed_titles.pl view on Meta::CPAN
my $notification = shift;
warn $notification->as_xml;
printf "%s: %s\n", $notification->title, $notification->feed_uri;
for my $entry ($notification->entries) {
my $title = Encode::decode_utf8($entry->title);
$title =~ s/\s+/ /gs;
my $l = length $title;
my $max = 50;
if ($l > $max) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Sway.pm view on Meta::CPAN
}
=head2 $sway->message($type, $content)
Sends a message of the specified C<type> to Sway, possibly containing the data
structure C<content> (or C<content>, encoded as utf8, if C<content> is a
scalar), if specified.
my $reply = $sway->message(TYPE_RUN_COMMAND, "reload")->recv;
if ($reply->{success}) {
say "Configuration successfully reloaded";
lib/AnyEvent/Sway.pm view on Meta::CPAN
my $payload = "";
if ($content) {
if (not ref($content)) {
# Convert from Perlâs internal encoding to UTF8 octets
$payload = encode_utf8($content);
} else {
$payload = encode_json $content;
}
}
my $message = $magic . pack("LL", length($payload), $type) . $payload;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Task/Server/Worker.pm view on Meta::CPAN
my ($server, $fh, $monitor_fh) = @_;
AnyEvent::Util::fh_nonblocking $fh, 0;
AnyEvent::Util::fh_nonblocking $monitor_fh, 0;
$json = JSON::XS->new->utf8;
$sel = IO::Select->new;
$sel->add($fh, $monitor_fh);
while(1) {
view all matches for this distribution
view release on metacpan or search on metacpan
examples/demo.pl view on Meta::CPAN
my ( $key ) = @_;
print "Got key: ".$key->termkey->format_key( $key, FORMAT_VIM )."\n";
$cv->send if $key->type_is_unicode and
$key->utf8 eq "C" and
$key->modifiers & KEYMOD_CTRL;
},
);
$cv->recv;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Tools/Buffer.pm view on Meta::CPAN
use utf8;
use strict;
use warnings;
package AnyEvent::Tools::Buffer;
use AnyEvent::AggressiveIdle qw(aggressive_idle stop_aggressive_idle);
view all matches for this distribution
view release on metacpan or search on metacpan
eg/track.pl view on Meta::CPAN
my $done = AE::cv;
my($user, $password, $method, %args) = @ARGV;
binmode STDOUT, ":utf8";
my $streamer = AnyEvent::Twitter::Stream->new(
username => $user,
password => $password,
method => $method || "sample",
view all matches for this distribution
view release on metacpan or search on metacpan
eg/gen_token.pl view on Meta::CPAN
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use JSON;
use AnyEvent;
use AnyEvent::Twitter;
my %p;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/UWSGI.pm view on Meta::CPAN
$env->{REMOTE_PORT} = $lport;
$env->{SERVER_PORT} = $rport;
$env->{SERVER_NAME} = $rhost;
if ($hdr{'x-uwsgi-nginx-compatible-mode'}) {
$env->{PATH_INFO} = Encode::decode('utf8', URI::Escape::XS::uri_unescape($env->{PATH_INFO}));
}
foreach my $k (keys %hdr) {
(my $env_k = uc $k) =~ tr/-/_/;
$env->{"HTTP_$env_k"} = defined $hdr{$k} ? $hdr{$k} : '';
}
my $data = '';
foreach my $k (sort keys %$env) {
die "Undef value found for $k" unless defined $env->{$k};
$data .= pack 'v/a*v/a*', map { Encode::encode('utf8', $_) } $k, $env->{$k};
}
my $req_buf = pack('C1v1C1',
defined $arg{modifier1} ? $arg{modifier1} : 5, # default PSGI_MODIFIER1,
length($data),
view all matches for this distribution
view release on metacpan or search on metacpan
WebDriver.pm view on Meta::CPAN
our $WEB_ELEMENT_IDENTIFIER = "element-6066-11e4-a52e-4f735466cecf";
our $WEB_WINDOW_IDENTIFIER = "window-fcc6-11e5-b4f8-330a88ab9d7f";
our $WEB_FRAME_IDENTIFIER = "frame-075b-4da1-b6ba-e579c2d3230a";
my $json = eval { require JSON::XS; JSON::XS:: } || do { require JSON::PP; JSON::PP:: };
$json = $json->new->utf8;
$json->boolean_values (0, 1)
if $json->can ("boolean_values");
sub _decode_base64 {
view all matches for this distribution
view release on metacpan or search on metacpan
use 5.008_001;
use strict;
use warnings;
use utf8;
use Module::Build;
use File::Basename;
use File::Spec;
use CPAN::Meta;
view all matches for this distribution
view release on metacpan or search on metacpan
[RemovePrereqs]
; comes with perl 5.8
remove = strict
remove = warnings
remove = utf8
remove = lib
remove = base
remove = Scalar::Util
remove = Carp
remove = Encode
view all matches for this distribution
view release on metacpan or search on metacpan
use lib ($FindBin::RealBin);
use testlib::Util qw(start_server set_timeout memory_cycle_ok memory_cycle_exists);
use testlib::ConnConfig;
use AnyEvent::WebSocket::Server;
use AnyEvent::WebSocket::Client;
no utf8;
set_timeout;
testlib::ConnConfig->for_all_ok_conn_configs(sub {
my ($cconfig) = @_;
view all matches for this distribution