This queue is for tickets about the Data-Diver CPAN distribution.

Report information
The Basics
Id:
108088
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
kevin.broadey [...] ptti.co.uk
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Data-Diver-1.0101 handling of numeric keys
Date: Thu, 29 Oct 2015 15:06:58 +0000
To: "bug-Data-Diver@rt.cpan.org" <bug-Data-Diver@rt.cpan.org>
From: Kevin Broadey <kevin.broadey@ptti.co.uk>
Let me start by thanking you for a great package! I needed to mess with multi-level hashes and Google found Data::Diver at the first attempt. Brilliant idea! I’ve been tripped up a couple of times by the way it handles numeric key values. By default you treat them as indices into arrays rather than hashes. This caused my program to crash unpredictably with array found violations because sometimes my item identifiers are alphanumeric - 1234AB56789 - and something they’re purely numeric. Having RTFM’ed I know I can avoid this problem by converting all my numeric keys to refs to scalars, but this means I have to take a blunderbuss approach and convert *everything* to refs just to be safe. I know I can do this using the \( (@keys) ) paradigm but that’s just irritating to have to do everywhere. The thing that would make it better, IMHO, is to treat numbers a hash indices by default, and require the user to do the ref thing to treat them as array indices. I realise this would be totally non-backward-compatible, so could you do it with a package variable e.g. $Data::Diver::DefaultNumberIsHashIndex = 1 to switch on the behaviour I want? Thanks again for a brilliant chunk of Perl. Much appreciated. Best regards Kevin Broadey


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.