Mr. Shawn H. Corey wrote:
> 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.
> 
> 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:

If you use the package name then you don't need to use our():

$ perl -Mwarnings -Mstrict -le'$main::var = q[test]; print $main::var'
test



John
-- 
use Perl;
program
fulfillment

-- 
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