Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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]
[RonW]: My daughter and I like to "fly" Flightgear. What ever aircraft we pick, she usually shoots me out of the sky
[Corion]: Oooh. I didn't know about Flightgear. I've been looking at maybe playing with a flight simulator again, thanks!

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-02-27 18:14 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (390 votes). Check out past polls.