[Magick-bugs] perlmagick 'use Image::Magick' breaks 'CGI.pm'
Walter Higgins
walterh at rocketmail.com
Mon Aug 13 05:11:30 PDT 2007
Hi,
I'm seeing a problem with ImageMagick 6.3.3 and CGI.pm (3.2.9) on
FreeBSD6.2
I have a simple cgi perl script which allows a file upload and uses the
CGI ':standard' package.
I also 'use Image::Magick ;'
There appears to be a problem in that if I 'use Image::Magick' then the
CGI.pm fails when creating a new CGI() object with the following
error...
CGI.pm: Server closed socket during multipart read (client aborted?).
... however...
if I change the 'use Image::Magick' to a 'require Image::Magick' and do
all my cgi-related stuff before the 'require Image::Magick' statement,
then the script runs fine.
What I'm guessing is that 'use Image::Magick' loads and executes the
Image::Magick.pm file and somewhere in this file, the STDIN stream is
being read or closed, so that when 'new CGI();' is called it fails .
Can Image::Magick be fixed so that it doesn't do anything to the STDIN
stream at compile-time ?
Here is the sample CGI script...
#!/usr/bin/perl
use strict;
use CGI ':standard';
use CGI::Carp qw(carpout fatalsToBrowser);
use Image::Magick ; # <----- PROBLEM
my $query = new CGI(); # <---- here's where it fails
my $name = $query->param("name");
print "Content-type: text/plain\n\n";
print "Hello $name\n";
--------------------------------
Here is the HTML form ...
<html><body>
<form enctype="multipart/form-data" action="test.pl" method="POST">
<input type="file" name="filename"/>
<input type="text" name="name"/>
<input type="submit" value="submit"/>
</form>
</body></html>
---------------------------------
Here is the workaround...
#!/usr/bin/perl
use strict;
use CGI ':standard';
use CGI::Carp qw(carpout fatalsToBrowser);
my $query = new CGI();
my $name = $query->param("name");
print "Content-type: text/plain\n\n";
print "Hello $name\n";
require Image::Magick ;
...
Has anyone else seen this problem ?
Walter Higgins
____________________________________________________________________________________
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
More information about the Magick-bugs
mailing list