Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: GMT to PST format

by ikegami (Pope)
on Jun 20, 2010 at 07:25 UTC ( #845597=note: print w/replies, xml ) Need Help??


in reply to Re^2: GMT to PST format
in thread GMT to PST format

use Date::Manip;
should be
use Date::Manip::Date;

Replies are listed 'Best First'.
Re^4: GMT to PST format
by Krambambuli (Curate) on Jun 20, 2010 at 07:58 UTC
    Not necessarily - it works as is here, Date::Manip::Date is brought in by Date::Manip.

      Not necessarily

      I stand by what I said. There's no reason to that undocumented feature, especially since it didn't work.

      it works as is here,

      Apparently not in the version the OP has.

      Actually, this is NOT guaranteed to work.

      Date::Manip version 5.xx does not include the Date::Manip::Date module. Date::Manip 6.xx is a complete rewrite which breaks the module into several pieces including Date::Manip::Date for working with dates (and other modules for working with deltas, timezones, etc.). The actual Date::Manip module is just a backwards-compatible wrapper around these modules.

      So, if you say:

         use Date::Manip;
         $obj = new Date::Manip::Date;
      
      and you have Date::Manip 5.xx installed, this code will fail, exactly as described elsewhere in the thread.

      As suggested elsewhere in the thread, the proper solution IS to include the line:

         use Date::Manip::Date;
      
      in the code.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://845597]
help
Chatterbox?
[Cosmic37]: if ( $line =~ /$mydt/ ) { print $line; }
[Cosmic37]: I try to match successive date times stored in variable $mydt
[Cosmic37]: I guess it is searching for the string "$mydt"
[Corion]: Indeed cool, erix ;)
[Cosmic37]: rather than the value of $mydt which is a date time strong such as 2016-01-01 12:30:56
[Corion]: Cosmic37: No, but maybe $mydt doesn't contain what you think it does, or it contains characters that are special in a regular expression? Try if( $line =~ /\Q$mydt\E/) { ... for a literal match
[Cosmic37]: I mean string grrr
[Corion]: Maybe add an else branch in which you print what the values of $line and $mydt are?
[Cosmic37]: ah thank you I will try
[Cosmic37]: you are right $mydt did not contain what I expected... :-D I will now think :-D

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2017-06-29 17:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (673 votes). Check out past polls.