exodist has asked for the wisdom of the Perl Monks concerning the following question:
I am writing a perl module for people to use in a script. Currently they have to end their scripts with run_tasks(); which is annyoing, there is never a case where they will not want it at the end. I first planned to use END {} in the module, and it worked at first, however I removed it because of advice of some skilled perl guys I know. Recently I tried again, however the module has grown large with a lot of other modules as parts, and END {} causes issues.
I do still want a mechanism to make the module run a method after the calling script has exited. What are my options, do I just have to try and find why END causes problems and fix it?
Update: Actually if I understand END I know why it fails, the function it will call depends on a lot of modules the main one has loaded, and since end is run when the module finishes in order the other modules end and go away before the END is called for this module.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Module that runs task after script that runs it finished
by Corion (Patriarch) on Jan 23, 2009 at 09:31 UTC | |
|
Re: Module that runs task after script that runs it finished
by CountZero (Bishop) on Jan 23, 2009 at 09:25 UTC | |
by exodist (Monk) on Jan 23, 2009 at 17:38 UTC | |
|
Re: Module that runs task after script that runs it finished
by chromatic (Archbishop) on Jan 23, 2009 at 06:43 UTC |