Skip to content

Instantly share code, notes, and snippets.

/MyFailure1.pm Secret

Created May 4, 2012 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7cbc2b430ec29644af02 to your computer and use it in GitHub Desktop.
Save anonymous/7cbc2b430ec29644af02 to your computer and use it in GitHub Desktop.
Testcase showing redefinition warning not being caught
#!/usr/bin/perl -w
use File::Find;
use File::Spec;
use Test::More;
use Test::NoWarnings;
use warnings FATAL => qw(all);
my @files;
File::Find::find(
sub
{
if (/\.pm$/ && $File::Find::dir)
{
push(@files, $File::Find::name);
}
},
"."
);
done_testing(scalar(@files) + 1); # Test::NoWarnings adds an implicit test case
foreach my $file (@files)
{
my $path = File::Spec->canonpath($file);
my $includeString = "$file";
if ($path =~ /(.*)\.pm/)
{
my $relativePath = $1;
my @subPath = split /\\/, $relativePath;
$includeString = join '::', @subPath;
}
use_ok($includeString);
}
1;
package MyFailure1;
use strict;
use warnings;
use base 'Exporter';
our @EXPORT = qw(duplicateFunction);
sub duplicateFunction
{
return;
}
1;
__END__
package MyFailure2;
use strict;
use warnings;
use base 'Exporter';
our @EXPORT = qw(duplicateFunction);
sub duplicateFunction
{
return;
}
1;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment