Click here to get back home

UNIVERSAL::can function failing under heavy load

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
UNIVERSAL::can function failing under heavy load lee 08-25-2005
Get Chitika Premium
Posted by xhoster on August 26, 2005, 6:10 pm
Please log in for more thread options


> wrote:
>
> [snip]
>
> > BTW, @Deep_copy_stack doesn't seem to be lexically scoped. I dont' see
> > how that would cause this particular problem, but I'd fix it anyway
> > just in case.
>
> Presumably, @Deep_copy_stack is scoped outside of the _deep_copy
> subroutine so that recursive calls to _deep_copy will be accessing the
> same version of @Deep_copy_stack to prevent infinite recursion in the
> case of a circular reference.

Yep, that is the way I do it, too. Until I learn my lesson, and go back
and change it is so that the master call passes in a ref to a (possibly
anonymous) array or hash, and every recursive invocation simply passes that
ref along:

foo($structure_to_be_recursed, {}); ## or [] rather than {}

sub foo {
my $struct=shift;
my $guard=shift;
## blah blah blah
foo($new_struct,$guard);
## blah blah blah.
};

> The OP has shown us only the _deep_copy
> subroutine, so we can't tell.

True, but it seems to me that it must be either a lexical with the
potential to become unshared (since this is run in mod_perl), or a
non-lexical variable. Either way, it makes me uncomfortable. I don't have
any reason to think that this is the problem, but whenever Perl behaves in
a way that seems mysterious my first step is to tighten scopes and convert
to lexicals, and that often either clears up or eliminates the mystery
(either directly or indirectly)

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB


Posted by lee on August 26, 2005, 10:18 am
Please log in for more thread options


The load is due to many hits to the web site using this code.

Thanks for the input on the code.



Similar ThreadsPosted
tests failing for .xs routines October 4, 2005, 10:19 am
LWP connect failing - bad hostname June 7, 2006, 12:28 pm
perl-gtk installation failing on Solaris March 20, 2007, 7:28 am
Net::POP3 quit failing, cannot delete some spam email August 31, 2004, 10:13 am
Failing to install IPTables::IPv4 perl module June 30, 2005, 11:10 am
Unable to load module March 16, 2006, 12:00 am
make test failing on Berkeley DB 4.5/perl 5.8 (and 5.6) on BSD6/AMD64 November 29, 2006, 4:44 pm
Encode::Guess load ISO-8859-1 March 27, 2006, 10:09 am
Devel::Cover failing with 'bizarre copy of hash in leave' error October 21, 2004, 2:09 pm
Which module should I use in order to load files over the internet? October 5, 2006, 3:38 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap