Object-InsideOut - Object::InsideOut and Test::Deep, the worst ennemies?

Posted on Thu Apr 5 06:29:36 2007 by geraud
Object::InsideOut and Test::Deep, the worst ennemies?
Heya all, I was writing some tests on a project at work using OIO when I stumbled upon a little annoyance. I'm not really sure to know which of the two modules should be considered the 'guilty' one (if any), but since this forum is more active than Test::Deep's one and the problem is user-visible via OIO, I come here first in search of wisdom.

So here's a reproducible case (my_test.t):
#!/usr/bin/perl -w use strict; package MyObj; { use Object::InsideOut; my @data :Field :Std(data) :Arg(Name => 'data', Mandatory => 1); sub push_data { my ($self, $str); my $new_data = $self->get_data() . $str; $self->set_data( $new_data ); return $new_data; } } package main; use Test::More 'no_plan'; use Test::Deep; can_ok('MyObj', 'push_data'); eval { my $obj = MyObj->new(); }; if ($@) { print $@->full_message(); }
If you run my_test.t, you'll get several warnings about "Use of uninitialized value in concatenation (.) or string at .../Object/InsideOut/Exception.pm line 124.". Now if you remove the 'use Test::Deep;' line, the warnings are gone. Note also that this is triggered only when doing something with the OIO::Args object, i.e. if you remove the print line but still use T::D, no warnings.

With a 'print Dumper $@;' it shows that if T::D is used, the $@->{file|package|line} are gone as well as the frames array in $@->{trace}. After that, I'm lost. Does anyone have an idea about how I could still use T::D while silencing those warnings?

Thanks Jerry and other contributors for the work on OIO, totally amazing module I must say.

G.
Direct Responses: 4769 | 4773 | Write a response