HTTP::GHTTP Problems under Win/mod_Perl

ajt on 2003-04-26T20:14:12

I don't know if anyone else uses Matt's HTTP::GHTTP module, especially on Win32, but it's doing odd things that have been driving me mad over the last few weeks. The problem is that under Apache::PerlRun or Apache::Registry when I try and get any page after I've already got one (either within the instance or a previous one) I don't get any content. It's okay under plain CGI and LWP works fine too!

There is a little code snip below, it works fine as a CGI, but fails under mod_Perl. I know mod_Perl is strange on Win32, but I've not updated to the latest Apache/mod_perl 2.x versions yet. The weird thing is that some times if I leave the machine a while and come back it works again, as if the problem was cleared up if I give it enough time.

I don't know much mod_Perl so I could be just missing something dead simple... I'll have to read more of the "scary eagle" book I suppose, and stop messing about on Windows.... ;-)

#!d:/bin/perl/bin/perl
$|++;
use strict;
use HTTP::GHTTP 'get';
use CGI;

my $q = CGI->new;
print $q->header, $q->start_html, $q->hr;
for (1..3) {
	my $body = get("http://loutre/");	# a local machine on my home network
	if ($body) {
		print "okay"
	} else {
		print "bad"
	}
	print $q->br;
}
print $q->hr, $q->end_html;
%ENV =();
exit;

Time to try the chili I think, perhaps something will make up for today!