has data => ( is => "ro" );
has line => ( isa => "Int", is => "ro" );
has file => ( isa => "Str", is => "ro" );
+ has last_error => ( isa => "Any", is => "ro" );
package Baz;
use metaclass (
sub blah { $line = __LINE__; shift->foo(4) }
sub create_error {
- eval { blah(shift) };
+ eval { eval { die "Blah" }; blah(shift) };
ok( my $e = $@, "got some error" );
return {
file => __FILE__,
is( $e->{error}->line, $e->{line}, "line attr" );
is( $e->{error}->file, $e->{file}, "file attr" );
is_deeply( $e->{error}->data, [ $baz, 4 ], "captured args" );
+ like( $e->{error}->last_error, qr/Blah/, "last error preserved" );
}