Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^2: GMT to PST format

by Anonymous Monk
on Jun 20, 2010 at 07:08 UTC ( #845595=note: print w/replies, xml ) Need Help??

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

Unfortunately we don't have installed this module.
Can't locate object method "new" via package "Date::Manip::Date" (perh +aps you forgot to load "Date::Manip::Date"?)
I am getting the error as above. Please tell me is there any other way to do this.

Replies are listed 'Best First'.
Re^3: GMT to PST format
by ikegami (Pope) on Jun 20, 2010 at 07:25 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.

Re^3: GMT to PST format
by Krambambuli (Curate) on Jun 20, 2010 at 08:10 UTC
    If you can, install Date::Manip from CPAN. Otherwise, try a solution with one of the modules you have installed, maybe DateTime.
      Date::Manip module is installed. But when I use the code
      #!/usr/bin/perl use strict; use warnings; use Date::Manip; my $date_manip_object = new Date::Manip; $date_manip_object->parse( '2 days ago' ); $date_manip_object->convert( 'GMT' ); my $gmt_ref = $date_manip_object->printf( '%Y%m%d') ; while (<DATA>) { my $err = $date_manip_object->parse_format('.*?\\[%d/%b/%Y:%T\s+%z +\\].*', $_); next if $err; # skip (?) lines that do not match the date format my $input_line_date = $date_manip_object->printf( '%Y%m%d') ; if ($input_line_date eq $gmt_ref) { print; } } __DATA__ - - [15/Jun/2010:23:30:34 +0000] - - - [16/Jun/2010:23:30:34 +0000] -
      Can't locate object method "new" via package "Date::Manip" at
        my $date_manip_object = new Date::Manip;

        Where in the documentation did you find that usage? It doesn't work because the module does not work that way. Read Date::Manip.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://845595]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2018-02-19 09:50 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (260 votes). Check out past polls.