in reply to Re^2: Bootstrapping and cleaning after remote execution of method in framework consisting of multiple modules
in thread Bootstrapping and cleaning after remote execution of method in framework consisting of multiple modules

What about deleting the temporary directory while running the script? On Debian GNU/Linux 4.0 "etch" the following works for me:
# file test/script.pl use Foo; system('cd ..; rm -rf test/'); print Foo::bar(); # file test/Foo.pm package Foo; sub bar { return "I'm happy\n"; } 1

If I run script.pl from its directory, it loads package Foo correctly, and deletes itself and the module. Afterwards both the script and the module still work.

If you implement that (very carefully, make sure you delete the right directory), you can clean up behind you very neatly.

A big warning: you can cause much damage with such a script...

  • Comment on Re^3: Bootstrapping and cleaning after remote execution of method in framework consisting of multiple modules
  • Download Code