Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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.

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?
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 cooling their heels in the Monastery: (7)
As of 2016-08-29 22:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (409 votes). Check out past polls.