Tom Allison wrote:
I'm trying to refactor an application I wrote a few months ago and ran
into a question about SIG{TERM}.

Currently I have a single application that uses the approach of:

my $please_die = 0;
$SIG{TERM} = sub {$please_die = 1 };

to control when I should exit out of different loops and structures.

But if I have a script that uses objects, how to I propogate this to the
objects from the main script?

The process to 'please_die' would be to exit nicely from each of the
current objects and propogating this all back to the main script and
closing out nicely.

hints?


You can access variables in another package by fully qualifying the name. As in:

  return if $main::please_die;

But you would have to make them 'our' variables:

  our $please_die = 0;


--

Just my 0.00000002 million dollars worth,
   --- Shawn

"For the things we have to learn before we can do them,
we learn by doing them."
  Aristotle

"The man who sets out to carry a cat by its tail learns something that
will always be useful and which will never grow dim or doubtful."
  Mark Twain

"Believe in the Divine, but paddle away from the rocks."
  Hindu Proverb

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to