diff options
author | 2019-02-13 21:15:00 +0000 | |
---|---|---|
committer | 2019-02-13 21:15:00 +0000 | |
commit | 9f11ffb7133c203312a01e4b986886bc88c7d74b (patch) | |
tree | 6618511204c614b20256e4ef9dea39a7b311d638 /gnu/usr.bin/perl/cpan/autodie/t/lib/Hints_pod_examples.pm | |
parent | Import perl-5.28.1 (diff) | |
download | wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.tar.xz wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.zip |
Fix merge issues, remove excess files - match perl-5.28.1 dist
looking good sthen@, Great! bluhm@
Diffstat (limited to 'gnu/usr.bin/perl/cpan/autodie/t/lib/Hints_pod_examples.pm')
-rw-r--r-- | gnu/usr.bin/perl/cpan/autodie/t/lib/Hints_pod_examples.pm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gnu/usr.bin/perl/cpan/autodie/t/lib/Hints_pod_examples.pm b/gnu/usr.bin/perl/cpan/autodie/t/lib/Hints_pod_examples.pm index 05db908e181..72a58a5ce57 100644 --- a/gnu/usr.bin/perl/cpan/autodie/t/lib/Hints_pod_examples.pm +++ b/gnu/usr.bin/perl/cpan/autodie/t/lib/Hints_pod_examples.pm @@ -17,17 +17,17 @@ use autodie::hints; sub AUTODIE_HINTS { return { # Scalar failures always return undef: - undef_scalar => { fail => undef }, + undef_scalar => { fail => sub { !defined($_[0]) } }, # Scalar failures return any false value [default behaviour]: false_scalar => { fail => sub { return ! $_[0] } }, # Scalar failures always return zero explicitly: - zero_scalar => { fail => '0' }, + zero_scalar => { fail => sub { defined($_[0]) && $_[0] eq '0' } }, # List failures always return empty list: # We never want these called in a scalar context - empty_list => { scalar => sub { 1 }, list => [] }, + empty_list => { scalar => sub { 1 }, list => sub { !@_ } }, # List failures return C<()> or C<(undef)> [default expectation]: default_list => { fail => sub { ! @_ || @_ == 1 && !defined $_[0] } }, @@ -54,8 +54,8 @@ sub undef_n_error_list { return wantarray ? @_ : $_[0] } autodie::hints->set_hints_for( \&foo, { - scalar => 0, - list => [0], + scalar => sub { defined($_[0]) && $_[0] == 0 }, + list => sub { @_ == 1 && defined($_[0]) && $_[0] == 0 }, } ); @@ -67,7 +67,7 @@ autodie::hints->set_hints_for( \&re_fail, { scalar => qr/^ _? FAIL $/xms, - list => [-1], + list => sub { @_ == 1 && $_[0] eq -1 }, } ); @@ -77,8 +77,8 @@ sub re_fail { return wantarray ? @_ : $_[0] } autodie::hints->set_hints_for( \&bar, { - scalar => 0, - list => [0], + scalar => sub { defined($_[0]) && $_[0] == 0 }, + list => sub { @_ == 1 && defined($_[0]) && $_[0] == 0 }, } ); |