On Fri, Jul 16, 2010 at 01:45:19PM -0700, Bill Moseley wrote:
> I don't know where to start with this. When I have a problem this weird
> wisdom has shown I'm doing something stupid. So, I'm looking for a sanity
> check and mostly a break from staring at the code, and a gin and tonic
> wouldn't hurt either.
>
> Anyway, I thought I'd share this just in the remote chance someone has an
> idea.
>
> <snip>
>
> Use of uninitialized value $institution in concatenation (.) or string at
> lib/My/TestAccount.pm line 66 during global destruction.
^^^^^^^^^^^^^^^^^^^^^^^^^
This right here is your problem. When global destruction happens (as in,
the program actually exiting, rather than specific objects going out of
scope), the order of destruction is pretty unpredictable, since perl
can't just follow a reasonable order, since that could cause objects in
a memory cycle to not get destroyed at all. It tries, but if you're
doing weird things (or even not so weird things), it can destroy parts
of your object before the object itself is destroyed, and there really
isn't anything that can be done about that. DEMOLISH is called with a
boolean argument for whether the destruction is happening as part of
global destruction, if you want to try to handle it specially, but
generally, "return if $_[0]" is the best you're going to be able to do.
-doy