Re: Disable functionality thru commenting out a use



On 12/30/2006 08:49 AM, Robert Nicholson wrote:
I want to disable some functionality by making it conditional that it's
use statement is in the script.

How in general can you tell if a module is present or loaded? if
defined(X) what should X be?

I want to disable some features in a big perl script by
conditionalizing the code that relies on those modules and be able to
disable those features by comment out the "use" line for the modules.


Here's one way:

use Data::Dumper;

my @watergate = qw(Haldeman Nixon Colson Dean);

if ($INC{'Data/Dumper.pm'}) {
print Dumper(\@watergate);
}


--
paduille.4060.mumia.w@xxxxxxxxxxxxx
Windows Vista and your freedom in conflict:
http://www.badvista.org/
.



Relevant Pages

  • Re: webpage fails due to pop-up window blocked
    ... I've seen Norton implement script blocking features below that broke other ... access important web pages because I get a message saying "a pop-up widow ...
    (microsoft.public.win2000.setup_deployment)
  • Re: Finding line numbers of HTML elements
    ... but mostly because the context of application significantly ... contexts in which a script erroring-out at runtime would be considered ... features is employed) and propose superficial and stupid responses to ... practice designing for clean-degradation in response to negative results ...
    (comp.lang.javascript)
  • Re: what is the best way to determine system OS?
    ... If you watch a typical autoconf script, ... >knowing which features you're looking for, I can't say how you would ... >"better" distribution that you already support, ...
    (comp.lang.python)
  • Re: Plausibility Check
    ... Look at the history of any language. ... How do you make a script partially featural? ... grasp of phonological features, and no one would invent a "partially ...
    (sci.lang)
  • Re: I see no script fonts in my WORD 2003
    ... Go to Control Panel | Add or Remove Programs, select Microsoft Office ... Features and check the box for a custom install. ... Fonts is under Office Shared Features. ... >> Edwardian Script, Freestyle Script, French Script, Kunstler Script, ...
    (microsoft.public.word.docmanagement)