Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: fovea1959-bitcard [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.99
Fixed in: (no value)



Subject: Net::Server::HTTP cannot invoke CGI.pm; missing FILENO from Net::Server::TiedHandle on cygwin
running perl 5.10 under cygwin on Windows: this script is from the Net::Server::HTTP pod (Except for change in port, and pushing to a single threaded server): use base qw(Net::Server::HTTP); __PACKAGE__->run(port=>4444, server_type=>'Single'); sub process_http_request { my $self = shift; print "Content-type: text/html\n\n"; print "<form method=post action=/bam><input type=text name=foo><input type=submit></form>\n"; if (require Data::Dumper) { local $Data::Dumper::Sortkeys = 1; my $form = {}; if (require CGI) { my $q = CGI->new; $form->{$_} = $q->param($_) for $q->param; } print "<pre>".Data::Dumper->Dump([\%ENV, $form], ['*ENV', 'form'])."</pre>"; } } when run (with CGI 3.50) and a request is received, this error occurs: Can't locate object method "FILENO" via package "Net::Server::TiedHandle" at /usr/lib/perl5/5.10/CGI.pm line 823. Compilation failed in require at server.pl line 13. my short term workaround is to add a dummy FILENO method to TiedHandle: package Net::Server::TiedHandle; sub TIEHANDLE { my $pkg = shift; return bless [@_], $pkg } sub READLINE { my $s = shift; $s->[1] ? $s->[1]->($s->[0], 'getline', @_) : $s->[0]->getline } sub SAY { my $s = shift; $s->[1] ? $s->[1]->($s->[0], 'say', @_) : $s->[0]->say(@_) } sub PRINT { my $s = shift; $s->[1] ? $s->[1]->($s->[0], 'print', @_) : $s->[0]->print(@_) } sub PRINTF { my $s = shift; $s->[1] ? $s->[1]->($s->[0], 'printf', @_) : $s->[0]->printf(@_) } sub READ { my $s = shift; $s->[1] ? $s->[1]->($s->[0], 'read', @_) : $s->[0]->read(@_) } sub WRITE { my $s = shift; $s->[1] ? $s->[1]->($s->[0], 'write', @_) : $s->[0]->write(@_) } sub SYSREAD { my $s = shift; $s->[1] ? $s->[1]->($s->[0], 'sysread', @_) : $s->[0]->sysread(@_) } sub SYSWRITE { my $s = shift; $s->[1] ? $s->[1]->($s->[0], 'syswrite', @_) : $s->[0]->syswrite(@_) } sub FILENO { return undef; } 1; problem does NOT occur on Linux with Perl 5.8.8, Net::Server 0.99, CGI 3.15 or 3.50, so it appears to be a 5.10 or cygwin/windows issue.
From: fovea1959-bitcard [...] yahoo.com
No change to Net::Server code itself is needed. The demo code can be changed to construct CGI differently: Show quoted text
> if (require CGI) { my $q = new CGI($ENV{'QUERY_STRING'});
$form->{$_} = $q->param($_) }
A dummy FILENO method was added. The code is updated as of the just released version 2.000