> From: Bart Lateur <[EMAIL PROTECTED]>
> 
>> The Result object is added afterward using an object method. The problem I
>> am having is that when the Error object's DESTROY method is called, the log
>> object element ($self->{'log'}) is undefined. I thought it shouldn't be
>> destroyed, since there would be an outstanding reference.
> 
> That doesn't make sense. If you ask me, there IS no log object. If the
> log object did exist but was destroyed prematurely, there would still be
> a, invalid but definitely defined, reference in $self->{'log'}.

One may think so, but how I detected the problem was that the error object
would write a message to the status log (using the log object as
$self->{log}) when it was instantiated, validating that the constructor
worked. It would also write a message indicating its destruction in the
DESTROY method, which would never appear in the log. As a matter of fact,
the script would stop without a peep right at that point, since I had code
after that point that printed messages, which would appear if I moved the
code above the logging statement. I also inserted print statements to see
what was contained in the object properties, and I would expect a "HASHx"
whatever, but instead nothing was outputted. To be more accurate, I can't
say for certain that the $self->{log} was undefined since I didn't
specifically test for that condition. It simply ceased to be what is was
before (a blessed hash reference).

I will have to chalk this one down as one of the unsolvable mysteries of
Perl (along with disappearing symbols with recursive 'use' imports), since I
rewrote the code such that the pieces which prevented the error object from
instantiating its own logger object became class methods that are called
when the script is loaded. Now it can instantiate its own logger object and
the problem seems to have disappeared.

-K

"Do not meddle in the affairs of dragons, because you are crunchy and taste
good with ketchup."



Reply via email to