Skip Menu |

This queue is for tickets about the Net-Server CPAN distribution.

Report information
The Basics
Id: 44491
Status: resolved
Priority: 0/
Queue: Net-Server

People
Owner: Nobody in particular
Requestors: erik [...] jbanetwork.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.97
Fixed in: (no value)



Subject: Adding an options method to a Net::Server subclass breaks the port option
Consider the following code: #!/usr/bin/perl package Example; use base(Net::Server); sub options {} Example->run(port => 123456); #end This, when run, doesn't bind to port 123456, but instead to the default port of 20203. Removing the empty options method fixes the issue. I'll admit to not full understanding the way options are supposed to be extended, so perhaps this is expected behavior. If I handle port in the options method it seems to work correctly. #!/usr/bin/perl package Example; use base(Net::Server); sub options { my $self = shift; my $prop = $self->{'server'}; my $template = shift; #add the port option $prop->{'port'} ||= undef; $template->{'port'} = \ $prop->{'port'}; } Example->run(port => 123456); #end
If you add empty options() - you are disabling options processing for all ancestor classes. Take a closer look how options are extended in Net::Server::PreFork - it supports few options that are not present in Net::Server. Notice: $self->SUPER::options($ref); Regards.
Yes, overriding options to return nothing breaks all argument parsing. I have updated the code to show a warning if empty options are returned. But, there likely won't be any further changes as this is how configuration is specified for the server. On Sun Apr 05 06:55:41 2009, CATONE wrote: Show quoted text
> If you add empty options() - you are disabling options processing for > all ancestor classes. > Take a closer look how options are extended in Net::Server::PreFork - it > supports few options that are not present in Net::Server. > Notice: $self->SUPER::options($ref); > > Regards.