brucezepplin
brucezepplin

Reputation: 9752

perl - UNIVERSAL does not export anything

Hi I am getting the following error when trying to run a perl script:

pc:~/Phd/lenovo/programs/vep/scripts/variant_effect_predictor$ perl variant_effect_predictor.pl --help
UNIVERSAL does not export anything at /home/arron/Phd/lenovo/programs/vep/scripts/variant_effect_predictor/Bio/Tree/TreeFunctionsI.pm line 94.

where the offending line is:

use UNIVERSAL qw(isa)

what is the issue?

Upvotes: 3

Views: 2101

Answers (2)

bolav
bolav

Reputation: 6998

From the documentation of Universal:

Previous versions of this documentation suggested using isa as a function to determine the type of a reference:

use UNIVERSAL 'isa';

$yes = isa $h, "HASH";
$yes = isa "Foo", "Bar";

The problem is that this code would never call an overridden isa method in any class. Instead, use reftype from Scalar::Util for the first case:

use Scalar::Util 'reftype';

$yes = reftype( $h ) eq "HASH";

So this method does not exist anymore.

Upvotes: 2

choroba
choroba

Reputation: 241898

Older versions of UNIVERSAL say

You may request the import of three functions (isa, can, and VERSION), but this feature is deprecated and will be removed. Please don't do this in new code.

The latest version just says

EXPORTS

None.

Upvotes: 3

Related Questions