Subject: | Bug with Data::FormValidator::Results |
Date: | Wed, 19 Nov 2008 03:11:20 +0100 (CET) |
To: | bug-Data-FormValidator [...] rt.cpan.org |
From: | Robin Clarke <robin [...] robinclarke.net> |
Hello!
I'm not sure if this is considered a bug, but it's something which took me
by surprise, and if it's a "feature", should be documented:
Here's a simplified example of how I was using the Data::FormValidator:
sub function
{
my $hashref_input = shift;
my $check = Data::FormValidator->check( $hashref_input, { # conditions } );
# At this point ref( $check ) shows Data::FormValidator::Results
return $check;
}
my $results = &function( $hashref_input );
# Now $results is the result of $results->success(), and so calling
# $results->valid() causes an error
I got around this by dereferencing/referencing:
return \$check;
}
my $results = ${ &function( $hashref_input ) };
But this is not "nice".
It'd be real cool if you could document, or fix this feature, and save
others some headache.
Best winds,
-Robin-
--
P.S. Check out my revamped, bloggish website: http://robinclarke.net/