Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: [DUP] Re^3: constants wont optimize

by patcat88 (Deacon)
on Jul 10, 2011 at 20:58 UTC ( #913629=note: print w/ replies, xml ) Need Help??


in reply to Re^3: constants wont optimize
in thread constants wont optimize

I can't call "require". I am sniffing to see what PMs were loaded before the "use" that loads my PM. Its so my PM will integrate with other PMs loaded BEFORE my PM. Sort of like threads and threads::shared.


Comment on Re: [DUP] Re^3: constants wont optimize
Re^5: constants wont optimize
by ikegami (Pope) on Jul 10, 2011 at 21:35 UTC

    I can't call "require".

    You seem to have lost track of what you said because you're the one who used require. You said

    use if eval { require mod; 1 }, qw' constant haveMod 1 ';

    is ugly because constant is being used. I pointed out that it's simply not true. Not only does that code not work, but it can be written as

    use constant haveMod => eval { require mod; };

    I am sniffing to see what PMs were loaded before the "use" that loads my PM.

    Asked and answered. Or if you want to check for multiple modules,

    use constant { map { no strict 'refs'; ( my $constant = $_ ) =~ s/:://g; "have$constant" => ${"${_}::VERSION"} } qw( Foo::Mod Bar::Mod ); };

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2014-08-27 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (253 votes), past polls