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

Re^2: Conditionally faking a module

by wanna_code_perl (Pilgrim)
on Jan 13, 2010 at 19:01 UTC ( #817258=note: print w/replies, xml ) Need Help??

in reply to Re: Conditionally faking a module
in thread Conditionally faking a module

Unfortunately, your example doesn't work:

eval "use Cava::Pack" or do { die "Using faked out Cava::Pack\n"; }

I see the "Using faked out Cava::Pack" message on both Linux and Win32 (where Cava::Pack is indeed available).

Replies are listed 'Best First'.
Re^3: Conditionally faking a module
by bobf (Monsignor) on Jan 13, 2010 at 19:14 UTC
Re^3: Conditionally faking a module
by Anonymous Monk on Jan 13, 2010 at 21:27 UTC
    That is the reason for a true value, 1
    eval "use Cava::Pack; 1" or die "Oh noes! $@"; eval "use HOW::Cava::Pack; 1" or die "HOW!?! $@"; __END__ HOW!?! Can't locate HOW/Cava/ in @INC (@INC contains: C:/perl/5 +.10.1/lib/MSWin32-x86-multi-thread C:/perl/5.10.1/lib C:/perl/site/5. +10.1/lib/MSWin32-x86-multi-thread C:/perl/site/5.10.1/lib .) at (eval + 2) line 1. BEGIN failed--compilation aborted at (eval 2) line 1.
    Hmm, I don't recall installing Cava::Pack :)
Re^3: Conditionally faking a module
by ikegami (Pope) on Jan 15, 2010 at 18:01 UTC

    The code being executed by eval ("") returns nothing (()), which is indistinguishable from the value eval returns on failure.

    You need

    eval "use Cava::Pack; 1"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://817258]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2018-06-22 21:32 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.