view release on metacpan or search on metacpan
t/Email-Address-XS.t view on Meta::CPAN
local $Test::Builder::Level = $Test::Builder::Level + 1;
fail('following test does not throw warning');
warn $_[0];
};
sub with_warning(&) {
my ($code) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $warn;
local $SIG{__WARN__} = sub { $warn = 1; };
my @ret = wantarray ? $code->() : scalar $code->();
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/above-0xFF.t view on Meta::CPAN
use warnings;
use Test::More tests => 7;
use Email::Simple;
sub get_warning(&) {
my $message;
local $SIG{__WARN__} = sub { $message = $_[0] unless $message };
$_[0]->();
return $message;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Enbld.pm view on Meta::CPAN
foreach my $file ( sort keys %rcfile_result ) {
Enbld::Message->notify( $rcfile_result{$file} );
}
}
sub build(&) {
return $_[0];
}
our $condition_ref;
lib/Enbld.pm view on Meta::CPAN
$target_collection{$targetname} = $condition;
undef $condition_ref;
}
sub define(&) {
my $coderef = shift;
return $coderef;
}
lib/Enbld.pm view on Meta::CPAN
$rcfile->filepath . ' is not created.';
return;
}
sub load(&) {
$rcfile_condition->{command} = 'load';
return $_[0];
}
sub set(&) {
$rcfile_condition->{command} = 'set';
return $_[0];
}
sub copy(&) {
$rcfile_condition->{command} = 'copy';
return $_[0];
}
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
use strict;
use Encode qw(decode_utf8 FB_CROAK find_encoding decode);
use Test::More tests => 17;
use Test::Builder;
sub croak_ok(&) {
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $code = shift;
eval { $code->() };
like $@, qr/does not map/;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/EntityModel/Util.pm view on Meta::CPAN
Returns the transaction in list or scalar context, and in void
context will clean up the transaction automatically.
=cut
sub as_transaction(&;@) {
my $code = shift;
my %args = @_;
my $tran = EntityModel::Transaction->new;
$tran->run($code, %args);
# unless we're in void context, pass the transaction back for something else
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Error/Tiny.pm view on Meta::CPAN
use Error::Tiny::Exception;
use Error::Tiny::Catch;
use Error::Tiny::Then;
sub try(&;@) {
my ($try, @handlers) = @_;
my $wantarray = wantarray;
my @ret;
lib/Error/Tiny.pm view on Meta::CPAN
};
return $wantarray ? @ret : $ret[0];
}
sub catch(&;@) {
my ($class, $handler) =
@_ == 2 ? ($_[0], $_[1]->handler) : ('Error::Tiny::Exception', $_[0]);
Error::Tiny::Catch->new(handler => $handler, class => $class);
}
sub then(&;@) {
my ($handler, $subhandler) = @_;
(Error::Tiny::Then->new(handler => $handler), $subhandler);
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/08warndie.t view on Meta::CPAN
# Most of these tests are fatal, and print data on STDERR. We therefore use
# this testing function to run a CODEref in a child process and captures its
# STDERR and note whether the CODE block exited
my ( $s, $felloffcode );
my $linekid = __LINE__ + 15; # the $code->() is 15 lines below this one
sub run_kid(&)
{
my ( $code ) = @_;
# Win32's fork() emulation can't correctly handle the open("-|") case yet
# So we'll implement this manually - inspired by 'perldoc perlfork'
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Event/Wrappable.pm view on Meta::CPAN
$storage->{'id'} = ++ $LAST_ID;
return $event;
}
sub event(&) {
my( $raw_event ) = @_;
my $event = clone_sub $raw_event;
if ( @EVENT_WRAPPERS ) {
for (reverse @EVENT_WRAPPERS) {
$event = $_->($event);
view all matches for this distribution
view release on metacpan or search on metacpan
Resumable.pm view on Meta::CPAN
require Exporter;
@ISA = 'Exporter';
@EXPORT = qw(handle raise);
sub handle(&@)
{
my $body = shift;
local @LAST_CATCH = @CATCH;
local @CATCH = (@_, @CATCH);
local (@_);
view all matches for this distribution
view release on metacpan or search on metacpan
t/must_die.pl view on Meta::CPAN
sub must_die(&$$) {
my ( $sub, $re, $name, $passed ) =
( @_, 0 );
local $SIG{__WARN__}=sub { 1; };
my $msg;
local $SIG{__DIE__} =sub { $msg = "@_"; die "@_"; };
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/ExtJS/AutoForm/Moose/Types.pm view on Meta::CPAN
our %REGISTRY = ();
#
# SYNTAX CURRY
#
sub extjs(&) { { template => $_[0] } }
sub reflect($$;$) {
my $type_name = shift;
my %p = map { %{$_} } @_; #really useless here. done this way since I was hoping to extend own Moose (sub)type sugar
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Test/LivesOK.pm view on Meta::CPAN
our @EXPORT = qw/lives_ok/;
use Test::Builder;
my $builder = Test::Builder->new;
sub lives_ok(&@) {
my ($sub, $desc) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $success = eval {
$sub->();
1;
view all matches for this distribution
view release on metacpan or search on metacpan
}
$tie->{$cfgvar} = $val;
}
sub extutils_cxx(&) {
my ($cb) = @_;
# make sure these exist
@Config{qw(cc ld)};
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/MakeMaker/Test/Utils.pm view on Meta::CPAN
Returns the return value of the given code.
=cut
sub in_dir(&;$) {
my $code = shift;
require File::Temp;
my $dir = shift || File::Temp::tempdir(TMPDIR => 1, CLEANUP => 1);
# chdir to the new directory
my $orig_dir = getcwd();
view all matches for this distribution
view release on metacpan or search on metacpan
t/95benchmark.t view on Meta::CPAN
# This "test" never fails, but prints a benchmark comparison between two
# mathematically-identical functions, one with Faster::Maths and one without
use Time::HiRes qw( gettimeofday tv_interval );
sub measure(&)
{
my ( $code ) = @_;
my $start = [ gettimeofday ];
$code->();
return tv_interval $start;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/ConfigDir.pm view on Meta::CPAN
);
eval "use List::MoreUtils qw/distinct/;"; ## no strict (BuiltinFunctions::ProhibitStringyEval)
__PACKAGE__->can("distinct") or eval <<'EOP';
# from PP part of List::MoreUtils
sub distinct(&@) {
my %h;
map { $h{$_}++ == 0 ? $_ : () } @_;
}
EOP
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/File/KDBX/Util.pm view on Meta::CPAN
return !!eval { File::KDBX::XS->VERSION($version); 1 };
}
}
sub assert(&) { ## no critic (ProhibitSubroutinePrototypes)
return if !DEBUG;
my $code = shift;
return if $code->();
(undef, my $file, my $line) = caller;
view all matches for this distribution
view release on metacpan or search on metacpan
recursive
);
our $VERSION = '0.10';
sub recursive(&@) {
my ($code, $src, $dst) = @_;
my @src = File::Spec->splitdir($src);
pop @src unless defined $src[$#src] and $src[$#src] ne '';
my $src_level = @src;
find({ wanted => sub {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Path/Stderr.pm view on Meta::CPAN
sub File::Path::Stderr::End::DESTORY {
my $self = shift;
return $self->();
}
sub _with_stdderr(&) {
# remember what file handle was selected
my $old = select();
# select STDERR instead
select(STDERR);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Slurp.pm view on Meta::CPAN
# edit a file as a scalar in $_
*ef = \&edit_file ;
sub edit_file(&$;$) {
my( $edit_code, $file_name, $opts ) = @_ ;
$opts = {} unless ref $opts eq 'HASH' ;
# my $edit_code = shift ;
lib/File/Slurp.pm view on Meta::CPAN
return $write_result ;
}
*efl = \&edit_file_lines ;
sub edit_file_lines(&$;$) {
my( $edit_code, $file_name, $opts ) = @_ ;
$opts = {} unless ref $opts eq 'HASH' ;
# my $edit_code = 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
lib/FindApp/Object/State/Group/Class.pm view on Meta::CPAN
my($type) = @_;
no strict "refs";
return sibpackage("State::\U$type")->();
}
sub type_map(&@) {
my $code = shift;
return map { &$code } +dir_types, @_;
}
sub dir_fields() {
my $fields = [ type_map{dir_field} ];
return @$fields;
}
sub field_map(&@) {
my $code = shift;
return map { &$code } +dir_fields, @_;
}
use namespace::clean;
view all matches for this distribution