Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: CPAN Trojan Horses

by tobyink (Abbot)
on Jun 28, 2013 at 19:52 UTC ( #1041332=note: print w/ replies, xml ) Need Help??


in reply to CPAN Trojan Horses

The easy way to do optional dependencies is along these lines:

use constant HAS_LWP => eval "require LWP::UserAgent"; ...; update_cache() if HAS_LWP; my $data = read_cache();

In terms of META.yml/META.json, there is a facility to indicate optional dependencies, though I don't see it used very often.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: CPAN Trojan Horses
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2014-11-28 15:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (197 votes), past polls