Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^3: disable functions if module not installed

by almut (Canon)
on Nov 04, 2008 at 13:59 UTC ( #721397=note: print w/ replies, xml ) Need Help??

in reply to Re^2: disable functions if module not installed
in thread disable functions if module not installed

require returns true on success,

yes, and false (undef) otherwise. That was the idea :)

string-eval eats memory

Why would that be (in this case, where the string is just a few bytes)?  Any tests/data to prove the claim?

C:\>perl -e"print require CGI;" 1 C:\>perl -e"print require CGIshamalamadingdong;" Can't locate in @INC

Not sure what this is meant to demonstrate — I thought we were talking about eval "require ...":

$ perl -E '$ok = eval "require CGI" ? 1:0; say $ok' 1 $ perl -E '$ok = eval "require CGIshamalamadingdong" ? 1:0; say $ok' 0

(note: swap single and double quotes if you're on Windows)

Comment on Re^3: disable functions if module not installed
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2015-11-29 19:37 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (753 votes), past polls