perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go...@apache.org
Subject svn commit: r169826 - in /perl/modperl/trunk: Changes todo/bugs_mp todo/release xs/ModPerl/Util/ModPerl__Util.h xs/ModPerl/Util/Util_pm xs/maps/modperl_functions.map
Date Thu, 12 May 2005 14:22:20 GMT
Author: gozer
Date: Thu May 12 07:22:19 2005
New Revision: 169826

URL: http://svn.apache.org/viewcvs?rev=169826&view=rev
Log:
Reintroduce a pure-Perl version of ModPerl::Util::unload_package()
The problematic XS version is now called unload_package_xs() and
not used by default.

Enable the XS version back by defaults with:
  $ModPerl::Util::DEFAULT_UNLOAD_METHOD = 'unload_package_xs';


Added:
    perl/modperl/trunk/xs/ModPerl/Util/Util_pm
Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/todo/bugs_mp
    perl/modperl/trunk/todo/release
    perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h
    perl/modperl/trunk/xs/maps/modperl_functions.map

Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=169826&r1=169825&r2=169826&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Thu May 12 07:22:19 2005
@@ -12,6 +12,10 @@
 
 =item 1.999_24-dev
 
+Reintroduce a pure-Perl version of ModPerl::Util::unload_package()
+The problematic XS version is now called unload_package_xs() and
+not used by default [Gozer]
+
 More APR::Status wrappers:  [Stas, Randy Kobes]
 - is_EOF
 - is_ECONNABORTED

Modified: perl/modperl/trunk/todo/bugs_mp
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/todo/bugs_mp?rev=169826&r1=169825&r2=169826&view=diff
==============================================================================
--- perl/modperl/trunk/todo/bugs_mp (original)
+++ perl/modperl/trunk/todo/bugs_mp Thu May 12 07:22:19 2005
@@ -113,3 +113,8 @@
 * mpxs_Apache2__RequestRec_GETC in Apache_RequestIO.h is out to be
   reimplemented similar to read() w/o using the deprecated
   client_block interface
+
+* Segfaults under Apache::Reload (could be uncovering a bug in mp):
+  http://marc.theaimsgroup.com/?t=111145169900002&r=1&w=2
+  owner: gozer
+-                           

Modified: perl/modperl/trunk/todo/release
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/todo/release?rev=169826&r1=169825&r2=169826&view=diff
==============================================================================
--- perl/modperl/trunk/todo/release (original)
+++ perl/modperl/trunk/todo/release Thu May 12 07:22:19 2005
@@ -5,12 +5,6 @@
 -- see also todo/api_status
 -- see also todo/release-checklist
 
-Segfaults under Apache::Reload (could be uncovering a bug in mp):
-http://marc.theaimsgroup.com/?t=111145169900002&r=1&w=2
-owner: gozer
-
--------------
-
 someone has asked to make $r->request_time settable
 
 -------------

Modified: perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h?rev=169826&r1=169825&r2=169826&view=diff
==============================================================================
--- perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h (original)
+++ perl/modperl/trunk/xs/ModPerl/Util/ModPerl__Util.h Thu May 12 07:22:19 2005
@@ -35,7 +35,7 @@
 #define mpxs_ModPerl__Util_current_callback \
     modperl_callback_current_callback_get
 
-#define mpxs_ModPerl__Util_unload_package(pkg) \
+#define mpxs_ModPerl__Util_unload_package_xs(pkg) \
     modperl_package_unload(aTHX_ pkg)
 
 /* ModPerl::Util::exit lives in mod_perl.so, see modperl_perl.c */

Added: perl/modperl/trunk/xs/ModPerl/Util/Util_pm
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/ModPerl/Util/Util_pm?rev=169826&view=auto
==============================================================================
--- perl/modperl/trunk/xs/ModPerl/Util/Util_pm (added)
+++ perl/modperl/trunk/xs/ModPerl/Util/Util_pm Thu May 12 07:22:19 2005
@@ -0,0 +1,57 @@
+#Extra stuff
+
+our $DEFAULT_UNLOAD_METHOD ||= "unload_package_pp";
+
+sub unload_package {
+    goto &$DEFAULT_UNLOAD_METHOD;
+}
+
+sub unload_package_pp {
+    my $package = shift;
+    no strict 'refs';
+    my $tab = \%{ $package . '::' };
+
+    # below we assign to a symbol first before undef'ing it, to avoid
+    # nuking aliases. If we undef directly we may undef not only the
+    # alias but the original function as well
+
+    for (keys %$tab) {
+        my $fullname = join '::', $package, $_;
+        # code/hash/array/scalar might be imported make sure the gv
+        # does not point elsewhere before undefing each
+        if (%$fullname) {
+            *{$fullname} = {};
+            undef %$fullname;
+        }
+        if (@$fullname) {
+            *{$fullname} = [];
+            undef @$fullname;
+        }
+        if ($$fullname) {
+            my $tmp; # argh, no such thing as an anonymous scalar
+            *{$fullname} = \$tmp;
+            undef $$fullname;
+        }
+        if (defined &$fullname) {
+            no warnings;
+            local $^W = 0;
+            if (defined(my $p = prototype $fullname)) {
+                *{$fullname} = eval "sub ($p) {}";
+            }
+            else {
+                *{$fullname} = sub {};
+            }
+            undef &$fullname;
+        }
+        if (*{$fullname}{IO}) {
+            if (fileno $fullname) {
+                close $fullname;
+            }
+        }
+    }
+
+    #Wipe from %INC
+    $package =~ s[::][/]g;
+    $package .= '.pm';
+    delete $INC{$package};
+}

Modified: perl/modperl/trunk/xs/maps/modperl_functions.map
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/modperl_functions.map?rev=169826&r1=169825&r2=169826&view=diff
==============================================================================
--- perl/modperl/trunk/xs/maps/modperl_functions.map (original)
+++ perl/modperl/trunk/xs/maps/modperl_functions.map Thu May 12 07:22:19 2005
@@ -7,7 +7,7 @@
  mpxs_ModPerl__Util_untaint | | ...
  SV *:DEFINE_current_perl_id
  char *:DEFINE_current_callback 
- DEFINE_unload_package | | const char *:package
+ DEFINE_unload_package_xs | | const char *:package
 
 MODULE=ModPerl::Global
  mpxs_ModPerl__Global_special_list_call



Mime
View raw message