Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Subroutine Time::HiRes::Time redefined ... Help

by rminner (Chaplain)
on May 07, 2018 at 01:59 UTC ( #1214133=note: print w/replies, xml ) Need Help??


in reply to Subroutine Time::HiRes::Time redefined ... Help

In perl on windows you will get a warning for every subroutine in a Module being redefined, if somewhere in your code (or in some submodule) the given Module is used or required with the correct case, and somewhere else it is loaded with a missmatched case. e.g. in one place it is loaded using the correct case:
use Time::HiRes;
an it is loaded somewhere else with the wrong case:
# missspelled module name use TIME::HiRes;
Since TIME::HiRes is not loaded yet (only Time::HiRes is loaded), it will be loaded again, thus redefining the subroutines. The cause is Perl being case sensitive and the windows filesystem being case insensitive.

Replies are listed 'Best First'.
Re^2: Subroutine Time::HiRes::Time redefined ... Help
by afoken (Canon) on May 07, 2018 at 18:14 UTC

    Good point. Having a look at %INC could help:

    C:\>perl -MData::Dumper -MdaTA::duMPer -E "say Dumper(\%INC)" $VAR1 = { 'daTA/duMPer.pm' => 'C:/strawberry/perl/lib/daTA/duMPer.pm', 'warnings/register.pm' => 'C:/strawberry/perl/lib/warnings/r +egister.pm', 'bytes.pm' => 'C:/strawberry/perl/lib/bytes.pm', 'XSLoader.pm' => 'C:/strawberry/perl/lib/XSLoader.pm', 'Carp.pm' => 'C:/strawberry/perl/lib/Carp.pm', 'Exporter.pm' => 'C:/strawberry/perl/lib/Exporter.pm', 'strict.pm' => 'C:/strawberry/perl/lib/strict.pm', 'warnings.pm' => 'C:/strawberry/perl/lib/warnings.pm', 'overload.pm' => 'C:/strawberry/perl/lib/overload.pm', 'Data/Dumper.pm' => 'C:/strawberry/perl/lib/Data/Dumper.pm', 'feature.pm' => 'C:/strawberry/perl/lib/feature.pm' }; C:\>

    Sorting the %INC keys definitively helps:

    C:\>perl -MData::Dumper -MdaTA::duMPer -E "say for sort { lc($a) cmp l +c($b) } keys %INC" bytes.pm Carp.pm daTA/duMPer.pm Data/Dumper.pm Exporter.pm feature.pm overload.pm strict.pm warnings.pm warnings/register.pm XSLoader.pm C:\>

    But the best way is to let perl find the problematic module name:

    C:\>perl -MData::Dumper -MdaTA::duMPer -E "my %oops; $oops{lc $_}++ fo +r keys %INC; say for grep { $oops{$_}>1 } keys %oops" data/dumper.pm C:\>

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2020-01-28 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?