perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angus Lees <...@inodes.org>
Subject @param not cleaned up in HTML::Embperl (patch)
Date Wed, 25 Feb 2004 01:40:20 GMT
(Just in case anyone is still using HTML::Embperl..)

@param is shoved into the correct package via a glob assignment (same
as other "magic variables").  These variables are marked as "imported"
by perl and HTML::Embperl::cleanup() skips them - which is mostly ok for
other variables, since they are simple scalars.  @param however, could
hold all sorts of large (or important) objects until that particular
file is executed again.

I haven't tested Embperl (v2), but a quick visual check through the
relevant source sections makes me think this problem doesn't exist
there (the "importing" is done differently).


Here's a simple patch to cleanup @param at the end of Execute():

--- orig/Embperl.pm
+++ mod/Embperl.pm
@@ -1013,6 +1013,11 @@
            if ( defined $saved_param ) {
                no strict 'refs';
                *{"$package\:\:param"} = $saved_param;
+           } else {
+               # $package::param isn't cleaned up during cleanup(),
+               # because it is flagged as "imported"
+               no strict 'refs';
+               undef @{"$package\:\:param"};
            }
 
 
-- 
 - Gus


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message