I am working with the perl Template-Toolkit with DateTime objects.
When I try to use the DateTime object:
[% dt.year %]
in the TT template the script dies:

undef error - Cannot compare a datetime to a regular scalar at 
/usr/local/lib/perl5/site_perl/5.8.7/i686-linux/DateTime.pm line 1397

I have traced the problem to the _dotop subroutine in Stash.pm of Template 
Toolkit.
The code in the subroutine tries to test for reference equality with the eq 
operator:
$foo eq $baz
DateTime object reference happens to be on the left side of the eq operator 
which is overloaded in  DateTime in such a way that it dies when an object 
of uncomparable type is encountered.

I've managed to hack the source to be like
"$foo" eq "$baz"
This performs a string comparison of references represnetation and is 
obviously inefficient.

Are there any ways to test whether the two references point to the same 
thing?




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to