There's a section re: subclassing the module near the end of the pod. I was able to have the script work by burying XDate into another namespace:
use X::XDate; use Date::Calc::Object; my $x = X::XDate->new(2011,3,12); my $y = X::XDate->new(2011,4,12); my $m = Date::Calc->new(2011,3,12); my $n = Date::Calc->new(2011,4,12); $x++; print "hello\n" if ($x>$y); print "egg\n" if ($m >$n); On Mon, Apr 11, 2011 at 4:44 PM, Ludwig Isaac Lim <[email protected]>wrote: > Hi: > > I have 1 one perl module called "XDate.pm" which is a subclass of > Date::Calc::Object > (http://search.cpan.org/~stbey/Date-Calc-6.3/lib/Date/Calc/Object.pod) > > > Source code is : > > ############################## > # Source code for XDate.pm > ############################## > > > use strict; > use warnings; > > > package XDate; > > use Date::Calc::Object qw(:ALL); > use Carp; > > our @ISA=qw(Date::Calc::Object); > > > > # > 1; > > > A perl script (y.pl uses XDate class) > > ################################## > # source code y.pl > #################################### > > use XDate; > use Date::Calc::Object; > > my $x = XDate->new(2011,3,12); > my $y = XDate->new(2011,4,12); > > my $m = Date::Calc->new(2011,3,12); > my $n = Date::Calc->new(2011,4,12); > > > > $x++; > > print "hello\n" if ($x>$y); > > print "egg\n" if ($m >$n); > > > > It seems that if ($x > $y) will throw an error, but $x++ will work. Is > operator > overload for perl selective? If I comment the block if ($x > $y), the if > ($m > > $n) will work, which makes me wonder about inheritance of overloaded > operators. > > The error I got is " Date::Calc::_compare_date_(): illegal operand type at > ./y.pl line 19" > > According to the POD of the Date::Calc::Object both ">", and "++" are > overloaded > > Regards, > Ludwig > > _________________________________________________ > Philippine Linux Users' Group (PLUG) Mailing List > http://lists.linux.org.ph/mailman/listinfo/plug > Searchable Archives: http://archives.free.net.ph > -- I don't Yahoo! anymore :-) Yehey!
_________________________________________________ Philippine Linux Users' Group (PLUG) Mailing List http://lists.linux.org.ph/mailman/listinfo/plug Searchable Archives: http://archives.free.net.ph

