Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by jeffa (Bishop)
on Sep 10, 2015 at 18:31 UTC ( #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
Node Status?
node history
Node Type: note [id://1141586]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2019-05-20 05:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (123 votes). Check out past polls.

    Notices?