1#!/usr/bin/perl -w 2use strict; 3use FindBin; 4use Test::More tests => 4; 5use lib "$FindBin::Bin/lib"; 6use lethal qw(open); 7 8use constant NO_SUCH_FILE => "this_file_had_better_not_exist"; 9 10eval { 11 open(my $fh, '<', NO_SUCH_FILE); 12}; 13 14ok($@, "lethal throws an exception"); 15isa_ok($@, 'autodie::exception','...which is the correct class'); 16ok($@->matches('open'), "...which matches open"); 17is($@->file,__FILE__, "...which reports the correct file"); 18