water has asked for the wisdom of the Perl Monks concerning the following question:
If I wanted to mock a Foo object using the most excellent Test::MockObject approach, how would I set it up to control the stringification?# untested sample code my $a = Foo->retrieve(999); # $a is CDBI object &some_sub('' . $a); # cast object back to scalar, here 999
Thanks wise and friendly monks!# untested sample code my $mocka = Test::MockObject->new; $mocka->set_isa('Foo'); # ??? how to overload stringification # such that I can mock the result of # '' . $mocka # ???
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mocking Class::DBI stringification
by water (Deacon) on Jul 10, 2005 at 21:09 UTC | |
|
Re: Mocking Class::DBI stringification
by GrandFather (Saint) on Jul 10, 2005 at 21:11 UTC |