mathieu has asked for the wisdom of the Perl Monks concerning the following question:
edt.plpackage 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;
running perl edt.pl I have :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() );
perl -v outputs :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.
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
Thanks for your help.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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Inheritance problem with DateTime version > 0.61
by Anonymous Monk on Oct 13, 2011 at 13:34 UTC |