in reply to Odd eval Problem
We've used a similar technique in Everything to speed up common page components, and haven't run into any trouble with eval "filling up". There are reports that certain versions of Perl have a leak in eval-string constructs, but it's more likely you'll run out of memory first.my $Hack = 'sub {' . $Subroutine->[2] . '}'; my $sub = eval "$Hack"; undef &{ *VWP_GenQueryHTML{CODE} }; *VWP_GenQueryHTML = $SubRef;
There's no error checking to see if the compilation fails, and, if you're not extremely careful on the code from the database, it's easy to create some code that'll fail right off the bat
For example, if you have a comment as the last line of the code in the database, the interpreter won't see the closing brace of the subroutine declaration.
I'd definitely check $@ to see if the eval failed and I'd make sure $sub and &$sub are both defined before assigning to the glob.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Odd eval Problem
by nontrivial (Novice) on Jun 11, 2001 at 05:41 UTC | |
|
Re: Re: Odd eval Problem
by nontrivial (Novice) on Jun 11, 2001 at 20:01 UTC |