Skip to content

Instantly share code, notes, and snippets.

@kentfredric
Created October 19, 2009 13:21
Show Gist options
  • Save kentfredric/213352 to your computer and use it in GitHub Desktop.
Save kentfredric/213352 to your computer and use it in GitHub Desktop.
package broken;
use strict;
use warnings;
sub broken {
my ($c) = shift;
# this is an intentional syntax error.
$c->foo
return 1;
}
1;
#!/usr/bin/perl
use strict;
use warnings;
use Carp::Always;
require WMDs;
__END__
With:
syntax error at t2.pl line 6
Without:
syntax error at broken.pm line 13, near "->foo
return"
Compilation failed in require at WMDs.pm line 12.
Compilation failed in require at t2.pl line 6.
package WMDs;
use strict;
use warnings;
# Plagurised from Catalyst::Util;
sub anarchy {
my $error;
{
local $@;
eval { CORE::require('broken.pm') };
$error = $@;
}
die $error if $error;
}
#sub import {
WMDs->anarchy();
#}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment