Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Loading a function from another file dynamically?!

by Anonymous Monk
on Mar 23, 2003 at 19:18 UTC ( #245305=note: print w/replies, xml ) Need Help??


in reply to Re: Loading a function from another file dynamically?!
in thread Loading a function from another file dynamically?!

thanks. that worked well :).. I think I'll just use number 3 since it's the shortest. eval() return values aren't that important to me, since it's only for my wwwsite. There aren't any real differences between these methods, are there?
  • Comment on Re: Re: Loading a function from another file dynamically?!

Replies are listed 'Best First'.
Re: Re: Re: Loading a function from another file dynamically?!
by dakkar (Hermit) on Mar 23, 2003 at 19:26 UTC

    The first method loads the file into a string, then evals it.

    The second method uses an external program (cat) to read the file, taking up a bit more resources.

    The third method is the "preferred" way of doing it, but has a couple of differences: the file is looked for in all the directories listed in the @INC array; the code in the file will not be able to access lexical variables declared (with my) in the scope in which the do is executed. (for details, perldoc -f do).

    -- 
            dakkar - Mobilis in mobile
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2022-06-25 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (81 votes). Check out past polls.

    Notices?