Skip Menu |

This queue is for tickets about the TryCatch CPAN distribution.

Report information
The Basics
Id: 48928
Status: resolved
Priority: 0/
Queue: TryCatch

People
Owner: ash_rtcpan [...] firemirror.com (weekly)
Requestors: perl [...] david-raab.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 1.001001
  • 1.001001_99
Fixed in: 1.002000



I expected from TryCatch that it is possible that you can just catch any classes with a type match. An example what i mean is given in: trycatch.pl Here i expected that i can Fetch the object that is from the class "Error" but it didn't work. This code just print some useless error message: Show quoted text
> syntax error at ./trycatch.pl line 24, near "} > {" >Missing right curly or square bracket at ./trycatch.pl line 26, at end
of line Show quoted text
>Execution of ./trycatch.pl aborted due to compilation errors.
I spend a long debug time to find that it is not possible to fetch non-Moose classes. If i commentet out "use Moose", then this code works. It would be nice if this is possible. So somebody can even fetch lets say "Exception::Class" Exceptions that not bassed on Moose. By the way even if this is not possible or did not change. It would be nice when this would be mentioned in the Documentation. A useful error message instead of a syntax error would also be better.
Subject: trycatch.pl
#!/usr/bin/env perl # Core Modules use strict; use warnings; use utf8; use open ':encoding(UTF-8)'; use open ':std'; use TryCatch; BEGIN { package Error; sub new { bless {}, $_[0]} use Moose; } my $t = Error->new; sub error { die bless {}, 'Error'; } try { error(); } catch(Error $e) { print "Error catched\n"; }
I uploaded a modified file of trycatch.pl where "use Moose" is not commented out. To get the error message comment "use Moose" out. I also write the text assuming "use Moose" was commented out.
This was in fact a bug in Parse::Method::Signatures. I've added tests for this, and will release a new version of TryCatch that depends on the updated P::M::S in the next few days. Sorry for taking so long to reply to this bug.
Released to cpan now.