Subject: | check for port value is broken |
One way:
my $srv = bless{'port' => 11111}, 'R2D2';
$srv->run();
Other way:
R2D2->run({port => 11111});
Yet the other way, using the configure_hook:
#---------------------------------------------------------------------------
sub configure_hook
{
my $self = shift;
my $root = $self->{server_root} = "/tmp";
$self->{server}->{port} = "11111"; # port and addr to bind
$self->{server}->{user} = 'r2d2'; # user to run as
$self->{server}->{group} = 'r2d2'; # group to run as
$self->{server}->{setsid} = 1; # daemonize
$self->{server}->{log_file} = "$root/server.log";
$self->{document_root} = "$root/www";
$self->{access_log} = "$root/access.log";
$self->{error_log} = "$root/error.log";
}
Tried these things, but no luck, the default port is
always used, see code below. The first check
for defined is ok but the other two will break since
$prop->{port} is just a scalar. Code fix or doc fix
(probably both, but maybe not...)
295 ### set a default port, host, and proto
296 if( ! defined( $prop->{port} )
297 || ! ref( $prop->{port} )
298 || ! @{ $prop->{port} } ){
299 $self->log(2,"Port Not Defined. Defaulting to '20203'\n");
300 $prop->{port} = [ 20203 ];
301 }
302
Linux localhost 2.6.12-10-686 #1 Sat Mar 11 16:22:51 UTC 2006 i686 GNU/Linux
This is perl, v5.8.7 built for i486-linux-gnu-thread-multi