Skip Menu |

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

Report information
The Basics
Id: 77503
Status: new
Priority: 0/
Queue: Data-Visitor

People
Owner: Nobody in particular
Requestors: CHOCOLATE [...] cpan.org
Cc:
AdminCc:

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



Subject: Data::Visitor::Callback transform: blessed hashref is doubly blessed
Converting an unblessed hashref into: bless { val => $hashref }, 'Example' via Data::Visitor::Callback (hash callback) results in: bless { val => bless { val => $hashref }, 'Example' }, 'Example' I've attached two tests. should_fail.t should fail but passes. should_pass.t should pass but fails. Tested on perl 5.10.1 (Ubuntu 11.04) with Data::Visitor 0.28. Thanks, chocolateboy.
Subject: data_visitor_callback_should_fail.t
#!/usr/bin/env perl use strict; use warnings; use Data::Dump qw(pp); use Data::Visitor::Callback; use Test::More tests => 1; my $visitor = Data::Visitor::Callback->new( hash => sub { bless { val => $_ }, 'Example' } ); my $test = { foo => 'bar' }; my $got = $visitor->visit($test); my $want = bless { val => { foo => 'bar' } }, 'Example'; $want = bless { val => $want }, 'Example'; is_deeply ($got, $want);
Subject: data_visitor_callback_should_pass.t
#!/usr/bin/env perl use strict; use warnings; use Data::Dump qw(pp); use Data::Visitor::Callback; use Test::More tests => 1; my $visitor = Data::Visitor::Callback->new( hash => sub { bless { val => $_ }, 'Example' } ); my $test = { foo => 'bar' }; my $got = $visitor->visit($test); my $want = bless { val => { foo => 'bar' } }, 'Example'; # $want = bless { val => $want }, 'Example'; is_deeply ($got, $want);