Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (15)
As of 2014-08-20 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (124 votes), past polls