Skip Menu |

This queue is for tickets about the Date-Calc-XS CPAN distribution.

Report information
The Basics
Id: 85884
Status: new
Priority: 0/
Queue: Date-Calc-XS

People
Owner: Nobody in particular
Requestors: amacleay [...] athenahealth.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Error reading dates from tied hashes in XS
Date: Wed, 5 Jun 2013 08:57:13 -0400
To: "bug-Date-Calc-XS [...] rt.cpan.org" <bug-Date-Calc-XS [...] rt.cpan.org>
From: Andrew MacLeay <amacleay [...] athenahealth.com>
I recently noticed what appears to be a bug in Date::Calc::Decode_Date_US in XS. The issue does not appear using Date::Calc::PP. If the first argument is a tied hash value, Date::Calc::Decode_Date_US doesn't recognize it as a scalar and throws an error. The same error is reproduced in Decode_Date_EU, and I presume in many/most other XS functions. (P) ~@dev200 perl -v | head -n2 This is perl 5, version 16, subversion 2 (v5.16.2) built for x86_64-linux (P) ~@dev200 cat | perl -l -I$PP_LIB use Tie::Hash; use Date::Calc; print $Date::Calc::XS_OK ? "using Date::Calc::XS" : "using Date::Calc::PP"; print "version " . Date::Calc::Version(); my %hash; tie my %tiehash, 'Tie::StdHash'; $hash{VALUE} = $tiehash{VALUE} = '01/01/2013'; print "Starting tests"; print "Untied decode works: @{[ Date::Calc::Decode_Date_US($hash{VALUE}) ]}"; print "Tied value works in PP, dies in XS: @{[ Date::Calc::Decode_Date_US($tiehash{VALUE}) ]}"; exit; ###################################################### ###################################################### using Date::Calc::PP version 6.3 Starting tests Untied decode works: 2013 01 01 Tied value works in PP, dies in XS: 2013 01 01 (P) ~@dev200 cat | perl -l -I$XS_LIB use Tie::Hash; use Date::Calc; print $Date::Calc::XS_OK ? "using Date::Calc::XS" : "using Date::Calc::PP"; print "version " . Date::Calc::Version(); my %hash; tie my %tiehash, 'Tie::StdHash'; $hash{VALUE} = $tiehash{VALUE} = '01/01/2013'; print "Starting tests"; print "Untied decode works: @{[ Date::Calc::Decode_Date_US($hash{VALUE}) ]}"; print "Tied value works in PP, dies in XS: @{[ Date::Calc::Decode_Date_US($tiehash{VALUE}) ]}"; exit; ###################################################### ###################################################### using Date::Calc::XS version 6.3 Starting tests Untied decode works: 2013 1 1 Date::Calc::Decode_Date_US(): argument is not a string at - line 11. I've convinced myself that this issue is due to the definition of the DATECALC_SCALAR macro in the XS file. Unfortunately, I'm not as up on C/XS programming as I might be, so my speculation ends there. Thanks very much for taking a look! Andrew MacLeay amacleay@athenahealth.com<mailto:amacleay@athenahealth.com> / a.macleay@gmail.com