Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2016-10-24 03:41 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (302 votes). Check out past polls.