view release on metacpan or search on metacpan
lib/AnyEvent/Collect.pm view on Meta::CPAN
my @cvs;
sub collect_all(&) {
my( $todo ) = @_;
my $cv = AE::cv;
Event::Wrappable->wrap_events( $todo, sub {
my( $listener ) = @_;
$cv->begin;
lib/AnyEvent/Collect.pm view on Meta::CPAN
} );
$cv->recv;
}
*collect = *collect_all;
sub collect_any(&) {
my( $todo ) = @_;
my $cv = AE::cv;
Event::Wrappable->wrap_events( $todo, sub {
my( $listener ) = @_;
return sub { $listener->(@_); $cv->send };
view all matches for this distribution
view release on metacpan or search on metacpan
use Data::Dump 'pp';
my $couch = couch();
my $bad = couch('http://bad/');
my $done = AnyEvent->condvar;
sub p(&) {
$done->begin;
my $code = shift;
my $data;
eval { $data = $code->(); };
if ($@) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
use Test::More;
use Test::Requires qw(DBD::SQLite);
use AnyEvent::DBI::Abstract;
sub sync(&;&) {
my $block = shift;
my $cb = shift;
my $cv = AnyEvent->condvar;
$cv->cb(sub { $cb->($_[0]->recv) }) if $cb;
$block->($cv);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/DNS/EtcHosts.pm view on Meta::CPAN
}
}
}
# helper function - unless dns delivered results, check and parse hosts, then call continuation code
sub _load_hosts_unless(&$@) {
my ($cont, $cv, @dns) = @_;
if (@dns) {
$cv->end;
} else {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Future.pm view on Meta::CPAN
For a full description on how to use Futures, see the L<Future> documentation.
=cut
# Forward
sub as_future(&);
=head1 CONSTRUCTORS
=cut
lib/AnyEvent/Future.pm view on Meta::CPAN
completion, and which will return a watcher object reference that needs to be
stored somewhere.
=cut
sub as_future(&)
{
my ( $code ) = @_;
my $f = AnyEvent::Future->new;
lib/AnyEvent/Future.pm view on Meta::CPAN
$w = CODE->( $done_cb, $fail_cb )
=cut
sub as_future_cb(&)
{
my ( $code ) = @_;
&as_future( sub {
my $f = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
use File::Which qw(which);
use base qw(Exporter);
our @EXPORT = qw(test_redis);
sub test_redis(&;$) {
my $cb = shift;
my $args = shift;
my $redis_server = which 'redis-server';
unless ($redis_server && -e $redis_server && -x _) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
};
};
=cut
sub psub(&) {
my $cb = shift;
my $port = $SELF
or Carp::croak "psub can only be called from within rcv or psub callbacks, not";
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Test/AE/MC.pm view on Meta::CPAN
*{caller().'::runtest'} = \&runtest;
@_ = 'Test::More';
goto &{ Test::More->can('import') };
}
sub runtest(&) {
my $cx = shift;
my $code = sub {
alarm 10;
eval {
$cx->(@_,noreply => 1, cas => 1);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
use AnyEvent;
use Test::More;
our @EXPORT = qw(run_event_loop el_subtest);
sub run_event_loop(&@) {
my ( $code, %args ) = @_;
my $timeout = defined $args{timeout}? $args{timeout}: 10;
my $cv = AE::cv;
my $tmer;
view all matches for this distribution
view release on metacpan or search on metacpan
use FindBin;
use base qw(Exporter);
our @EXPORT = qw(test_redis);
sub test_redis(&;$) {
my $cb = shift;
my $args = shift;
chomp(my $redis_server = `which redis-server`);
unless ($redis_server && -e $redis_server && -x _) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
Watchdog/Util.pm view on Meta::CPAN
$? = $EXIT_STATUS;
}
}
sub on_exit(&) {
unless ($AnyEvent::Watchdog::end) {
$AnyEvent::Watchdog::end = \&_exit;
push @ON_EXIT, $_[0];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aozora2Epub/XHTML/Tree.pm view on Meta::CPAN
my ($self, $selector) = @_;
$selector = _selector($selector);
return [ $self->_result->findnodes($selector) ];
}
sub _apply(&$) { ## no critic (ProhibitSubroutinePrototypes)
_apply0(@_);
}
sub _apply0 {
my ($sub, $elem) = @_;
lib/Aozora2Epub/XHTML/Tree.pm view on Meta::CPAN
return $sub->($elem);
}
return $elem;
}
sub _map_apply(&@) { ## no critic (ProhibitSubroutinePrototypes)
my ($sub, @nodes) = @_;
return map { _apply0($sub, $_) } @nodes;
}
sub _result {
view all matches for this distribution
view release on metacpan or search on metacpan
t/01fuses.t view on Meta::CPAN
use Test::More;
use App::AVR::Fuses;
sub capture(&)
{
my $code = shift;
open my $fh, ">", \my $output;
my $was_outfh = select;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
t/app-codeowners.t view on Meta::CPAN
# Set progname so that pod2usage knows how to find the script after we chdir.
$0 = path($Bin)->parent->child('bin/git-codeowners')->absolute->stringify;
$ENV{NO_COLOR} = 1;
sub run(&) { ## no critic (Subroutines::ProhibitSubroutinePrototypes)
my $code = shift;
capture { exit_code { $code->() } };
}
subtest 'basic options' => sub {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Colorist/Ruleset.pm view on Meta::CPAN
as_is => [ qw( ruleset rule ) ],
);
our $BUILDING_RULESET;
sub ruleset(&) {
my $code = shift;
$BUILDING_RULESET = [];
$code->();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Getconf.pm view on Meta::CPAN
Subroutine should return C<TRUE> when option value should be accepted,
C<FALSE> otherwise.
=cut
sub opt_sub(&) {
my ($sub) = @_;
return opt { check => $sub };
}
view all matches for this distribution