Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: source filters in eval

by asdfgroup (Beadle)
on Feb 25, 2003 at 11:11 UTC ( [id://238407]=note: print w/replies, xml ) Need Help??


in reply to Re: source filters in eval
in thread source filters in eval

Hi,
Maybe this is not clear indicated reasons of this trick (and re-inventing of eval).
Problem is indicated in subject of node. E.g. source filters in 'eval' code magically don't work.
So this is workaround of this problem and this post mean questions :
- Is this is correct workaround ?
- Can this be done more simply ?
- And if it can't, how we can make this work magically ? E.g. if we can override (re-define) CORE::eval

Replies are listed 'Best First'.
Re: Re: source filters in eval
by steves (Curate) on Feb 25, 2003 at 13:10 UTC

    Isn't that because you used the expression (quoted) form of eval? The code would have already been compiled and (I think) source filters are applied at compile time. What happens if you try a block style eval?

      You right, but I can't use block style eval. I need to eval code located in other file and content of this file should be preprocessed first in some way... As trivial example I need to load this code in temporary package and import some function (from other module) into this package:
      $content = `cat somefile.pl`; eval "package $TEMPPACKAGE;". "use Some::Module qw(somefunctions);". $content;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://238407]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-03-19 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found