chromatic wrote:
> On Fri, 2004-05-21 at 09:02, Geoffrey Young wrote:
> 
> 
>>another thing that is keeping me from 100% right now is the
>>classic
>>
>>  my $class = ref $self || $self;
>>
>>where the only way to satisfy the conditional is to call My::Foo::bar()
>>using functional syntax instead of a method syntax.
> 
> 
> Wouldn't calling that constructor on an existing object satisfy the
> conditional?

I don't think so.  you have three logical pathways to test:

  - T
  - F || T
  - F || F

it's the last one that is "problematic" in typical uses, since the only way
to make $self false, given

  my $self = shift;

is to call the class/object method directly as a functional subroutine with
no arguments, which probably breaks most uses of the API.

still, it's not really about being slave to the green (which is a bad idea)
- you might genuinely care about what happens when someone new to your group
calls something as a function when it should be a method.  or you may have
something like Apache::server_root_relative() which can be called as either
an object method or a function (in which case the proper pool is retrieved
for you).

so it's not necessarily something you _don't_ want to test for.  but if
you're writing tests for a standard OO API you may not want to waste the
time excercising conditions that clearly break the OO paradigm of your
application.

are we OT yet?

> Granted, I'd *never* do that in real code, so I prefer to bury that
> yucky idiom.

I'm merely the test slave at the moment, not the author :)

--Geoff

Reply via email to