# file TestModule.pm: package TestModule; die; 1; # file test.pl use strict; use warnings; use lib '.'; our %failed; BEGIN { *CORE::GLOBAL::require = sub { my $success = eval { CORE::require($_[0]) }; $failed{$_[0]} = 1 unless $success; return $success; }; } use TestModule; use CGI; use Data::Dumper; print Dumper \%failed;
In this case use Module will never fail, which is good for testing but bad in general, so you might want to croak $@ unless $success after marking the module load as failed.
In reply to Re: Detecting broken modules
by moritz
in thread Detecting broken modules
by ELISHEVA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |