'use PDL::Constants without "Subroutine redefined"
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?
Solution 1:[1]
Using this in latest PDL:
perl -w -Mblib -MPDL::Constants -e 1
produces no warnings.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ed. |
