?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/examples.zip
???????
PK ��[��zW uplevel-demo.plnu �[��� use strict; use warnings; use Sub::Uplevel; # subroutine A calls subroutine B with uplevel(), so when # subroutine B queries caller(), it gets main as the caller (just # like subroutine A) instead of getting subroutine A sub sub_a { print "Entering Subroutine A\n"; print "caller() says: ", join( ", ", (caller())[0 .. 2] ), "\n"; print "Calling B with uplevel\n"; uplevel 1, \&sub_b; } sub sub_b { print "Entering Subroutine B\n"; print "caller() says: ", join( ", ", (caller())[0 .. 2] ), "\n"; } sub_a(); PK ��["�=� � tee.plnu �[��� use strict; use warnings; use Capture::Tiny qw/capture tee/; print "Type some text. Type 'exit' to quit\n"; my ($out, $err) = tee { while (<>) { last if /^exit$/; print "Echoing to STDOUT: $_"; print STDERR "Echoing to STDERR: $_"; } }; print "\nCaptured STDOUT was:\n" . ( defined $out ? $out : 'undef' ); print "\nCaptured STDERR was:\n" . ( defined $err ? $err : 'undef' ); PK ��[�n�n n rt-58208.plnu �[��� use Capture::Tiny qw[ capture ]; my ( $out, $err ) = eval { capture { print STDERR "hello\n"; print STDOUT "there\n"; die("foo\n" ) } }; print STDERR "STDERR:\nout=$out\nerr=$err\n\$@=$@"; print STDOUT "STDOUT:\nout=$out\nerr=$err\n\$@=$@"; open FILE, '>ttt.log' or die( "error opening logfile\n" ); print FILE "FILE:\nout=$out\nerr=$err\n\$@=$@\n"; close FILE; PK ��[O�?�� � warning_like.tnu �[��� use strict; use warnings; # this test demonstrates the issue described in the main documentation, where # a test of the contents of a captured warning can inadvertently match another # part of the stack trace (the pattern argument to the test sub, itself!) use Test::More; use Test::Warnings ':all'; use Carp 'cluck'; sub warning_like(&$;$) { my ($code, $pattern, $name) = @_; like( &warning($code), $pattern, $name ); } warning_like(sub { cluck 'blah blah' }, qr/foo/, 'foo seems to appear in the warning'); # the test only passes when we invert it unlike( ( warning { cluck 'blah blah' } || '' ), qr/foo/, 'foo does NOT ACTUALLY appear in the warning', ); done_testing; PK ��[� sub.tnu �[��� use strict; use warnings; use Test::More tests => 4; use Test::Warnings ':all'; sub foo { is(1, 1, 'passing test'); had_no_warnings; warn 'this warning will cause a failure'; had_no_warnings; # failing test } foo; # END will generate a failing test too PK ��[N.E�m m test_nowarnings.tnu �[��� use strict; use warnings; use Test::More; use Test::NoWarnings 1.04 ':early'; pass('yay!'); done_testing; PK ��[`�M�K K synopsis_2.tnu �[��� use strict; use warnings; # this test demonstrates that we can capture warnings and test its contents, # and that captured warning will not fail the had-no-warnings test which is # added at the end use Test::More tests => 3; use Test::Warnings ':all'; pass('yay!'); like(warning { warn "oh noes!" }, qr/^oh noes/, 'we warned'); PK ��[��S*� � test_warning_contents.tnu �[��� use strict; use warnings; # this test demonstrates that warnings can be captured and tested, and other # expected warnings can be whitelisted, to allow the had-no-warnings test not # to fail use Test::More tests => 2; use Test::Warnings ':all'; use Test::Deep; my @lines; my @warnings = warnings { warn 'testing 1 2 3'; push @lines, __LINE__; warn 'another warning'; push @lines, __LINE__; }; my $file = __FILE__; cmp_deeply( \@warnings, [ "testing 1 2 3 at $file line $lines[0].\n", "another warning at $file line $lines[1].\n", ], 'successfully captured all warnings', ); # make these warnings visible allow_warnings; warn $_ foreach @warnings; allow_warnings(0); PK ��[�blƺ � synopsis_1.tnu �[��� use strict; use warnings; # this test demonstrates that Test::Warnings can play nicely with # Test::More::done_testing use Test::More; use Test::Warnings; pass('yay!'); done_testing; PK ��[1ʞ� � with_done_testing.tnu �[��� use strict; use warnings; # another demonstration of the various features of Test::Warnings, where # Test::More::done_testing is used use Test::More; use Test::Warnings ':all'; is(1, 1, 'passing test'); had_no_warnings; ok(!allowing_warnings, 'warnings are not currently allowed'); allow_warnings; ok(allowing_warnings, 'warnings are now allowed'); warn 'this warning will not cause a failure'; had_no_warnings; allow_warnings(0); ok(!allowing_warnings, 'warnings are not allowed again'); warn 'oh noes, something warned!'; # this will now fail. had_no_warnings; note 'we are done; call done_testing to signal completion. had_no_warnings will be called automatically.'; done_testing; PK ��[rz��? ? no_plan.tnu �[��� use strict; use warnings; use Test::More; use Test::Warnings ':all'; is(1, 1, 'passing test'); had_no_warnings; ok(!allowing_warnings, 'warnings are not currently allowed'); allow_warnings; ok(allowing_warnings, 'warnings are now allowed'); warn 'this warning will not cause a failure'; had_no_warnings; allow_warnings(0); ok(!allowing_warnings, 'warnings are not allowed again'); warn 'oh noes, something warned!'; # this will now fail. had_no_warnings; # had_no_warnings will be called automatically from END # done_testing not called... will cause a test failure PK ��["d��� � with_plan.tnu �[��� use strict; use warnings; # another demonstration of the various features of Test::Warnings, where # a test plan is used use Test::More tests => 8; use Test::Warnings ':all'; is(1, 1, 'passing test'); had_no_warnings; ok(!allowing_warnings, 'warnings are not currently allowed'); allow_warnings; ok(allowing_warnings, 'warnings are now allowed'); warn 'this warning will not cause a failure'; had_no_warnings; allow_warnings(0); ok(!allowing_warnings, 'warnings are not allowed again'); warn 'oh noes, something warned!'; # this will now fail. had_no_warnings; note 'we are done; had_no_warnings will be called automatically via END block.'; PK ��[��zW uplevel-demo.plnu �[��� PK ��["�=� � Y tee.plnu �[��� PK ��[�n�n n rt-58208.plnu �[��� PK ��[O�?�� � � warning_like.tnu �[��� PK ��[� � sub.tnu �[��� PK ��[N.E�m m test_nowarnings.tnu �[��� PK ��[`�M�K K � synopsis_2.tnu �[��� PK ��[��S*� � B test_warning_contents.tnu �[��� PK ��[�blƺ � R synopsis_1.tnu �[��� PK ��[1ʞ� � H with_done_testing.tnu �[��� PK ��[rz��? ? B no_plan.tnu �[��� PK ��["d��� � � with_plan.tnu �[��� PK � �
| ver. 1.6 |
Github
|
.
| PHP 8.2.30 | ??????????? ?????????: 0 |
proxy
|
phpinfo
|
???????????