Subject: | T::MO::Extends documentation misleading |
Test::MockObject::Extends v1.01
Perl v5.8.8
Debian GNU/Linux, kernel 2.5.16, mostly "stable", some "testing"
packages.
Documentation said
my $object = Some::Class->new();
my $mock_object = Test::MockObject::Extends->new( $object );
I assumed from this that I could still use $object independently of
$mock_object, but I can't, since Test::MockObject::Extends::new actually
blesses $object into a new package and returns it.
I think the documentation should actually say
my $object = Some::Class->new();
$object = Test::MockObject::Extends->new( $object );
or perhaps just
my $object = Some::Class->new();
Test::MockObject::Extends->new( $object ); # modifies $object in place
or make it clear in some other way that T::MO::Extends::new changes the
class of the object you pass it.
Thanks for lots of great test packages & for _Perl Testing_. :)
-- Larry Clapp