On Aug 24, 2005, at 9:25 AM, Perrin Harkins wrote:

I'm not sure what would be dangerous about that, but I guess there must
be a larger context.

Here is an example I gave on Perl Monks for an example of my issue in a larger context:
<x-tad-bigger>
package Base;
sub handler {

my $this = {};
bless $this;
$this->{pac1} = new Package1;
$this->{pac2} = new Package2( pac1 => $this->{pac1} );
# print Dumper $this
}

package Package2;

sub new {

my $class = shift;
my $this = {};
bless( $this, $class );
if (@_) {
my %extra = @_;
@$this{keys %extra} = values %extra;
}
my $pac1 = $this->{pac1};
my $pac3 = new Package3( pac1 => $pac1 );
@$this{pac3} = $pac3;
}
</x-tad-bigger>

<x-tad-bigger>When handler's dumped with Data::Dump shows:
$VAR1 = bless({
pac2 => bless({
pac3 => bless({pac1 => bless({ some => "value" }, Package1 )}, Pac
</x-tad-bigger><x-tad-bigger>+</x-tad-bigger><x-tad-bigger>kage3),
pac1 => $VAR1->{pac2}->{pac3}->{pac1}}, Package2),
pac1 => $VAR1->{pac2}->{pac3}->{pac1}}, Base);

So it would seem this is a circular reference right?
How can I get the info I need in each of these without getting caught by this?

</x-tad-bigger>

What are you trying to tighten up? Are you still just trying to get rid
of the warnings on shutdown?

Yes getting rid of the warnings, would help me sleep better...


The phases of request handling are documented pretty well on the site
and in various mod_perl books. The interpreter won't be shut down until
the process exits, but that may be long before the server is shut down
for a particular process.

I've been using O'reilly books in particular the books in The Perl CD Bookshelf v3.0.
They mentioned an "experimental" WeakRef module for weakening references
to prevent the circular logic thing. But I usually try and have my modules be the
only "experimental" parts of my apps if possible. I just found 13.13. Coping with Circular Data Structures
in the Perl Cookbook, maybe that has my solution.


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

Reply via email to