I am writing a loader program to decrypt source files and run them. Each source file holds a Curses::UI based program which contain subroutines that the user may use to exit the user interface. I need to run some clean up after the user exits though and am not sure how to catch these exit or die calls so the clean-up code that comes after the required files will execute, any ideas?
I am writing a loader program to decrypt source files and run them. Each
Share
You can catch
diecalls by wrapping the code in anevalblock, as in:This won’t help for
exitthough. You could have code that runs to cleanup afterexitin anEND{}block, I believe, but note that this will be run after any exit, not just if your required module exits.Read more about END blocks in
perldoc perlmod