X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTest%2FMooseX%2FCompiler.pm;h=665a51211257bcc61384aafdc05a13391f735ad4;hb=6029ad7beb4b3c7882674a9066ba56b2e2208d75;hp=765ced022fe421aaac26f080e724cbc5100a99e6;hpb=a44ebace8aab59d8e99f88fee467faba645c07e8;p=gitmo%2FMooseX-Compiler.git diff --git a/t/lib/Test/MooseX/Compiler.pm b/t/lib/Test/MooseX/Compiler.pm index 765ced0..665a512 100644 --- a/t/lib/Test/MooseX/Compiler.pm +++ b/t/lib/Test/MooseX/Compiler.pm @@ -19,9 +19,20 @@ sub save_class { my $class = shift; my $code = shift; + my $full_code = <<"EOF"; +package $class; + +use strict; +use warnings; + +$code + +1; +EOF + { local $@; - eval $code; + eval $full_code; die $@ if $@; } @@ -30,7 +41,7 @@ sub save_class { $path->dir()->mkpath( 0, 0755 ); open my $fh, '>', $path; - print {$fh} $code; + print {$fh} $full_code; close $fh; $INC{$pm_file} = $path;