Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Conditionally faking a module

by Anonymous Monk
on Jan 13, 2010 at 18:38 UTC ( #817254=note: print w/replies, xml ) Need Help??


in reply to Conditionally faking a module

see use, require, eval
BEGIN { if( eval { require Cava::Pack; 1 } ) { import Cava::Pack; } else { no strict 'refs'; *Cava::Pack::Resource = sub { $Cava::Pack::dir . '/' . $_[0]; }; *Cava::Pack::SetResourcePath = sub { $Cava::Pack::dir = $_[0]; }; *Cava::Pack::GetInfoProductVersion = sub { "0.9.9.0"; }; } ## end unless ( eval { require Cava::Pack...}) } ## end BEGIN

Replies are listed 'Best First'.
Re^2: Conditionally faking a module
by wanna_code_perl (Friar) on Jan 13, 2010 at 19:03 UTC
    This was the ticket. Thanks!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2023-02-01 02:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?