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

Re^6: Use module only if it is in use

by vitoco (Friar)
on Sep 02, 2009 at 16:33 UTC ( #792961=note: print w/ replies, xml ) Need Help??

in reply to Re^5: Use module only if it is in use
in thread Use a module only if it is in use

Shouldn't that have a relevant overhead when used as:

while ($line = <F>) { chomp($line); $line = rarely_called($line) if $asciify; ... }

BTW, I did something like that (using eval), but checking a flag to require the module only in the first call.

Comment on Re^6: Use module only if it is in use
Select or Download Code
Replies are listed 'Best First'.
Re^7: Use module only if it is in use
by ikegami (Pope) on Sep 02, 2009 at 16:45 UTC
    Benchmark and find out. Or use the self-loading alternative. Or split the initialisation from the actual use.
    require Text::Unidecode if $asciify; while ($line = <F>) { chomp($line); $line = Text::Unidecode::unidecode($line) if $asciify; ... }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2015-10-09 09:33 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (237 votes), past polls