I didn't get very far with debugging the test (basically the test server
got started and I lost control of the debugger). At any rate, I found
some more information about sockets inside of jailed environments[1].
Section 4.2.2 seems to indicate that the type of socket we are creating
in the following code from A::TestRequest is OK:
require IO::Socket;
return IO::Socket::INET->new(%args);
As an alternate approach, I've created a test script that opens a socket
to the test webserver and prints the same strings from the test. First,
I start the test servers via t/TEST -start. Then I run my attached
script. The output is as expected. I think this is a good thing but
probably means there is a problem somewhere in the test scripts. Any
ideas for tracking this one down?
As for determing whether we are running inside of a jail, there are
several techniques. The simplest seems to be checking the output of 'df
/' to see if it reports being mounted on a different filesystem (e.g.,
/local/jails in my case). Other solutions require C code or additional
packages[2].
William
[1]
http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/jail-restrictions.html
[2] http://memberwebs.com/nielsen/freebsd/jails/jailutils/
--
Knowmad Services Inc.
http://www.knowmad.com
#!/usr/bin/perl -w
use IO::Socket;
my $host = 'localhost';
my $port = '8529';
my $socket = IO::Socket::INET->new(PeerAddr => $host, PeerPort => $port) or die "Unable to create listener socket: $!";
my @test_strings = qw(MODPERL 2.0 RULES);
for my $str (@test_strings) {
print $socket "$str\n";
chomp(my $reply = <$socket>||'');
$str = lc $str;
$str =~ s/modperl/mod_perl/;
print ("Reply = $reply\nExpected = $str\n");
}