On Thu, 2005-02-17 at 13:56 -0600, Barksdale, Ray wrote: > The module containing $hash is loaded in startup.pl at boot. > I then have a package that creates an object based on a slice of the hash: > > package FooBar; > > use Config qw($hash); > > sub new { > my ($class, $table, $field) = @_; > > # bless hash slice instead of copying to {} and blessing > my $self = bless $hash->{$table}->{$field}, $class; > > return $self;
Does that work? It looks really strange to me, and may be doing some copying. > My question is will this cause $hash (or the used parts) to come unshared > in mod_perl2? Probably. There are some random factors involved here, like page boundaries. > Does Perl mark the anonymous hash ($hash->{$table}->{$field}) > as being blessed into FooBar thereby causing a copy-on-write? It does mark variables when you bless them. Why don't you do all of this before forking? - Perrin