Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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

by hippo (Chancellor)
on May 03, 2018 at 22:07 UTC ( #1214028=note: print w/replies, xml ) Need Help??

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

Which version of Time::HiRes are you using? Which version of perl? Which versions of all the other modules?

I don't have POE::Component::DirWatch::Object installed here, but taking that out it runs cleanly for me.

For the record, it's considered better practice to do

#!/usr/bin/perl use warnings;

in preference to

#!/usr/bin/perl -w

Replies are listed 'Best First'.
Re^2: Subroutine Time::HiRes::Time redefined ... Help
by sweetblood (Prior) on May 03, 2018 at 22:21 UTC
    I thought along that same line of thinking and upgraded Time::HiRes, no help.
    But, It seems use warnings; Did it! Errors are gone. It seemed a more stylistic choice, but it fixed it. Can you explain?


      Basically, the -w flag is an all-or-nothing construct. It enables warnings everywhere in your code, including in the modules you use and you haven't written yourself. The use warnings; pragma, by contrast, is lexically scoped, so it does not overlap on other pieces of code used in your program. And you can turn it on or off for some chunks of code or for some specific warnings categories.

      I basically use the -w flag only for one-liners. The use warnings; pragma is much better for all other cases.

      See's-wrong-with-*-w*-and-%24%5eW for more details.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2021-03-01 16:39 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (13 votes). Check out past polls.