Skip to content

Instantly share code, notes, and snippets.

@bayashi
Created February 11, 2013 02:03
Show Gist options
  • Save bayashi/4751969 to your computer and use it in GitHub Desktop.
Save bayashi/4751969 to your computer and use it in GitHub Desktop.
Test: : Do NOT load modules
use strict;
use Test::AllModules;
use Test::More;
BEGIN {
note('compile all modules.');
all_ok(
search_path => 'MyApp',
check => sub {
my $class = shift;
eval "use $class;1;";
},
);
}
note('Do NOT load modules.');
for my $module (qw/
Class::ISA Pod::Plainer Switch UNIVERSAL Shell FileHandle DynaLoader base byte
/) {
ok noload($module), "no $module";
}
sub noload {
my $module = shift;
$module =~ s!::!/!g;
return !defined( $INC{"$module\.pm"} ) ? 1 : 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment