view release on metacpan or search on metacpan
HTPL-modules/lib/HTML/HTPL/Lib.pm view on Meta::CPAN
return 1 unless (-f $file1);
return undef unless (-f $file2);
&lastmodified($file1) > &lastmodified($file2);
}
sub capture(&) {
my $sub = shift;
my $hnd = select;
my $out = "CAP" . ++$htpl_capture;
my $new = eval("\*$out");
tie $new, 'HTML::HTPL::Stream';
view all matches for this distribution
view release on metacpan or search on metacpan
t/Exception.pm view on Meta::CPAN
use Exporter;
use base qw/Exporter/;
our @EXPORT = qw/throws_ok lives_ok/;
sub throws_ok(&$) {
eval { $_[0]->() };
::like($@, $_[1]);
}
sub lives_ok(&;$) {
eval { $_[0]->() };
::ok(!$@, $_[1]);
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
Mpp/BuildCacheControl.pm view on Meta::CPAN
=cut
our $blend;
my $blendopt = ['b', qr/blend(?:[-_]?groups?)?/, \$blend];
sub ARGVgroups(&) {
unless( @ARGV ) {
-f $Mpp::BuildCache::options_file
or die "$0: no build cache directories given and not in one\n";
@ARGV = '.';
}
Mpp/BuildCacheControl.pm view on Meta::CPAN
=cut
our( @lstats, @combined_lstat );
our $clean_empty;
sub groupfind(&;$) {
my( $code, $try ) = @_;
my $top = 1 unless defined $try;
my( @dirs, @contents );
@dirs = map $top ? $_->{DIRNAME} : "$_->{DIRNAME}/$try", @group;
for( @dirs ) {
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;
diag 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;
diag 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
Pake/Syntax.pm view on Meta::CPAN
die "couldn't run $file" unless $return;
}
}
#--------------------------------------------------
sub task(&@) {
my $code = shift;
my %dependencies = @_;
for my $task_name (keys(%dependencies)){
my $task = Pake::Task->new($code,$task_name,$dependencies{$task_name});
}
}
#--------------------------------------------------
sub file(&@) {
my $code = shift;
my %dependencies = @_;
for my $task_name (keys(%dependencies)){
my $task = Pake::FileTask->new($code,$task_name,$dependencies{$task_name});
}
}
#--------------------------------------------------
sub rule(&@) {
my $code = shift;
my %rules = @_;
for my $outname (keys(%rules)){
my $rule = Pake::Rule->new($outname, $rules{$outname}, $code);
}
}
#--------------------------------------------------
sub directory(&@){
my $code = shift;
my %dependencies = @_;
for my $directory (keys(%dependencies)){
my $task = Pake::Directory->new($code,$directory,$dependencies{$directory});
}
}
#--------------------------------------------------
sub multi_task(&@) {
my $code = shift;
my %dependencies = @_;
for my $task_name (keys(%dependencies)){
my $task = Pake::MultiTask->new($code,$task_name,$dependencies{$task_name});
view all matches for this distribution
view release on metacpan or search on metacpan
cpan/ExtUtils-MakeMaker/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
lib/perl5i/2.pm view on Meta::CPAN
return CORE::lstat($_[0]) if wantarray;
return File::stat::lstat(@_);
}
sub capture(&;@) {
my($code, %opts) = @_;
# valid options
state $valid_options = { map { $_ => 1 } qw(merge tee) };
view all matches for this distribution
view release on metacpan or search on metacpan
{
my $index = $_[0]+1;
bless { arity=>0, impl=>sub{$_[$index]} };
}
sub hosub(&@)
{
# WRITE THIS
}
sub call
{
my ($self,@args) = @_;
return $self->{impl}->(0,@args);
}
sub meta_bop(&)
{
my ($op) = @_;
sub
{
my ($left, $right, $reversed) = @_;
}
};
};
}
sub meta_uop(&)
{
my ($op) = @_;
sub
{
my ($left) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
my @backup_sym_table;
my $input;
my $cur_file = '-';
$debug = 0;
sub debug(&) {
my $fn = shift;
print STDERR "\t".&$fn()
if $debug;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/qbit/Exceptions.pm view on Meta::CPAN
@EXPORT = qw(try catch with finally throw);
@EXPORT_OK = @EXPORT;
}
sub try(&;$) {
my ($sub, $catch) = @_;
eval {$sub->()};
my $cur_catch = $catch;
lib/qbit/Exceptions.pm view on Meta::CPAN
$cur_catch->[1]($first_exception) if defined($cur_catch);
die $@ if $@ && !$find_catch;
}
sub catch(&;$) {
return [Exception => @_];
}
sub with(&;$) {
return @_;
}
sub finally(&;$) {
if (defined($_[1])) {die("Expected semicolon after finally block (" . join(", ", (caller())[1, 2]) . ")\n");}
return ['::FINALLY::' => @_];
}
sub throw($) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/threads/lite.pm view on Meta::CPAN
}
}
## no critic (Subroutines::RequireArgUnpacking,Subroutines::ProhibitSubroutinePrototypes)
sub receive(&) {
my $receive = shift;
my @save;
my $i = 0;
MESSAGE:
lib/threads/lite.pm view on Meta::CPAN
return _return_elements($message);
}
}
}
sub receive_nb(&) {
my $receive = shift;
my @save;
my $i = 0;
MESSAGE:
view all matches for this distribution
view release on metacpan or search on metacpan
t/04-warns.t view on Meta::CPAN
my $unopened = 10;
open my $closed, '>', \(my $o = "");close $closed;
open my $raw, '>:raw', \(my $x = "");
sub test_warn_die(&;@) {
my $code = shift;
my $name = shift;
my $warn = 0;
my $die = 0;
local $SIG{__WARN__} = sub {
t/04-warns.t view on Meta::CPAN
ok !$rc, "$name - eval failed";
ok $e, "$name - have error" and DIAG and diag $e;
}
sub test_no_warn(&;@) {
my $code = shift;
my $name = shift;
my $warn = 0;
local $SIG{__WARN__} = sub {
$warn = 1;
view all matches for this distribution
view release on metacpan or search on metacpan
urpm/util.pm view on Meta::CPAN
my @sstat = stat $f1;
my @lstat = stat $f2;
$sstat[7] == $lstat[7] && $sstat[9] == $lstat[9];
}
sub partition(&@) {
my $f = shift;
my (@a, @b);
foreach (@_) {
$f->($_) ? push(@a, $_) : push(@b, $_);
}
urpm/util.pm view on Meta::CPAN
sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }
sub cat_ { my @l = map { my $F; open($F, '<', $_) ? <$F> : () } @_; wantarray() ? @l : join '', @l }
sub cat_utf8 { my @l = map { my $F; open($F, '<:utf8', $_) ? <$F> : () } @_; wantarray() ? @l : join '', @l }
sub wc_l { my $F; open($F, '<', $_[0]) or return; my $count = 0; while (<$F>) { $count++ } $count }
sub uniq_(&@) {
my $f = shift;
my %l;
$l{$f->($_)} = 1 foreach @_;
grep { delete $l{$f->($_)} } @_;
}
urpm/util.pm view on Meta::CPAN
rename($file, "$file$o_backup_ext") or return if $o_backup_ext;
rename("$file.new", $file) or return;
1;
}
sub find(&@) {
my $f = shift;
$f->($_) and return $_ foreach @_;
undef;
}
sub any(&@) {
my $f = shift;
$f->($_) and return 1 foreach @_;
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;
diag 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