Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2015-11-25 19:29 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (686 votes), past polls