You can use signal handlers

$::SIG{__DIE__} = \&cgi_die;

This will be invoke cgi_die sub when ever the script dies

You can also look at

perldoc sigtrap

Same signal names used in unix signal used here.

I suggest to look at 

sigtrap perldoc

- Venkat

-----Original Message-----
From: David Freeman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 25, 2001 4:05 PM
To: [EMAIL PROTECTED]
Subject: RE: appending to file?



now thet append works.  is there a way that you can send a kill signal and 
have the option within the script to stop after a certain point?  In Visual 
basic you just had to do a end; type of command.

If i wanted to append to the file what $email and $action values are, how 
would i do so?

At 04:00 PM 7/25/01 -0700, you wrote:



>guess i'll try that and see what happens. =)
>
>
>>Are you closing the APPEND file at the end of the process?
>>
>>-----Original Message-----
>>From: David Freeman [mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, July 25, 2001 3:51 PM
>>To: [EMAIL PROTECTED]
>>Subject: appending to file?
>>
>>
>>
>>
>>ok last question on this script for today.  According to the book i should
>>be able to do
>>
>>open(Filehandle, ">> Filename") || die "Can't Open Filename $!\n";
>>print Filehandle "just appended to the end of filename. \n";
>>
>>and anything after the filehandle in the second line would be what is
>>appended to Filename.  I've made a test file to try and append to from my
>>script but it doesn't ever show up in that file.  I think maybe my While
>>statement is forever going, but don't know how to break free and move on
to
>>the next lines of the script.
>>
>>Thanks
>>
>>#!/usr/bin/perl -w
>>#Script to add e-mail or domain name to /etc/mail/access file
>>#if not already present.
>>
>>#use strict;
>>#use warnings;
>>
>>my $email;
>>my $action;
>>my $newarray;
>>
>>open(NAMES,"/etc/mail/access") || die "Can't open access: $!\n";
>>while (<NAMES>){
>>          ( $email, $action )= split(/\t/);
>>          $newarray{$email} = $action;
>>}
>>close NAMES;
>>
>>while(1){
>>          print "Look for what domain in spam filter? ";
>>          chomp($email=<STDIN>);
>>          last unless $email;
>>                  if( exists $newarray{$email} ){
>>                  print $newarray{$email}, "\n";
>>          }else{
>>                  print "How you wanna handle this one? ";
>>                  my $action;
>>                  chomp( $action = <STDIN> );
>>                  $newarray{$email} = $action;
>>
>>          }
>>open(APPEND,">>testfile") || die print "Can't open testfile: $!\n";
>>#line above to eventually open /etc/mail/access and append $email &
$action
>>#to file.
>>print APPEND "test of append function. \n"; #to show that file has been
>>added
>>}
>>
>>
>>David M.R. Freeman
>>webmaster sysadmin for MMP, Inc.
>>web:            www.woodfreeman.com
>>e-mail: [EMAIL PROTECTED]
>>phone:  (253) 564-5902
>>fax:            (253) 565-1811
>
>David M.R. Freeman
>webmaster sysadmin for MMP, Inc.
>web:            www.woodfreeman.com
>e-mail: [EMAIL PROTECTED]
>phone:  (253) 564-5902
>fax:            (253) 565-1811

David M.R. Freeman
webmaster sysadmin for MMP, Inc.
web:            www.woodfreeman.com
e-mail: [EMAIL PROTECTED]
phone:  (253) 564-5902
fax:            (253) 565-1811

Reply via email to