Hi Monks, I've got a problem following the upgrade from DateTime v0.61 to DateTime v0.70 my custom date module is not working anymore, apparently due to the changes to how the new() method is now called. On this current code, I'm having errors now with v0.70 and none with v0.61 : edt.pm
package edt; use strict; use DateTime; our @ISA = qw/ DateTime /; sub new { my $proto = shift; my $class = ref($proto) || $proto; my %h_p = @_; $h_p{year} = '2011'; my $self = $class->SUPER::new( %h_p ); $self->{_TZONE} = $h_p{time_zone}; return bless($self, $class); } sub custom { print "in custom module\n"; } 1;
edt.pl
use strict; use lib qw( . ); use edt; my $edt = new edt(); print "DateTime::VERSION = ".$DateTime::VERSION."<\n"; print $edt->epoch()."\n"; $edt->custom(); # dies here $edt->from_epoch( epoch => time() );
running perl edt.pl I have :
DateTime::VERSION = 0.70< 1293840000 in custom module Can't locate object method "_normalize_nanoseconds" via package "2011- +01-01T00:00:00" at /usr/lib/perl5/DateTime.pm line 253.
perl -v outputs :
erdev1:/home/eureca/Eulerian-Eureca# perl -v This is perl 5, version 12, subversion 4 (v5.12.4) built for i486-linu +x-gnu-thread-multi-64int (with 46 registered patches, see perl -V for more detail) Copyright 1987-2010, Larry Wall
erdev1:/home/eureca/Eulerian-Eureca# uname -a Linux erdev1 2.6.38-2-686-bigmem #1 SMP Sun May 8 15:43:39 UTC 2011 i6 +86 GNU/Linux
Thanks for your help.

In reply to Inheritance problem with DateTime version > 0.61 by mathieu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.