Subject: | Class based dispatching doesn't work. |
So as I mentioned via phenny on irc.perl.org ->isa('StructName') fails for MooX::Struct classes. This means that documented features in Throwable::Factory do not in fact when changed *slightly* from the documentation.
The specific case is using the example from the POD of Try::Tiny::ByClass. The example in the pod *does work* ... but not in the way in which someone (at least I) expect. If I take out the '-notimplemented' flag and no longer compose the Role the exception will fall through entirely. Here's the example stripped down demonstrating the issue.
-----
#!/usr/bin/env perl
use 5.12.1;
use Try::Tiny::ByClass;
use Throwable::Factory
# ErrTooBig => [qw( $maximum! )], # falls through the try/catch
ErrTooBig => [qw( $maximum! -notimplemented )], # gets caught because it applies a Role.
;
try {
ErrTooBig->throw(message => 'Ugh!', maximum => 12);
}
catch_case [
ErrTooBig => sub { warn "Too big!" },
'Throwable::Taxonomy::NotImplemented' => sub { warn "Not Implemented?" },
];