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
examples/lib/MyTags.pm view on Meta::CPAN
use parent 'Exporter';
our @EXPORT = qw/ my_img /;
sub my_img(&) { render_tag( 'img', sub {
die "img needs a 'src'" unless $_[0]->{src};
}, shift ) };
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Template/Declare/Bricolage.pm view on Meta::CPAN
attr { xmlns => $ns };
$code->();
}
};
sub bricolage(&) {
Template::Declare->init( roots => [__PACKAGE__] );
Template::Declare->show( go => shift );
}
sub import {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Template/Lace/Utils.pm view on Meta::CPAN
use Template::Lace::ComponentCallback;
our @EXPORT_OK = (qw/mk_component/);
our %EXPORT_TAGS = (All => \@EXPORT_OK, ALL => \@EXPORT_OK);
sub mk_component(&) { return Template::Lace::ComponentCallback->new(@_) }
1;
=head1 NAME
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
lib/Template/Plugin/ListMoreUtils.pm view on Meta::CPAN
=head2 any BLOCK LIST
=cut
sub any(&\@) { List::MoreUtils::any( \&{ $_[0] }, @{ $_[1] } ); }
=head2 all BLOCK LIST
=cut
sub all(&\@) { List::MoreUtils::all( \&{ $_[0] }, @{ $_[1] } ); }
=head2 none BLOCK LIST
=cut
sub none(&\@) { List::MoreUtils::none( \&{ $_[0] }, @{ $_[1] } ); }
=head2 notall BLOCK LIST
=cut
sub notall(&\@) { List::MoreUtils::notall( \&{ $_[0] }, @{ $_[1] } ); }
=head2 any_u BLOCK LIST
=cut
sub any_u(&\@) { List::MoreUtils::any_u( \&{ $_[0] }, @{ $_[1] } ); }
=head2 all_u BLOCK LIST
=cut
sub all_u(&\@) { List::MoreUtils::all_u( \&{ $_[0] }, @{ $_[1] } ); }
=head2 none_u BLOCK LIST
=cut
sub none_u(&\@) { List::MoreUtils::none_u( \&{ $_[0] }, @{ $_[1] } ); }
=head2 notall_u BLOCK LIST
=cut
sub notall_u(&\@) { List::MoreUtils::notall_u( \&{ $_[0] }, @{ $_[1] } ); }
=head2 true BLOCK LIST
=cut
sub true(&\@) { List::MoreUtils::true( \&{ $_[0] }, @{ $_[1] } ); }
=head2 false BLOCK LIST
=cut
sub false(&\@) { List::MoreUtils::false( \&{ $_[0] }, @{ $_[1] } ); }
=head2 firstidx BLOCK LIST
=head2 first_index BLOCK LIST
=cut
sub firstidx(&\@) { List::MoreUtils::firstidx( \&{ $_[0] }, @{ $_[1] } ); }
*first_index = *{'firstidx'}{CODE};
=head2 lastidx BLOCK LIST
=head2 last_index BLOCK LIST
=cut
sub lastidx(&\@) { List::MoreUtils::lastidx( \&{ $_[0] }, @{ $_[1] } ); }
*last_index = *{'lastidx'}{CODE};
=head2 onlyidx BLOCK LIST
=head2 only_index BLOCK LIST
=cut
sub onlyidx(&\@) { List::MoreUtils::onlyidx( \&{ $_[0] }, @{ $_[1] } ); }
*only_index = *{'onlyidx'}{CODE};
=head2 firstres BLOCK LIST
=head2 first_result BLOCK LIST
=cut
sub firstres(&\@) { List::MoreUtils::firstres( \&{ $_[0] }, @{ $_[1] } ); }
*first_result = *{'firstres'}{CODE};
=head2 lastres BLOCK LIST
=head2 last_result BLOCK LIST
=cut
sub lastres(&\@) { List::MoreUtils::lastres( \&{ $_[0] }, @{ $_[1] } ); }
*last_result = *{'lastres'}{CODE};
=head2 onlyres BLOCK LIST
=head2 only_result BLOCK LIST
=cut
sub onlyres(&\@) { List::MoreUtils::onlyres( \&{ $_[0] }, @{ $_[1] } ); }
*only_result = *{'onlyres'}{CODE};
=head2 firstval BLOCK LIST
=head2 first_value BLOCK LIST
=cut
sub firstval(&\@) { List::MoreUtils::firstval( \&{ $_[0] }, @{ $_[1] } ); }
*first_value = *{'firstval'}{CODE};
=head2 lastval BLOCK LIST
=head2 last_value BLOCK LIST
=cut
sub lastval(&\@) { List::MoreUtils::lastval( \&{ $_[0] }, @{ $_[1] } ); }
*last_value = *{'lastval'}{CODE};
=head2 onlyval BLOCK LIST
=head2 only_value BLOCK LIST
=cut
sub onlyval(&\@) { List::MoreUtils::onlyval( \&{ $_[0] }, @{ $_[1] } ); }
*only_value = *{'onlyval'}{CODE};
=head2 insert_after BLOCK VALUE LIST
=cut
lib/Template/Plugin/ListMoreUtils.pm view on Meta::CPAN
=head2 apply BLOCK LIST
=cut
sub apply(&\@) { List::MoreUtils::apply( \&{ $_[0] }, @{ $_[1] } ); }
=head2 after BLOCK LIST
=cut
sub after(&\@) { List::MoreUtils::after( \&{ $_[0] }, @{ $_[1] } ); }
=head2 after_incl BLOCK LIST
=cut
sub after_incl(&\@) { List::MoreUtils::after_incl( \&{ $_[0] }, @{ $_[1] } ); }
=head2 before BLOCK LIST
=cut
sub before(&\@) { List::MoreUtils::before( \&{ $_[0] }, @{ $_[1] } ); }
=head2 before_incl BLOCK LIST
=cut
sub before_incl(&\@) { List::MoreUtils::before_incl( \&{ $_[0] }, @{ $_[1] } ); }
=head2 indexes BLOCK LIST
=cut
sub indexes(&\@) { List::MoreUtils::indexes( \&{ $_[0] }, @{ $_[1] } ); }
=head2 pairwise BLOCK LIST LIST
Unlike the original C<pairwise>, both variables are given through C<@_>.
Template::Toolkit uses eval to evaluate the perl code declared there and
passes neither C<$a> nor C<$b> (which sounds reasonable to me).
=cut
sub pairwise(&\@\@)
{
my $userfn = $_[0];
List::MoreUtils::pairwise( sub { &{$userfn}( $a, $b ); }, @{ $_[1] }, @{ $_[2] } );
}
lib/Template/Plugin/ListMoreUtils.pm view on Meta::CPAN
=head2 part BLOCK LIST
=cut
sub part(&\@) { List::MoreUtils::part( \&{ $_[0] }, @{ $_[1] } ) }
=head2 bsearch BLOCK LIST
=cut
sub bsearch(&\@)
{
my $user_fn = $_[0];
List::MoreUtils::bsearch( sub { $user_fn->($_) }, @{ $_[1] } );
}
lib/Template/Plugin/ListMoreUtils.pm view on Meta::CPAN
=head2 bsearch_index BLOCK LIST
=cut
sub bsearchidx(&\@)
{
my $user_fn = $_[0];
List::MoreUtils::bsearchidx( sub { $user_fn->($_) }, @{ $_[1] } );
}
*bsearch_index = *{'bsearchidx'}{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
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
lib/Template/Refine/Utils.pm view on Meta::CPAN
$node->removeChildNodes;
$node->addChild( XML::LibXML::Text->new( $text ) );
return $node;
}
sub simple_replace(&$) {
my ($code, $xpath) = @_;
return Template::Refine::Processor::Rule->new(
selector => Template::Refine::Processor::Rule::Select::XPath->new(
pattern => $xpath,
),
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/Teng/Schema/Declare.pm view on Meta::CPAN
sub pk(@);
sub columns(@);
sub name ($);
sub row_class ($);
sub inflate_rule ($@);
sub table(&) {
my $code = shift;
my $current = _current_schema();
my (
$table_name,
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_color.t view on Meta::CPAN
use constant {
RESET => "\e[m\e[K",
};
sub rgb24(&) {
my $sub = shift;
local $Term::ANSIColor::Concise::RGB24 = 1;
$sub->();
}
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/Term/Table/Util.pm view on Meta::CPAN
my $IO;
BEGIN {
open($IO, '>&', *STDOUT) or die "Could not clone STDOUT";
}
sub try(&) {
my $code = shift;
local ($@, $?, $!);
my $ok = eval { $code->(); 1 };
my $err = $@;
return ($ok, $err);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/Base/SubTest.pm view on Meta::CPAN
no warnings 'once';
*filters = \&Test::Base::Less::filters;
*register_filter = \&Test::Base::Less::register_filter;
}
sub run(&) {
my $code = shift;
my $content = _get_data_section();
my $node = Text::TestBase::SubTest->new->parse($content);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/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
lib/Test/Chunks.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$actual, \$expected);
}
}
sub run(&) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $chunk (@{$self->chunk_list}) {
$chunk->run_filters unless $chunk->is_filtered;
&{$callback}($chunk);
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/Test/Deep/Cond.pm view on Meta::CPAN
use Test::Deep::Cmp;
use Exporter::Lite;
our @EXPORT = qw(cond);
sub cond(&) {
my ($code) = @_;
__PACKAGE__->new($code);
}
sub init {
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Test/Differences/TestUtils/Capture.pm view on Meta::CPAN
our @EXPORT = qw(capture_error);
use Capture::Tiny qw(capture);
sub capture_error(&) {
my $sub = shift;
my($stdout, $stderr) = capture { $sub->() };
$stderr =~ s/^\s+//; # see https://github.com/Ovid/Test-Differences/issues/15
return $stderr;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/Easy/DataDriven.pm view on Meta::CPAN
use Hash::MostUtils qw(lkeys);
use Functional::Utility qw(hook_run y_combinator);
our @EXPORT = qw(run_where each_ok);
sub assert(&;$) {
require Carp;
Carp::confess pop() if ! shift->();
}
sub run_where {
view all matches for this distribution
view release on metacpan or search on metacpan
use Exporter qw(import);
use List::MoreUtils qw(any all);
our @EXPORT_OK = qw(expect_fail expect_pass);
sub expect_fail(&;$) {
my ($code, $name) = @_;
my ($premature, @results) = run_tests($code);
ok((any { !$_->{ok} } @results),
'expect_fail' . (defined $name ? " - $name" : ''));
}
sub expect_pass(&;$) {
my ($code, $name) = @_;
my ($premature, @results) = run_tests($code);
ok((all { $_->{ok} } @results),
'expect_pass' . (defined $name ? " - $name" : ''));
}
view all matches for this distribution