Using die in perl module
Atif Ghaffar
atif.ghaffar at gmail.com
Tue Feb 24 01:37:40 MSK 2009
Hi all,
I would like to know the consequence in using alarm and die in a
perl-handler.
For example consider this
http://wiki.codemongers.com/NginxEmbeddedPerlImageResize
The blocking code is the following
$image= new Image::Magick;
$image->Read($real_file_path);
$image->Scale($dimensions);
$image->Write($dest_file);
Sometimes this code can hold all resources and normal requests cannot be
served.
So if I follow the example from mod_perl and die in 2 seconds, what will be
the consequence to the current requests?
my $timeout = 2; # seconds
eval {
local $SIG{ALRM} =
sub { die "Sorry, timed out. Please try again\n" };
alarm $timeout;
# the operation listed above
alarm 0;
};
die $@ if $@;
--
best regards
Atif Ghaffar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090223/3fd005e5/attachment.html>
More information about the nginx
mailing list