Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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
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 perusing the Monastery: (3)
As of 2016-02-08 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (268 votes), past polls