in reply to Module that runs task after script that runs it finished

Difficult to give a detailed answer for the reason why your END-block does not run the way you expected it to run, but did you think of making an Object Oriented module and having your users interact with an object? You could then automatically run the object's DESTROY method to do your run_tasks().

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Module that runs task after script that runs it finished
by exodist (Monk) on Jan 23, 2009 at 17:38 UTC
    Actually, this is an ideal solution! My module provides functions, but they all methods, when called in function form they use a global object for self instead of shift. So this is perfect for my needs, I will add a destroy method that does it.