November 2013 Archives

Failed compilations can be partially successful

Apparently Perl doesn't clean up after a failed compile. However far it got sticks around. I didn't discover this myself, but here's an example:


eval 'HERE';
package Weird;
use strict;
sub foo { print "hi\n" }
sub bar { print "$bar\n" }
1;
HERE

print "\$@ -> $@";

Weird::foo();
Weird::bar();

The Weird package won't compile all the way because it has a strict violation in Weird::bar(). Here's the output, which shows that /users/brian_d_foy/2013/11/index.html

About brian d foy

user-pic I'm the author of Mastering Perl, and the co-author of Learning Perl (6th Edition), Intermediate Perl, Programming Perl (4th Edition) and Effective Perl Programming (2nd Edition).