Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Best way to dynamically use a .pm?

by patcat88 (Deacon)
on Nov 28, 2011 at 19:51 UTC ( #940455=note: print w/ replies, xml ) Need Help??


in reply to Best way to dynamically use a .pm?

Read use Module and require. PMs can put their subs in any package. PM names just look like packages, but they aren't, and a PM doesn't have to put subs in the package its named after (a good idea for unmaintainable code). PMs are simply text files given to the do EXPR function.

Note, you can write the require and use functions yourself in pure perl.

I think for your case 1 PM per data format, loaded using requires, or put a begin block read the data header and then do a require in the begin block, parse the file outside of the BEGIN block/normal runtime.


Comment on Re: Best way to dynamically use a .pm?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-10-21 01:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (94 votes), past polls