Skip Menu |

This queue is for tickets about the TryCatch CPAN distribution.

Report information
The Basics
Id: 81978
Status: open
Worked: 55 min
Priority: 0/
Queue: TryCatch

People
Owner: Nobody in particular
Requestors: aar [...] cpan.org
ether [...] cpan.org
Cc: ribasushi [...] leporine.io
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: t/invalid.t fails
Fetching http://search.cpan.org/CPAN/authors/id/A/AS/ASH/TryCatch-1.003000.tar.gz -> OK Unpacking TryCatch-1.003000.tar.gz Entering TryCatch-1.003000 Checking configure dependencies from META.yml Checking if you have B::Hooks::OP::Check 0.18 ... Yes (0.19) Checking if you have ExtUtils::MakeMaker 6.42 ... Yes (6.62) Checking if you have ExtUtils::Depends 0.302 ... Yes (0.304) Checking if you have B::Hooks::OP::PPAddr 0.03 ... Yes (0.03) Configuring TryCatch-1.003000 Running Makefile.PL *** Module::AutoInstall version 1.03 *** Checking for Perl dependencies... *** Since we're running under CPAN, I'll just let it take care of the dependency's installation later. [Core Features] - Test::More ...loaded. (0.98 >= 0.88) - Test::Exception ...loaded. (0.31) - B::Hooks::OP::Check ...loaded. (0.19 >= 0.18) - B::Hooks::OP::PPAddr ...loaded. (0.03 >= 0.03) - Parse::Method::Signatures ...loaded. (1.003014 >= 1.003012) - B::Hooks::EndOfScope ...loaded. (0.12 >= 0.08) - Devel::Declare ...loaded. (0.006011 >= 0.005007) - Moose ...loaded. (2.0604) - MooseX::Types ...loaded. (0.35) - Scope::Upper ...loaded. (0.21 >= 0.06) - Variable::Magic ...loaded. (0.52 >= 0.28) - Sub::Exporter ...loaded. (0.982 >= 0.979) - XSLoader ...loaded. (0.13) *** Module::AutoInstall configuration finished. Checking if your kit is complete... Looks good Writing Makefile for TryCatch Writing MYMETA.yml and MYMETA.json -> OK Checking dependencies from MYMETA.json ... Checking if you have Test::More 0.88 ... Yes (0.98) Checking if you have B::Hooks::OP::Check 0.18 ... Yes (0.19) Checking if you have Test::Exception 0 ... Yes (0.31) Checking if you have ExtUtils::MakeMaker 6.42 ... Yes (6.62) Checking if you have ExtUtils::Depends 0.302 ... Yes (0.304) Checking if you have B::Hooks::OP::PPAddr 0.03 ... Yes (0.03) Checking if you have XSLoader 0 ... Yes (0.13) Checking if you have Test::Exception 0 ... Yes (0.31) Checking if you have Scope::Upper 0.06 ... Yes (0.21) Checking if you have Parse::Method::Signatures 1.003012 ... Yes (1.003014) Checking if you have Sub::Exporter 0.979 ... Yes (0.982) Checking if you have B::Hooks::EndOfScope 0.08 ... Yes (0.12) Checking if you have Test::More 0.88 ... Yes (0.98) Checking if you have B::Hooks::OP::Check 0.18 ... Yes (0.19) Checking if you have MooseX::Types 0 ... Yes (0.35) Checking if you have B::Hooks::OP::PPAddr 0.03 ... Yes (0.03) Checking if you have Variable::Magic 0.28 ... Yes (0.52) Checking if you have Devel::Declare 0.005007 ... Yes (0.006011) Checking if you have Moose 0 ... Yes (2.0604) Building and testing TryCatch-1.003000 cp bench_ok.pl blib/lib/bench_ok.pl cp bench.pl blib/lib/bench.pl cp lib/TryCatch.pm blib/lib/TryCatch.pm /usr/bin/perl "-Iinc" /usr/share/perl/5.14/ExtUtils/xsubpp -typemap /usr/share/perl/5.14/ExtUtils/typemap TryCatch.xs > TryCatch.xsc && mv TryCatch.xsc TryCatch.c cc -c -I/root/.cpanm/work/1355481259.24099/TryCatch- 1.003000/inc/EUDeps/B/Hooks/OP/Check/Install - I/root/.cpanm/work/1355481259.24099/TryCatch- 1.003000/inc/EUDeps/B/Hooks/OP/PPAddr/Install -D_REENTRANT -D_GNU_SOURCE - DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include - D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\"1.003000\" - DXS_VERSION=\"1.003000\" -fPIC "-I/usr/lib/perl/5.14/CORE" TryCatch.c TryCatch.xs: In function ‘try_return’: TryCatch.xs:72:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘IV’ [-Wformat] TryCatch.c: In function ‘XS_TryCatch__XS_uninstall_op_checks’: TryCatch.xs:263:5: warning: ignoring return value of ‘Perl_av_shift’, declared with attribute warn_unused_result [-Wunused-result] Running Mkbootstrap for TryCatch () chmod 644 TryCatch.bs rm -f blib/arch/auto/TryCatch/TryCatch.so cc -shared -O2 -g -L/usr/local/lib -fstack-protector TryCatch.o -o blib/arch/auto/TryCatch/TryCatch.so \ \ chmod 755 blib/arch/auto/TryCatch/TryCatch.so cp TryCatch.bs blib/arch/auto/TryCatch/TryCatch.bs chmod 644 blib/arch/auto/TryCatch/TryCatch.bs Manifying blib/man3/TryCatch.3pm PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/catch_01.t t/context.t t/destroy.t t/handwritten.t t/invalid.t t/method.t t/mx_types_structured.t t/nested.t t/simple.t t/types.t t/catch_01.t ............. ok t/context.t .............. ok t/destroy.t .............. ok t/handwritten.t .......... ok # Failed test 'no block after catch' # at t/invalid.t line 25. # 'block required after catch at /usr/local/share/perl/5.14.2/B/Hooks/EndOfScope/XS.pm line 26. # syntax error at (eval 355) line 7, near "} # # my " # Global symbol "$foo" requires explicit package name at (eval 355) line 7. # Missing right curly or square bracket at (eval 355) line 9, at end of line # ' # doesn't match '(?^:^block required after catch at \(eval \d+\) line (\d+)\b)' # Failed test 'Error from line 5' # at t/invalid.t line 36. # got: undef # expected: '5' # Failed test 'invalid catch signature' # at t/invalid.t line 38. # 'Parameter expected near '^' in '^Err $e' at /usr/local/share/perl/5.14.2/B/Hooks/EndOfScope/XS.pm line 26. # syntax error at (eval 357) line 5, near "} # {" # Missing right curly or square bracket at (eval 357) line 8, at end of line # ' # doesn't match '(?^:^Parameter expected near '\^' in '\^Err \$e' at \(eval \d+\) line (\d+)\b)' # Failed test 'Error from line 4' # at t/invalid.t line 50. # got: undef # expected: '4' # Failed test 'invalid catch signature (missing parenthesis)' # at t/invalid.t line 52. # 'Run-away catch signature at /usr/local/share/perl/5.14.2/B/Hooks/EndOfScope/XS.pm line 26. # Missing right curly or square bracket at (eval 363) line 5, at end of line # syntax error at (eval 363) line 5, at EOF # ' # doesn't match '(?^:^Run-away catch signature at \(eval \d+\) line (\d+))' # Failed test 'Error from line 4' # at t/invalid.t line 68. # got: undef # expected: '4' # Looks like you failed 6 tests of 15. t/invalid.t .............. Dubious, test returned 6 (wstat 1536, 0x600) Failed 6/15 subtests t/method.t ............... ok t/mx_types_structured.t .. ok t/nested.t ............... ok t/simple.t ............... ok t/types.t ................ ok Test Summary Report ------------------- t/invalid.t (Wstat: 1536 Tests: 15 Failed: 6) Failed tests: 3-8 Non-zero exit status: 6 Files=10, Tests=58, 7 wallclock secs ( 0.05 usr 0.09 sys + 6.00 cusr 0.76 csys = 6.90 CPU) Result: FAIL Failed 1/10 test programs. 6/58 subtests failed. make: *** [test_dynamic] Error 255 -> FAIL Installing TryCatch failed. See /root/.cpanm/build.log for details. root:~# perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi (with 53 registered patches, see perl -V for more detail)
From: d.thomas [...] its.uq.edu.au
On Fri Dec 14 05:36:36 2012, AAR wrote: Show quoted text
> # Failed test 'no block after catch' > # at t/invalid.t line 25. > # 'block required after catch at > /usr/local/share/perl/5.14.2/B/Hooks/EndOfScope/XS.pm line 26. > # syntax error at (eval 355) line 7, near "}
same thing for me with perl 5.16.2 all tests pass when rolling B::Hooks::EndOfScope back 0.12 -> 0.11
From: d.thomas [...] its.uq.edu.au
NB both pure-perl and XS versions of 0.12 fail, but differently # export B_HOOKS_ENDOFSCOPE_IMPLEMENTATION=PP # make test PERL_DL_NONLAZY=1 /opt/perl/uq.cis.perl-base2.rhel6-5.16.2-20121228/bin/perl ... t/catch_01.t ............. ok t/context.t .............. ok t/destroy.t .............. ok t/handwritten.t .......... ok t/invalid.t .............. 1/? # Failed test 'no block after catch' # at t/invalid.t line 25. # 'syntax error at (eval 423) line 7, near "} # # my " # Global symbol "$foo" requires explicit package name at (eval 423) line 7. # Missing right curly or square bracket at (eval 423) line 9, at end of line # ' # doesn't match '(?^:^block required after catch at \(eval \d+\) line (\d+)\b)' # export B_HOOKS_ENDOFSCOPE_IMPLEMENTATION=XS # make test PERL_DL_NONLAZY=1 /opt/perl/uq.cis.perl-base2.rhel6-5.16.2-20121228/bin/perl ... t/catch_01.t ............. ok t/context.t .............. ok t/destroy.t .............. ok t/handwritten.t .......... ok t/invalid.t .............. 1/? # Failed test 'no block after catch' # at t/invalid.t line 25. # 'block required after catch at /opt/perl/uq.cis.perl-base2.rhel6-5.16.2- 20121228/lib/site_perl/5.16.2/B/Hooks/EndOfScope/XS.pm line 26. # syntax error at (eval 423) line 7, near "}
From: d.thomas [...] its.uq.edu.au
On Fri Dec 28 18:20:17 2012, d.thomas@its.uq.edu.au wrote: Show quoted text
> NB both pure-perl and XS versions of 0.12 fail, but differently
my workaround was to use 0.11, but namespace-clean-0.24 fails a test Warning: prerequisite B::Hooks::EndOfScope 0.12 not found. We have 0.11. t/10-pure-perl.t ......... 1/? # Failed test 'PP BHEOS loaded properly' # at t/10-pure-perl.t line 13. t/10-pure-perl.t ......... 7/? # Looks like you failed 1 test of 12. Looks like I'll have to disable t/invalid.t from running during my automated build
Subject: t/invalid.t fails (with B::Hooks::EndOfScope 0.12)
It's definitely triggered by the upgrade of B::Hooks::EndOfScope from 0.11 to 0.12. I've attached a 'perl Makefile.PL; make test' with both versions of the module. Passes with 0.11. Fails with 0.12.
Subject: TryCatch+Hooks-0.11.txt
[5134][c.wright@fulcrum-chz:DAVE][CPAN-updates]➔ perlversion B::Hooks::EndOfScope [B::Hooks::EndOfScope] 0.11 [5135][c.wright@fulcrum-chz:DAVE][CPAN-updates]➔ tar xf src/CPAN_MODULES_ORIGIN/Try Try-Tiny-0.12.tar.gz TryCatch-1.003000.tar.gz [5135][c.wright@fulcrum-chz:DAVE][CPAN-updates]➔ tar xf src/CPAN_MODULES_ORIGIN/Try Try-Tiny-0.12.tar.gz TryCatch-1.003000.tar.gz [5135][c.wright@fulcrum-chz:DAVE][CPAN-updates]➔ tar xf src/CPAN_MODULES_ORIGIN/TryCatch-1.003000.tar.gz [5136][c.wright@fulcrum-chz:DAVE][CPAN-updates⚡]➔ cd TryCatch-1.003000/ [5137][c.wright@fulcrum-chz:TryCatch-1.003000][CPAN-updates⚡]➔ perl Makefile.PL *** Module::AutoInstall version 1.03 *** Checking for Perl dependencies... [Core Features] - Test::More ...loaded. (0.98 >= 0.88) - Test::Exception ...loaded. (0.31) - B::Hooks::OP::Check ...loaded. (0.19 >= 0.18) - B::Hooks::OP::PPAddr ...loaded. (0.03 >= 0.03) - Parse::Method::Signatures ...loaded. (1.003014 >= 1.003012) - B::Hooks::EndOfScope ...loaded. (0.11 >= 0.08) - Devel::Declare ...loaded. (0.006011 >= 0.005007) - Moose ...loaded. (2.0604) - MooseX::Types ...loaded. (0.35) - Scope::Upper ...loaded. (0.21 >= 0.06) - Variable::Magic ...loaded. (0.51 >= 0.28) - Sub::Exporter ...loaded. (0.984 >= 0.979) - XSLoader ...loaded. (0.13) *** Module::AutoInstall configuration finished. Checking if your kit is complete... Looks good Writing Makefile for TryCatch Writing MYMETA.yml and MYMETA.json [5138][c.wright@fulcrum-chz:TryCatch-1.003000][CPAN-updates⚡]➔ make test cp bench_ok.pl blib/lib/bench_ok.pl cp bench.pl blib/lib/bench.pl cp lib/TryCatch.pm blib/lib/TryCatch.pm /opt/xt/xt-perl/bin/perl "-Iinc" /opt/xt/xt-perl/lib/5.14.2/ExtUtils/xsubpp -typemap /opt/xt/xt-perl/lib/5.14.2/ExtUtils/typemap TryCatch.xs > TryCatch.xsc && mv TryCatch.xsc TryCatch.c gcc -c -I/home/c.wright/development/DAVE/TryCatch-1.003000/inc/EUDeps/B/Hooks/OP/Check/Install -I/home/c.wright/development/DAVE/TryCatch-1.003000/inc/EUDeps/B/Hooks/OP/PPAddr/Install -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"1.003000\" -DXS_VERSION=\"1.003000\" -fpic "-I/opt/xt/xt-perl/lib/5.14.2/x86_64-linux/CORE" TryCatch.c TryCatch.xs: In function 'try_return': TryCatch.xs:72: warning: format '%d' expects type 'int', but argument 3 has type 'IV' TryCatch.c: In function 'XS_TryCatch__XS_uninstall_op_checks': TryCatch.xs:263: warning: ignoring return value of 'Perl_av_shift', declared with attribute warn_unused_result Running Mkbootstrap for TryCatch () chmod 644 TryCatch.bs rm -f blib/arch/auto/TryCatch/TryCatch.so gcc -shared -L/usr/local/lib -L/usr/lib64 -L/lib64 -fstack-protector TryCatch.o -o blib/arch/auto/TryCatch/TryCatch.so \ \ chmod 755 blib/arch/auto/TryCatch/TryCatch.so cp TryCatch.bs blib/arch/auto/TryCatch/TryCatch.bs chmod 644 blib/arch/auto/TryCatch/TryCatch.bs PERL_DL_NONLAZY=1 /opt/xt/xt-perl/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/catch_01.t t/context.t t/destroy.t t/handwritten.t t/invalid.t t/method.t t/mx_types_structured.t t/nested.t t/simple.t t/types.t t/catch_01.t ............. ok t/context.t .............. ok t/destroy.t .............. ok t/handwritten.t .......... ok t/invalid.t .............. ok t/method.t ............... ok t/mx_types_structured.t .. ok t/nested.t ............... ok t/simple.t ............... ok t/types.t ................ ok All tests successful. Files=10, Tests=58, 7 wallclock secs ( 0.06 usr 0.02 sys + 5.23 cusr 0.53 csys = 5.84 CPU) Result: PASS [5139][c.wright@fulcrum-chz:TryCatch-1.003000][CPAN-updates⚡]➔
Subject: TryCatch+Hooks-0.12.txt
[5141][c.wright@fulcrum-chz:TryCatch-1.003000][CPAN-updates⚡]➔ perlversion B::Hooks::EndOfScope [B::Hooks::EndOfScope] 0.12 [5142][c.wright@fulcrum-chz:TryCatch-1.003000][CPAN-updates⚡]➔ perl Makefile.PL *** Module::AutoInstall version 1.03 *** Checking for Perl dependencies... [Core Features] - Test::More ...loaded. (0.98 >= 0.88) - Test::Exception ...loaded. (0.31) - B::Hooks::OP::Check ...loaded. (0.19 >= 0.18) - B::Hooks::OP::PPAddr ...loaded. (0.03 >= 0.03) - Parse::Method::Signatures ...loaded. (1.003014 >= 1.003012) - B::Hooks::EndOfScope ...loaded. (0.12 >= 0.08) - Devel::Declare ...loaded. (0.006011 >= 0.005007) - Moose ...loaded. (2.0604) - MooseX::Types ...loaded. (0.35) - Scope::Upper ...loaded. (0.21 >= 0.06) - Variable::Magic ...loaded. (0.51 >= 0.28) - Sub::Exporter ...loaded. (0.984 >= 0.979) - XSLoader ...loaded. (0.13) *** Module::AutoInstall configuration finished. Checking if your kit is complete... Looks good Writing Makefile for TryCatch Writing MYMETA.yml and MYMETA.json [5143][c.wright@fulcrum-chz:TryCatch-1.003000][CPAN-updates⚡]➔ make test cp bench_ok.pl blib/lib/bench_ok.pl cp bench.pl blib/lib/bench.pl cp lib/TryCatch.pm blib/lib/TryCatch.pm /opt/xt/xt-perl/bin/perl "-Iinc" /opt/xt/xt-perl/lib/5.14.2/ExtUtils/xsubpp -typemap /opt/xt/xt-perl/lib/5.14.2/ExtUtils/typemap TryCatch.xs > TryCatch.xsc && mv TryCatch.xsc TryCatch.c gcc -c -I/home/c.wright/development/DAVE/TryCatch-1.003000/inc/EUDeps/B/Hooks/OP/Check/Install -I/home/c.wright/development/DAVE/TryCatch-1.003000/inc/EUDeps/B/Hooks/OP/PPAddr/Install -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"1.003000\" -DXS_VERSION=\"1.003000\" -fpic "-I/opt/xt/xt-perl/lib/5.14.2/x86_64-linux/CORE" TryCatch.c TryCatch.xs: In function 'try_return': TryCatch.xs:72: warning: format '%d' expects type 'int', but argument 3 has type 'IV' TryCatch.c: In function 'XS_TryCatch__XS_uninstall_op_checks': TryCatch.xs:263: warning: ignoring return value of 'Perl_av_shift', declared with attribute warn_unused_result Running Mkbootstrap for TryCatch () chmod 644 TryCatch.bs rm -f blib/arch/auto/TryCatch/TryCatch.so gcc -shared -L/usr/local/lib -L/usr/lib64 -L/lib64 -fstack-protector TryCatch.o -o blib/arch/auto/TryCatch/TryCatch.so \ \ chmod 755 blib/arch/auto/TryCatch/TryCatch.so cp TryCatch.bs blib/arch/auto/TryCatch/TryCatch.bs chmod 644 blib/arch/auto/TryCatch/TryCatch.bs PERL_DL_NONLAZY=1 /opt/xt/xt-perl/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/catch_01.t t/context.t t/destroy.t t/handwritten.t t/invalid.t t/method.t t/mx_types_structured.t t/nested.t t/simple.t t/types.t t/catch_01.t ............. ok t/context.t .............. ok t/destroy.t .............. ok t/handwritten.t .......... ok t/invalid.t .............. 1/? # Failed test 'no block after catch' # at t/invalid.t line 25. # 'block required after catch at /opt/xt/xt-perl/lib/site_perl/5.14.2/B/Hooks/EndOfScope/XS.pm line 26. # syntax error at (eval 358) line 7, near "} # # my " # Global symbol "$foo" requires explicit package name at (eval 358) line 7. # Missing right curly or square bracket at (eval 358) line 9, at end of line # ' # doesn't match '(?^:^block required after catch at \(eval \d+\) line (\d+)\b)' # Failed test 'Error from line 5' # at t/invalid.t line 36. # got: undef # expected: '5' # Failed test 'invalid catch signature' # at t/invalid.t line 38. # 'Parameter expected near '^' in '^Err $e' at /opt/xt/xt-perl/lib/site_perl/5.14.2/B/Hooks/EndOfScope/XS.pm line 26. # syntax error at (eval 360) line 5, near "} # {" # Missing right curly or square bracket at (eval 360) line 8, at end of line # ' # doesn't match '(?^:^Parameter expected near '\^' in '\^Err \$e' at \(eval \d+\) line (\d+)\b)' # Failed test 'Error from line 4' # at t/invalid.t line 50. # got: undef # expected: '4' # Failed test 'invalid catch signature (missing parenthesis)' # at t/invalid.t line 52. # 'Run-away catch signature at /opt/xt/xt-perl/lib/site_perl/5.14.2/B/Hooks/EndOfScope/XS.pm line 26. # Missing right curly or square bracket at (eval 366) line 5, at end of line # syntax error at (eval 366) line 5, at EOF # ' # doesn't match '(?^:^Run-away catch signature at \(eval \d+\) line (\d+))' # Failed test 'Error from line 4' # at t/invalid.t line 68. # got: undef # expected: '4' # Looks like you failed 6 tests of 15. t/invalid.t .............. Dubious, test returned 6 (wstat 1536, 0x600) Failed 6/15 subtests t/method.t ............... ok t/mx_types_structured.t .. ok t/nested.t ............... ok t/simple.t ............... ok t/types.t ................ ok Test Summary Report ------------------- t/invalid.t (Wstat: 1536 Tests: 15 Failed: 6) Failed tests: 3-8 Non-zero exit status: 6 Files=10, Tests=58, 6 wallclock secs ( 0.05 usr 0.02 sys + 5.68 cusr 0.38 csys = 6.13 CPU) Result: FAIL Failed 1/10 test programs. 6/58 subtests failed. make: *** [test_dynamic] Error 255 [5144][c.wright@fulcrum-chz:TryCatch-1.003000][CPAN-updates⚡]➔
It's not the nicest look code I've ever written, but here's a t/invalid.t that *should* still work with 0.11 (untested) and also pass under 0.12 (tested)
Subject: invalid.t
use strict; use warnings; use Test::More; use Test::Exception; use TryCatch; require B::Hooks::EndOfScope; # after 0.11 'Hooks' changed some of our messages my $hooks_post_011 = ($B::Hooks::EndOfScope::VERSION > 0.11); my ($line, $expected_line, $regexp); test_for_error( qr/^block required after try at .*? line (\d+)\b/, "no block after try", <<'EOC' ); use TryCatch; sub foo { } try \&foo EOC is($line, 4, "Error from line 4"); # Its really *really* wierd that this 'fixes' things. I blame string evals eval "use TryCatch; try {} catch" if $] >= 5.011000; if ($hooks_post_011) { $regexp = qr/block required after catch .+at \(eval \d+\) line (\d+)\b/ms; $expected_line = 9; } else { $regexp = qr/^block required after catch at \(eval \d+\) line (\d+)\b/; $expected_line = 5; } test_for_error( $regexp, "no block after catch", <<'EOC'); use TryCatch; try { 1 } catch my $foo = 2; EOC is($line, $expected_line, "Error from line $expected_line"); if ($hooks_post_011) { $regexp = qr/Parameter expected near '\^' in '\^Err \$e'.+\nsyntax error at \(eval \d+\) line (\d+)\b/ms; $expected_line = 5; } else { $regexp = qr/^Parameter expected near '\^' in '\^Err \$e' at \(eval \d+\) line (\d+)\b/; $expected_line = 4; } test_for_error( $regexp, "invalid catch signature", <<'EOC'); # line 1 use TryCatch; try { } catch (^Err $e) {} next; EOC is($line, $expected_line, "Error from line $expected_line"); if ($hooks_post_011) { $regexp = qr/Run-away catch signature at.+\nMissing right curly or square bracket at \(eval \d+\) line (\d+)/; $expected_line = 5; } else { $regexp = qr/^Run-away catch signature at \(eval \d+\) line (\d+)/; $expected_line = 4; } test_for_error( $regexp, "invalid catch signature (missing parenthesis)", <<'EOC'); use TryCatch; try { } catch ( {} 1; EOC is($line, $expected_line, "Error from line $expected_line"); test_for_error( qr/^Can't locate object method "bar" via package "catch" .*?at \(eval \d+\) line (\d+)\b/, "bareword between try and catch", <<'EOC'); use TryCatch; try { } bar catch {} EOC is($line, 3, "Error from line 3"); test_for_error( qr/^Bareword "catch" not allowed while "strict subs" in use at \(eval \d+\) line (\d+)\b/, "catch is not special", <<'EOC'); use TryCatch; catch; EOC is($line, 3, "Error from line 3"); compile_ok("try is not too reserved", <<'EOC'); use TryCatch; try => 1; EOC compile_ok( "catch is not special", <<'EOC'); use TryCatch; catch => 3; EOC { local $TODO = 'Sort out POD'; compile_ok("POD doesn't interfer with things.", <<'EOC'); use TryCatch; try { } =head1 POD =cut EOC } done_testing; sub test_for_error { local $Test::Builder::Level = $Test::Builder::Level + 1; local $TODO; local $SIG{__WARN__} = sub {}; my ($re, $msg, $code) = @_; try { eval $code; die $@ if $@; fail($msg); } catch ($e) { like($e, $re, $msg); ($line) = ($e =~ /$re/); } } sub compile_ok { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($msg, $code) = @_; try { eval $code; die $@ if $@; pass($msg); } catch ($e) { diag($e); fail($msg); } }
The same issue. Does not work with B::Hooks::EndOfScope@0.12 With B::Hooks::EndOfScope@0.11 works fine.
From: tnt [...] netsafe.cz
There is fix for this issue https://github.com/tomas- zemres/trycatch/commit/789b762743eaab7e90b345296ec0200a3f5be84a
From: d.thomas [...] its.uq.edu.au
as indicated in the 1.003001 Change entry I can confirm now passes tests successfully: TryCatch 1.003002 B-Hooks-EndOfScope-0.12 perl-5.16.3 RHEL5 & RHEL6