Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by Anonymous Monk
on Mar 23, 2003 at 19:18 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-19 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found