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

RE: [FWP] Delayed semantical interpretation



merlyn@stonehenge.com wrote:

> >>>>> "Rubinow" == Rubinow, Larry 
> <Larry.Rubinow@westgroup.com> writes:
> 
> Rubinow> Um ... how about
> 
> Rubinow> 	do $file;
> 
> Rubinow> Technically not an eval ...
> 
> Technically yes an eval. :)
> 
>        do EXPR Uses the value of EXPR as a filename and executes
>                the contents of the file as a Perl script.  Its
>                primary use is to include subroutines from a Perl
>                subroutine library.
> 
>                    do 'stat.pl';
> 
>                is just like
> 
>                    scalar eval `cat stat.pl`;
> 
>                except that it's more efficient and concise, keeps
>                track of the current filename for error messages,
>                searches the @INC libraries, and updates %INC if
>                the file is found. [...]
> 
> Looks like an eval to me.

You left out: "It also differs in that code evaluated with `do FILENAME'
cannot see lexicals in the enclosing scope; `eval STRING' does."  I'd call
that a significant difference.

Oh well, who am I to argue with Randal?  Then what about

   my ( $module, $function ) = @_;
   require $module;
   &{"${module}::$function"};

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe