Subject: | overload bug with Template::Stash |
Using a DFV::Results object in a TT template dies:
Operation `eq': no method found,
left argument in overloaded package Data::FormValidator::Results,
right argument has no overloaded magic at
/usr/local/lib/perl/5.8.7/Template/Stash.pm line 582.
It breaks only when using Template::Stash as TT stash (not with
Template::Stash::XS!).
A test case is attached, the fix is here:
--- lib/Data/FormValidator/Results.pm 2006-01-06 03:11:00.000000000 +0100
+++ lib/Data/FormValidator/Results.pm.new 2006-02-08
21:24:35.000000000 +0100
@@ -21,7 +21,8 @@
use Data::FormValidator::Constraints (qw/:validators :matchers/);
use vars qw/$AUTOLOAD $VERSION/;
use overload
- 'bool' => \&_bool_overload_based_on_success;
+ 'bool' => \&_bool_overload_based_on_success,
+ fallback => 1;
$VERSION = 4.10;
Subject: | tt_and_overload.t |
use Test::More;
use Data::FormValidator;
eval 'use Template; use Template::Stash';
plan skip_all => 'Template Toolkit required' if $@;
my $results = Data::FormValidator->check( {}, {required => 1} );
my $tt = Template->new( STASH => Template::Stash->new );
$tt->process( \'[% form.missing %]', {form => $results}, \my $out );
if ( $tt->error ) {
plan tests => 1;
unlike $tt->error->info, qr/Operation `eq': no method found/, 'missing fallback in DVF::Results';
}