how die in AUTOLOAD

From: Yuri Shtil (yshtil_at_cisco.com)
Date: 02/28/04


Date: Sat, 28 Feb 2004 13:22:24 -0800

Hi all

I wrote the following code to call functions in an another package and
process the return value.

I check if the computed routine exists in the target package and call
die if it does not. When I run this code there is no die message
displayed, the program exits silently.

Any thoughts?

no strict;
sub AUTOLOAD
   {
       my ($name, $oldsub);
       my $sub = $oldsub = $AUTOLOAD;

       $sub =~ s/.*::_(.+)$/package::$1/;

       $name = $1;

       if (! defined &$sub) {
          die "cannot autoload $oldsub";

       }

       $AUTOLOAD = $sub;
       my $ret = &$AUTOLOAD;

# Process return value
}



Relevant Pages

  • Re: how die in AUTOLOAD
    ... [A complimentary Cc of this posting was sent to ... Yuri Shtil ... > I check if the computed routine exists in the target package and call ... When I run this code there is no die message ...
    (comp.lang.perl.misc)
  • Re: reading into a package
    ... > my target package before calling READ and sets it back afterward. ...
    (comp.lang.lisp)