Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Running a sub before a script exits?

by dws (Chancellor)
on Aug 25, 2002 at 04:09 UTC ( [id://192631]=note: print w/replies, xml ) Need Help??


in reply to Running a sub before a script exits?

I am using the below code in a script and cannot figure out how to automatically run the sub save_config before the script exits.

END { save_config() }

Ignore that. rattusillegitimus has a better answer below.

Replies are listed 'Best First'.
Re: Re: Running a sub before a script exits?
by Anonymous Monk on Aug 25, 2002 at 04:49 UTC
    Not necessarily.

    In most versions of Perl if your variable is pointed at by a global, it is DESTROYed haphazardly in global destruction. Therefore you may not have a config left to save when DESTROY is called. But you always should in END.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://192631]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-24 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found