Skip Menu |

This queue is for tickets about the Brick CPAN distribution.

Report information
The Basics
Id: 26729
Status: resolved
Priority: 0/
Queue: Brick

People
Owner: Nobody in particular
Requestors: agianni [...] buffalo.edu
Cc:
AdminCc:

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



Subject: error handling in Brick::Results->flatten_by_field()
I am, as of yet, unable to reproduce this, but something in the processing of input against a profile seems to be generating a result hash with some odd contents. Most recently, I ran into a situation where an error entry pointed to a coderef rather than a hashref. This creates a problem because the code that goes through each error entry checks to see if it's a ref or not, and not that it's specifically a hashref. This means that if it's some other kind of reference (coderef, arrayref) it will get through the unless block, but die fatally when it encounters an attempt to dereference it as a hash. For now, I've replaced this: # is it a single error or a composition? unless( ref $hash ) { next; } with this: # is it a single error or a composition? if ( not ref $hash ) { next; } elsif ( ref $hash ne 'HASH' ) { use Data::Dump::Streamer; croak "encountered unexpected result: ", Dump($hash); } in an attempt to help me maintain my sanity. I'm going to work on reproducing this problem, but I wanted to log this before I lost track of it. It strikes me that better error checking needs to happen either here or in the building of the result hash, or both.
In Result.pm, I've added checks to ensure that the argument is a hash reference. If it isn't, there is now a warning and the routines skip that entry. I can tighten the code up, but this is the intermediate fix that allows you to track down the points where something odd got into the error hash. Additionally, there are improvements in Brick::apply() to catch other things too.
Fixed in 0.226_01