[Pdx-pm] interesting testing hole thats been dug

Wil Cooley wcooley at nakedape.cc
Thu Jan 4 10:04:34 PST 2007

On Wed, 2007-01-03 at 21:27 -0800, Michael G Schwern wrote:

> That's going in the right direction, allowing users to pass in
> elements of your object's composition rather than hard coding it all.
> Why not make that option available publicly?  That way they can use a
> different subclass of Net::FTP.  Or pass in a differently configured
> Net::FTP object.  Or a mock object for testing, just like you're
> doing.

Hm, yes, indeed that's reasonable.

> While testing, if you find your existing interface inadequate chances
> are your users will, too.  That's why its better to add to the public
> interface rather than put in private testing hacks.

Yes, that certainly makes sense.  It obviously doesn't make sense to
require $obj->isa('Net::FTP'), because with duck-typing it doesn't
actually have to be a subclass.  How thoroughly should I test with
$obj->can() for the object's abilities?

Wil Cooley <wcooley at nakedape.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.pm.org/pipermail/pdx-pm-list/attachments/20070104/42c9ecdd/attachment.bin 

More information about the Pdx-pm-list mailing list