Re: [Perlunit-devel] Problem with namespace
Status: Beta
Brought to you by:
mca1001
|
From: Adam S. <ad...@sp...> - 2002-03-04 14:38:40
|
jonasbn (jo...@wa...) wrote:
> The name (_name) field clashes, I guess that name is probably the most used
> field in OOP. It should therefore not be used in Test::Unit::TestCase.
You're quite right. Thanks for pointing this out.
> Changing the internal field to Test::Unit::TestCase::_name_of_test is not a
> valid solution though :-/
>
> So a proper namespace protection scheme should be implemented. I have tried to
> fool around with this (using Tie::Securehash) without any luck, since the
> Assert.pm tries to access the _no_backtrace_on_fail at runtime.
>
> Either the component structure should be change or a different scheme should be chosen.
This is one of the nasty things about perl. However, I think the
solution suggested by perlobj ($self->{__PACKAGE__ . '_foo'}) is good
enough, so I've just committed a general fix which adopts this
convention for TestCase objects. Actually, now I've committed it, it
occurs to me that $self->{__PACKAGE__}{foo} is an even nicer
convention, but I can't be bothered to change it again now :-)
|