[Rt-commit] [svn] r1776 - in Module-Refresh: . inc/.author lib/Module t

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Wed Nov 10 05:00:26 EST 2004


Author: jesse
Date: Wed Nov 10 05:00:26 2004
New Revision: 1776

Removed:
   Module-Refresh/inc/.author/
Modified:
   Module-Refresh/   (props changed)
   Module-Refresh/lib/Module/Refresh.pm
   Module-Refresh/t/1api.t~
Log:
 r9017 at tinbook:  jesse | 2004-11-10T09:21:57.928079Z
 
 
 r9018 at tinbook:  jesse | 2004-11-10T10:01:29.891706Z
 First cut at actual symbol deletion
 
 


Modified: Module-Refresh/lib/Module/Refresh.pm
==============================================================================
--- Module-Refresh/lib/Module/Refresh.pm	(original)
+++ Module-Refresh/lib/Module/Refresh.pm	Wed Nov 10 05:00:26 2004
@@ -5,6 +5,9 @@
 
 $VERSION = 0.01;
 
+# Turn on the debugger's symbol source tracing
+BEGIN {$^P |= 0x10};
+
 =head1 SYNOPSIS
 
     my $refresher = Module::Refresh->new();
@@ -88,8 +91,10 @@
 sub unload_module {
     my $self = shift;
     my $file = shift;
+    my $path =  $INC{$file};
     delete $INC{$file};
     delete $CACHE{$file};
+    $self->cleanup_subs($path);
     return ($self);
 }
 
@@ -118,16 +123,19 @@
 
 Wipe out  subs defined in $file.
 
-
 =cut
 
 
 sub cleanup_subs {
-
     my $self = shift;
     my $file = shift;
-}
 
+    # Find all the entries in %DB::sub whose keys match "$file:" and wack em
+    foreach my $sym ( grep { $DB::sub{$_} =~ qr{^\Q$file:\E} } keys %DB::sub ) {
+       warn $sym;
+        undef &{$sym};
+    }
+}
 
 =head1 BUGS
 

Modified: Module-Refresh/t/1api.t~
==============================================================================
--- Module-Refresh/t/1api.t~	(original)
+++ Module-Refresh/t/1api.t~	Wed Nov 10 05:00:26 2004
@@ -40,6 +40,9 @@
 
 is(Foo::Bar->foo, 'baz', "We got the right new result,");
 
+use YAML;
+YAML::Dump (\%DB::sub);
+
 
 
 package Foo::Bar;


More information about the Rt-commit mailing list