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