Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Is this a safe way to 'un'-require a module?

by jeffa (Bishop)
on Sep 10, 2015 at 18:31 UTC ( [id://1141586]=note: print w/replies, xml ) Need Help??


in reply to Is this a safe way to 'un'-require a module?

I would wait until you know that this is causing an issue, premature optimization is the root of all evil. ;) Having said that, here's my take on the solution (given i did understand the problem correctly)

use strict; use warnings; if (shift) { eval "use Data::Dumper"; } print Data::Dumper->Dump( [ 1 .. 10 ] );
The obvious problem with this solution is you lose features from Autoload --- this approach works best with object oriented packages that require instantiation but you can still work around non OO packages. Most of the time ... ... these kinds of concerns tend to open cans of worms. :/

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-20 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found