Re: Inappropriate ioctl for device
- From: chas.owens@xxxxxxxxx (Chas. Owens)
- Date: Mon, 31 Mar 2008 11:10:49 -0400
On Sun, Mar 30, 2008 at 10:56 PM, John W. Krahn <krahnj@xxxxxxxxx> wrote:
PekinSOFT@xxxxxxxxx wrote:snip
>
> On Mar 30, 6:54 am, kra...@xxxxxxxxx (John W. Krahn) wrote:
>>
>>die() exits the program.
> Yes, I understand that die() exits the program. My question was are
> you able to process more than one line of code in a die() context?
die(), like print() and warn(), prints a list of strings. To do what I
think you are trying to do:
open my $FH, '<', 'somefile' or do {
# some statement here;
# and another statement;
# and finally;
die "some string here";
};
There are at least three ways to do this. The way above is good if
this is something that needs to happen only on this error. If you
always want a piece of code to run when an error occurs you can
override the __DIE__ signal:
$SIG{__DIE__} = sub {
#do stuff like write to a log file
}
And if you need something to always run at the end of your program
(regardless if there was an error or not), you can use an END block:
END {
print "This will always run at the end of the program, regardless
of die() or exit()\n";
}
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
.
- References:
- Inappropriate ioctl for device
- From: PekinSOFT
- Re: Inappropriate ioctl for device
- From: John W. Krahn
- Re: Inappropriate ioctl for device
- From: PekinSOFT
- Re: Inappropriate ioctl for device
- From: John W. Krahn
- Inappropriate ioctl for device
- Prev by Date: Re: parser using perl
- Next by Date: Re: parser using perl
- Previous by thread: Re: Inappropriate ioctl for device
- Next by thread: pdf protection for generated pdfs
- Index(es):
Relevant Pages
|