[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Self Aware Data routines?



On Mon, Jun 28, 1999 at 12:10:56PM -0700, Brian L. Matthews wrote:
> Steve Lane writes:
> |while (<DATA>) {
> |  chomp;
> |  no strict qw/refs/;  # the next line is a symref
> |  &$_;
> |}
> |sub AUTOLOAD { 
> |  print "Sorry, I don't see a subroutine called '$AUTOLOAD'\n"; 
> |}
> 
> And hope that __DATA__ doesn't contain the name of some unrelated sub
> in main...
> 

That concern is valid for the general exercise, not just this specific
solution.  But under this exercise, there are no 'unrelated' subs.  The
idea is simply to call the specified sub if it exists, and print an
appropriate message if it doesn't.

Ronald

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org