]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind.pm
Unload dynamically loaded libraries at END-time
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind.pm
index 3ea8c8fcab54fac8525df48d1e03c8c6c20e98c1..e70a912d2d089512750322f9a8d84fb5165daadb 100644 (file)
@@ -139,7 +139,8 @@ sub import {
   $callers = int $callers;
   my $vg = Test::Valgrind::Suppressions::VG_PATH;
   if (!$vg || !-x $vg) {
-   for (split /:/, $ENV{PATH}) {
+   require Config;
+   for (split /$Config::Config{path_sep}/, $ENV{PATH}) {
     $_ .= '/valgrind';
     if (-x) {
      $vg = $_;
@@ -230,6 +231,12 @@ sub import {
  }
 }
 
+END {
+ if ($run and eval { require DynaLoader; 1 }) {
+  DynaLoader::dl_unload_file($_) for @DynaLoader::dl_librefs;
+ }
+}
+
 =head1 CAVEATS
 
 You can't use this module to test code given by the C<-e> command-line switch.