use PDL::Constants without "Subroutine redefined"

89 Views Asked by At

To be able to use the constant PI of Perl Data Language, I run with perl -w the lines:

use strict;
use warnings;
use PDL::Constants qw( PI );

However, Perl warns me:

Subroutine PDL::Constants::piddle redefined at /usr/lib64/perl5/vendor_perl/PDL/Constants.pm line 29. Subroutine PDL::Constants::null redefined at /usr/lib64/perl5/vendor_perl/PDL/Constants.pm line 29. Subroutine PDL::Constants::pdl redefined at /usr/lib64/perl5/vendor_perl/PDL/Constants.pm line 29. Subroutine PDL::Constants::barf redefined at /usr/lib64/perl5/vendor_perl/PDL/Constants.pm line 29.

The same warning arises, if I run the synopsis from https://metacpan.org/pod/PDL::Constants#PI

use PDL::Constants qw(PI E);
print 'PI is ' . PI . "\n";
print 'E  is ' .  E . "\n";

What is the correct way to import PI and others of PDL's constant values?

1

There are 1 best solutions below

0
On BEST ANSWER

Using this in latest PDL:

perl -w -Mblib -MPDL::Constants -e 1

produces no warnings.