#!/usr/local/bin/perl write_function1("first"); print auto_function(), "\n"; # This will print: # auto_function first
write_function1("second"); # How would I undefine the autoloaded version of auto_function? print auto_function(), "\n"; # This will print: # auto_function first # But I would like it to print # auto_function second sub AUTOLOAD { my $attr = $AUTOLOAD; $attr =~ s/.*:://; if ( -e $attr ) { require $attr; } else { die "oops"; } warn $@ if $@; $attr->("z") if -e $attr; } sub write_function1 { my $thing = shift; unlink "auto_function"; open "FILE", ">", "auto_function"; print FILE <<END; sub auto_function{ " auto_function $thing"; } 1; END close FILE; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>