Acme-landmine
view release on metacpan or search on metacpan
landmine.pm view on Meta::CPAN
};
sub AUTOLOAD {
if($AUTOLOAD =~ /TIE/) {
eval <<EOF;
sub $AUTOLOAD {
my \$flavor = shift;
my \$sin = shift;
bless \\\$sin, \$flavor;
}
EOF
}else{
eval <<EOF;
sub $AUTOLOAD {
my \$sin = shift;
confess \$\$sin;
};
EOF
landmine.pm view on Meta::CPAN
2006 - cleaned up the documentation to describe how I actually
use this module in production work, bumped version to 1.00
=head1 how it works
we've got two functions, DESTROY, which is just there so
AUTOLOAD isn't called at DESTROY time, and AUTOLOAD, which
behaves differently if you are calling TIE-something or if
you are using your tied variable. at C<tie> time, the AUTOLOAD
function blesses the tie argument, if any, as a scalar reference,
so the argument is saved as the "sin" to "confess" (that is,
die with a stack-trace) when the
exploding variable is used any other way.
If you look at the source code of this module, which is very short,
you will see that the sin variable is associated with the
named autoloaded function with a string evaluation, which might
appear to allow executing arbitrary code, as long as it is
well-formed and begins with an r-value, but this is not the
case: the argument is never interpolated into the string, and
( run in 1.202 second using v1.01-cache-2.11-cpan-de7293f3b23 )