On Feb 27, 2004, at 10:16 PM, David le Blanc wrote:

[ I couldn't find nested sub's in the source. ? ]

From Trainset.pm:


sub throw_lever {        # return a lever object
  sub barf {
    print "$_[1]\n" if ($_[0]);
  }
  print "throw_lever..." if (&debug);
  my $self=shift;

...

Subs do nest. Just not the way you expect.

The most handy time to build a subroutine inside a subroutine is when your eval()ing them, in my opinion. This is a handy trick for AUTOLOAD()s.


Nothing like that is going on in the referenced code though.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to