view release on metacpan or search on metacpan
example/ex.pl view on Meta::CPAN
my $results = shift;
my $errors = shift;
if ( $errors ) {
foreach my $srv ( @$errors ) {
say "err $srv->{error} with $srv->{server_name} $srv->{server_id}";
}
}
if ( $results ) {
foreach my $val ( @$results ) {
say "server_id=$val->{_server_id} value=$val->{val}";
}
}
$cv->send;
},
example/ex.pl view on Meta::CPAN
my $results = shift;
my $errors = shift;
if ( $errors ) {
foreach my $srv ( @$errors ) {
say "err $srv->{error} with $srv->{server_name} $srv->{server_id}";
}
}
if ( $results ) {
foreach my $val ( @$results ) {
say "server_id=$val->{_server_id} value=$val->{val}";
}
}
$cv->send;
},
example/ex.pl view on Meta::CPAN
my $results = shift;
my $errors = shift;
if ( $errors ) {
foreach my $srv ( @$errors ) {
say "err $srv->{error} with $srv->{server_name} $srv->{server_id}";
}
}
if ( $results ) {
foreach my $val ( @$results ) {
say "server_id=$val->{_server_id} value=$val->{val}";
}
}
$cv->send;
},
example/ex.pl view on Meta::CPAN
cb => sub {
my $result = shift;
my $error = shift;
if ( $error ) {
say "err $error->{error} with $error->{server_name} $error->{server_id}";
}
if ( $result ) {
say "server_id=$result->[ 0 ] value=$result->[ 1 ]";
}
$cv->send;
},
);
example/ex.pl view on Meta::CPAN
cb => sub {
my $result = shift;
my $error = shift;
if ( $error ) {
say "err $error->{error} with $error->{server_name} $error->{server_id}";
}
if ( $result ) {
say "server_id=$result->{_server_id} value=$result->{val}";
}
$cv->send;
},
);
example/ex.pl view on Meta::CPAN
cb => sub {
my $result = shift;
my $error = shift;
if ( $error ) {
say "err $error->{error} with $error->{server_name} $error->{server_id}";
}
if ( $result ) {
say "server_id=$result->[ 0 ] updated=$result->[ 1 ]";
}
$cv->send;
},
);
example/ex.pl view on Meta::CPAN
cb => sub {
my $result = shift;
my $error = shift;
if ( $error ) {
say "err $error->{error} with $error->{server_name} $error->{server_id}";
}
if ( $result ) {
say "server_id=$result->[ 0 ] updated=$result->[ 1 ]";
}
$cv->send;
},
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Plurk.pm view on Meta::CPAN
},
sub {
my ($data, $header) = @_;
if ($header->{Status} == 400) {
# say $data;
}
else {
$data = from_json($data);
my $unread_plurks = $data->{plurks};
if (@$unread_plurks) {
view all matches for this distribution
view release on metacpan or search on metacpan
examples/watch_logs.pl view on Meta::CPAN
);
my $usr1 = AnyEvent->signal(
signal => "USR1",
cb => sub {
say "$_: $traffic{$_}" for keys %traffic;
say "---";
%traffic = ();
},
);
my $usr2 = AnyEvent->signal(
examples/watch_logs.pl view on Meta::CPAN
cb => sub {
$guard->broadcast;
},
);
say "Watcher running with pid ", $$;
$guard->wait;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/ProcessPool/Process.pm view on Meta::CPAN
$self->await;
my $cv = AE::cv;
push @{$self->{pending}}, $cv;
$self->{ps}->say($task->encode);
--$self->{ps}->user->{reqs} if $self->{limit};
return $cv;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Processor.pm view on Meta::CPAN
sub start_process { }
sub start_message {
say "Start process";
}
sub process {
my $self = shift;
lib/AnyEvent/Processor.pm view on Meta::CPAN
}
sub process_message {
my $self = shift;
say sprintf(" %#6d", $self->count);
}
sub end_process { return 0; }
sub end_message {
my $self = shift;
say "Number of items processed: ", $self->count;
}
no Moose;
__PACKAGE__->meta->make_immutable;
lib/AnyEvent/Processor.pm view on Meta::CPAN
}
}
sub process_message {
my $self = shift;
say "[", $self->count, "] Fridges testing";
}
package Main;
use FridgeMonitoring;
lib/AnyEvent/Processor.pm view on Meta::CPAN
Something to do at beginning of the process.
=head2 start_message
Something to say about the process. Called by default watcher when verbose mode
is enabled. By default, just send to STDOUT 'Start process...'. Your class can
display another message, or do something else, like sending an email, or a
notification to a monitoring system like Nagios.
=head2 process
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Promise.pm view on Meta::CPAN
})->then(sub {
$redis->set('test', shift);
})->then(sub {
$redis->get('test');
})->then(sub {
say shift;
})->catch(sub {
say 'I failed!';
say @_;
})->fulfill;
=head1 DESCRIPTION
L<AnyEvent::Promise> allows evented interfaces to be chained, taking away some
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/RabbitMQ/PubSub/Consumer.pm view on Meta::CPAN
my ($consumer, $msg) = @_;
...
}
)->then(sub {
say 'Consumer was started...';
});
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/RabbitMQ/Channel.pm view on Meta::CPAN
auto_delete => 1,
passive => 0,
arguments => { 'x-expires' => 0, },
on_success => sub { $done->send; },
on_failure => sub {
say "Unable to create queue $queueName";
$done->send;
},
);
$done->recv;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Builder.pm view on Meta::CPAN
}
sub _is_qr {
my $regex = shift;
# is_regexp() checks for regexes in a robust manner, say if they're
# blessed.
return re::is_regexp($regex) if defined &re::is_regexp;
return ref $regex eq 'Regexp';
}
view all matches for this distribution
view release on metacpan or search on metacpan
pbc/generate_doc.pl view on Meta::CPAN
push @{$enums{$enum_name} //= []}, $item;
next;
}
my ($p1, $type, $name) = split(/\s+/, $item);
defined $name or
say STDERR "$c ($_)";
$current_pod .= "=item $name\n\n";
$type = $mapper{$type} // $type;
if (exists $enums{$type}) {
$type = 'one of ' . join(', ', map { "'$_'" } @{$enums{$type}} )
}
pbc/generate_doc.pl view on Meta::CPAN
}
}
$pod .= $methods_pod . $responses_pod . $objects_pod;
say $pod;
sub _from_camel {
my $s = $_[0];
$s =~ s/(.)([A-Z])([a-z])/$1 . '_' . lc($2) . $3/ge;
$s =~ s/^([A-Z])([a-z])/lc($1) . $2/e;
view all matches for this distribution
view release on metacpan or search on metacpan
examples/synopsis.pl view on Meta::CPAN
my $run = $job->run;
# add watcher to print the next line we see on the child's stdout
$run->delegate('stdout')->handle->push_read( line => sub {
my ($h, $line) = @_;
say "The child said: $line";
});
# write to the child's stdin
$run->delegate('stdin')->handle->push_write("Hello, world!\n");
view all matches for this distribution
view release on metacpan or search on metacpan
bin/sway.pl view on Meta::CPAN
use AnyEvent::Sway qw(:all);
my $sway = sway();
$sway->connect->recv or die "Error connecting";
say "Connected to Sway";
my $workspaces = $sway->message(TYPE_GET_WORKSPACES)->recv;
say "Currently, you use " . @{$workspaces} . " workspaces";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Task.pm view on Meta::CPAN
eval {
$crypted = hash('secret');
};
if ($@) {
say "hash failed: $@";
} else {
say "hashed password is $crypted";
}
But in an asynchronous program, typically C<hash> would initiate some kind of asynchronous operation and then return immediately, allowing the program to go about other tasks while waiting for the result. Since the error might come back at any time i...
AnyEvent::Task accomplishes this mapping with L<Callback::Frame>.
lib/AnyEvent/Task.pm view on Meta::CPAN
frame(code => sub {
$client->checkout->hash('secret', sub {
my ($checkout, $crypted) = @_;
say "Hashed password is $crypted";
});
}, catch => sub {
my $back_trace = shift;
say "Error is: $@";
say "Full back-trace: $back_trace";
})->(); ## <-- frame is created and then immediately executed
Of course if C<hash> is something like a bcrypt hash function it is unlikely to raise an exception so maybe that's a bad example. On the other hand, maybe it's a really good example: In addition to errors that occur while running your callbacks, L<An...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Twitter.pm view on Meta::CPAN
# GET request
$cv->begin;
$ua->get('account/verify_credentials', sub {
my ($header, $response, $reason) = @_;
say $response->{screen_name};
$cv->end;
});
# GET request with parameters
$cv->begin;
$ua->get('account/verify_credentials', {
include_entities => 1
}, sub {
my ($header, $response, $reason) = @_;
say $response->{screen_name};
$cv->end;
});
# POST request with parameters
$cv->begin;
$ua->post('statuses/update', {
status => 'ããã¯ã«ã»ã¸ã¨ ã¡ãã¬ãã'
}, sub {
my ($header, $response, $reason) = @_;
say $response->{user}{screen_name};
$cv->end;
});
# verbose and old style
$cv->begin;
lib/AnyEvent/Twitter.pm view on Meta::CPAN
if ($res) {
print "ratelimit-remaining : ", $hdr->{'x-ratelimit-remaining'}, "\n",
"x-ratelimit-reset : ", $hdr->{'x-ratelimit-reset'}, "\n",
"screen_name : ", $res->{screen_name}, "\n";
} else {
say $reason;
}
$cv->end;
}
);
lib/AnyEvent/Twitter.pm view on Meta::CPAN
status => 'æ¡',
'media[]' => [ undef, $filename, Content => $loaded_image_binary ],
],
sub {
my ($hdr, $res, $reason) = @_;
say $res->{user}{screen_name};
}
);
=head2 request
lib/AnyEvent/Twitter.pm view on Meta::CPAN
my $callback = sub {
my ($header, $response, $reason, $error_response) = @_;
if ($response) {
say $response->{screen_name};
} else {
say $reason;
for my $error (@{$error_response->{errors}}) {
say "$error->{code}: $error->{message}";
}
}
};
=back
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/WebService/Tracks.pm view on Meta::CPAN
);
$tracks->projects(sub {
my ( $projects ) = @_;
say foreach @$projects;
});
AnyEvent->condvar->recv;
=head1 DESCRIPTION
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/XMLRPC.pm view on Meta::CPAN
use common::sense;
# roughly the same as, with much lower memory usage:
#
# use strict qw(vars subs);
# use feature qw(say state switch);
# no warnings;
use utf8;
#~ use Data::Dumper;
use Frontier::RPC2;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/XMPP/Writer.pm view on Meta::CPAN
for SAX parsing. This functionality isn't even specified by the XML
recommendation in any way. The recommendation even says that it's undefined
what happens if you process not-well-formed XML documents.
But I try to be as XMPP "XML" conformant as possible (it should be around
99-100%). But it's hard to say what XML is conformant, as the specifications
of XMPP "XML" and XML are contradicting. For example XMPP also says you only
have to generated and accept UTF-8 encodings of XML, but the XML recommendation
says that each parser has to accept UTF-8 B<and> UTF-16. So, what do you do? Do
you use a XML conformant parser or do you write your own?
lib/AnyEvent/XMPP/Writer.pm view on Meta::CPAN
You have to escape '>' in the character data. I don't know whether XML::Writer
does that. And I honestly don't care much about this. XMPP is broken by design and
I have barely time to writer my own XML parsers and writers to suit their sick taste
of "XML". (Do I repeat myself?)
I would be happy if they finally say (in RFC3920): "XMPP is NOT XML. It's just
XML-like, and some XML utilities allow you to process this kind of XML.".
=head1 METHODS
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
# A template for Makefile.PL used by Arena Networks.
# - Set the $PACKAGE variable to the name of your module.
# - Set $LAST_API_CHANGE to reflect the last version you changed the API
# of your module.
# - Fill in your dependencies in PREREQ_PM
# Alternatively, you can say the hell with this and use h2xs.
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Builder.pm view on Meta::CPAN
}
sub _is_qr {
my $regex = shift;
# is_regexp() checks for regexes in a robust manner, say if they're
# blessed.
return re::is_regexp($regex) if defined &re::is_regexp;
return ref $regex eq 'Regexp';
}
view all matches for this distribution
view release on metacpan or search on metacpan
benchmarks/bench.pl view on Meta::CPAN
my $mongo_col = $mongo_con->get_database('anymongo_bench')->get_collection('bench');
my $any_col = $any_con->get_database('anymongo_bench')->get_collection('bench2');
$|= 1;
say "bench insert docs ...";
cmpthese($tries,{
'mongo-perl-driver' => sub { $sub_insert->($mongo_col,$large_doc) },
'anymongo' => sub{ $sub_insert->($any_col,$large_doc) }
});
say "bench query/cursor ...";
cmpthese(1,{
'mongo-perl-driver' => sub { $sub_query->($mongo_col) },
'anymongo' => sub{ $sub_query->($any_col) }
});
view all matches for this distribution
view release on metacpan or search on metacpan
eg/rpc/mprpc-client.pl view on Meta::CPAN
channel => $channel,
message => $message,
}
);
say $d->recv;
view all matches for this distribution
view release on metacpan or search on metacpan
author/cp932-utf8.pl view on Meta::CPAN
for my $dec ( hex('0') .. hex('10FFFF') ) # ãµãã²ã¼ãæåãå«ãã§ãã
{
my $point = sprintf("U+%06X", $dec);
my $char = chr $dec;
#say $point;
$CP932{$point} = $char unless is_gaiji_cp932($char);
$SJIS{$point} = $char unless is_gaiji_sjis($char);
}
say "CP932 ã«å¤æå¯è½ãªæåæ°ï¼" . scalar keys %CP932; # 9485
say "SJIS ã«å¤æå¯è½ãªæåæ°ï¼" . scalar keys %SJIS; # 7070
# Unicode ã®æåã®ãã¡ãCP932ã«å¤æå¯è½ ã§ Shift_JIS ã«å¤æå¯è½ã§ãªãæåãæ±ãã
my %CP932_NOT_SJIS;
for my $point (keys %CP932)
author/cp932-utf8.pl view on Meta::CPAN
{
$CP932_NOT_SJIS{$point} = $CP932{$point};
}
}
say "CP932 ã«å¤æå¯è½ã§ Shift_JIS ã«å¤æå¯è½ã§ãªãæåæ°ï¼" . scalar keys %CP932_NOT_SJIS;
# Unicode ã®æåã®ãã¡ãShift-JIS 夿å¯è½ã§ CP932 ã«å¤æå¯è½ã§ãªãæåãæ±ãã
my %SJIS_NOT_CP932;
for my $point (keys %SJIS)
author/cp932-utf8.pl view on Meta::CPAN
{
$SJIS_NOT_CP932{$point} = $SJIS{$point}
}
}
say "Shift_JIS ã«å¤æå¯è½ã§ CP932 ã§å¤æå¯è½ã§ãªãæåæ°ï¼" . scalar keys %SJIS_NOT_CP932;
# Unicode ã®æåã®ãã¡ãCP932 ãã¤SJIS 㯠7067æåã
say "CP932 ã«å¤æå¯è½ã§ Shift_JIS ã«å¤æå¯è½ã§ãªãï¼";
for my $point (sort keys %CP932_NOT_SJIS)
{
say "$pointï¼ $CP932_NOT_SJIS{$point}";
}
say "Shift_JIS ã«å¤æå¯è½ã§ CP932 ã«å¤æå¯è½ã§ãªãï¼";
for my $point (sort keys %SJIS_NOT_CP932)
{
say "$pointï¼ $SJIS_NOT_CP932{$point}";
}
exit;
sub is_gaiji_cp932
view all matches for this distribution
view release on metacpan or search on metacpan
PerlHandler
PerlLogHandler
PerlCleanupHandler
For straight Apache::ASP programming, there are some
equivalents, say Script_OnStart event instead of Init/Fixup
stages, or $Server->RegisterCleanup() for Log/Cleanup stages,
but you can do things in the mod_perl handlers that you
cannot do in Apache::ASP, especially if you want to handle
all files globally, and not just ASP scripts.
To => 'somebody@yourdomain.com.foobar',
From => 'youremail@yourdomain.com.foobar',
Subject => 'Subject of Email',
Body =>
'Body of message. '.
'You might have a lot to say here!',
Organization => 'Your Organization',
CC => 'youremailcc@yourdomain.com.foobar',
BCC => 'youremailbcc@yourdomain.com.foobar',
Debug => 0 || 1,
});
as arguments of the subroutine. This custom tag
technology can be used to extend a web developer's abilities
to add dynamic pieces without having to visibly use
<% %> style code entries.
So, lets say that you have a table that
you want to insert for an employee with contact
info and the like, you could set up a tag like:
<my:new-employee name="Jane" last="Doe" phone="555-2222">
Jane Doe has been here since 1998.
Chances are that you will find yourself doing the same thing repeatedly
in each of your web application's scripts. You can use Script_OnStart
and Script_OnEnd to automate these routine tasks. These events are
called before and after each script request.
For example, let's say you have a header & footer you would like to
include in the output of every page, then you might:
# global.asa
sub Script_OnStart {
$Response->Include('header.inc');
}
sub Script_OnEnd {
$Response->Include('footer.inc');
}
Or let's say you want to initialize a global database connection
for use in your scripts:
# global.asa
use Apache::DBI; # automatic persistent database connections
use DBI;
<a href=http://www.conceptonline.com><img src=concept_online.gif border=0></a>
=end html
I would like to say that your ASP module rocks :-) We have practically stopped developing in anything else about half a year ago, and are now using Apache::ASP extensively. I just love Perl, and whereever we are not "forced" to use JSP, we chose ASP....
-- Csongor Fagyal, Concept Online Ltd.
=item WebTime
-- Grégoire Lejeune
=item David Kulp
First, I just want to say that I am very very impressed with Apache::ASP. I
just want to gush with praise after looking at many other implementations of
perl embedded code and being very underwhelmed. This is so damn slick and
clean. Kudos! ...
... I'm very pleased how quickly I've been able to mock
view all matches for this distribution
view release on metacpan or search on metacpan
# Please enter your username and password (default message).
# Incorrect Password.
# Incorrect Username (although some say this isn't a good idea, it can
be easily changed to Incorrect Login for the password and username).
# ERROR! Your session has expired, or your login does not have the proper
access level for this webpage.
view all matches for this distribution
view release on metacpan or search on metacpan
AuthNetLDAP.pm view on Meta::CPAN
require valid-user
PerlAuthenHandler Apache::AuthNetLDAP
If you don't have mod_perl or Net::LDAP installed on your system, then the Makefile will prompt you to
install each of these modules. At this time, March 8, 2004, you may say yes to Net::LDAP, and yes for
mod_perl, if you are installing this module on apache 1.3. (The reason being, that mod_perl 2 is under
development, and is not ready for download from CPAN at this time. Therefore, your install of mod_perl,
as initiated with the Makefile.PL, will fail. If you are going to install mod_perl 2, which is needed
to work with Apache2, you will need to download it from: http://perl.apache.org/download/index.html.
(Installation is beyond the scope of this document, but you can find documentation at:
view all matches for this distribution
view release on metacpan or search on metacpan
AuthenNIS.pm view on Meta::CPAN
establishing whether the already authenticated user is a member of one of
the indicated groups in the B<require group> directive. This process may
be handled by B<Apache::AuthzNIS>.
I welcome any feedback on this module, esp. code improvements, given
that it was written hastily, to say the least.
= head3 Parameters
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
AuthenPasswd.pm view on Meta::CPAN
process may be handled by B<Apache::AuthzPasswd>. Admittedly, AuthzPasswd
is a misnomer, but I wanted to keep AuthenPasswd and AuthzPasswd related,
if only by name.
I welcome any feedback on this module, esp. code improvements, given
that it was written hastily, to say the least.
=head1 AUTHOR
Demetrios E. Paneras <dep@media.mit.edu> and Shannon Eric Peevey <speeves@unt.edu>
view all matches for this distribution
view release on metacpan or search on metacpan
Auth/RCS/Makefile.old,v view on Meta::CPAN
TEST_F = test -f
TOUCH = touch
UMASK_NULL = umask 0
DEV_NULL = > /dev/null 2>&1
# The following is a portable way to say mkdir -p
# To see which directories are created, change the if 0 to if 1
MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
# This helps us to minimize the effect of the .exists files A yet
# better solution would be to have a stable file in the perl
view all matches for this distribution
view release on metacpan or search on metacpan
AuthzNIS.pm view on Meta::CPAN
establishing whether the already authenticated user is a member of one of
the indicated groups in the B<require group> directive. This process may
be handled by B<Apache::AuthzNIS>.
I welcome any feedback on this module, esp. code improvements, given
that it was written hastily, to say the least.
=head1 AUTHOR
Demetrios E. Paneras <dep@media.mit.edu>
Ported by Shannon Eric Peevey <speeves@unt.edu>
view all matches for this distribution
view release on metacpan or search on metacpan
AuthzPasswd.pm view on Meta::CPAN
process may be handled by B<Apache::AuthzPasswd>. Admittedly, AuthzPasswd
is a misnomer, but I wanted to keep AuthenPasswd and AuthzPasswd related,
if only by name.
I welcome any feedback on this module, esp. code improvements, given
that it was written hastily, to say the least.
=head1 AUTHOR
Demetrios E. Paneras <dep@media.mit.edu>
and Shannon Eric Peevey <speeves@unt.edu>
view all matches for this distribution