Skip Menu |
 

This queue is for tickets about the Win32-Internet CPAN distribution.

Report information
The Basics
Id: 61808
Status: new
Priority: 0/
Queue: Win32-Internet

People
Owner: Nobody in particular
Requestors: patcat88 [...] snet.net
Cc:
AdminCc:

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



Subject: documentation ambiguous for HTTP method, bad code example in POD
Download (untitled) / with headers
text/plain 2.3k
Reading the documentation for 0.084, in the introduction, it gives a code example of " $INET = new Win32::Internet(); $HTTP = $INET->HTTP("www.yahoo.com", "anonymous", "dada@perl.it"); ($statuscode, $headers, $file) = $HTTP->Request("/"); $HTTP->Close(); " With the HTTP object being the return of the HTTP method. Later on, in the documentation for the HTTP method, it gives the prototype of the HTTP method as " HTTP httpobject, server, username, password, [port, flags, context] HTTP httpobject, hashref " with the httpobject scalar parameter becoming the HTTP object after executing the HTTP method. The documentation for HTTP method also supports the httpobject as parameter, not as return, with this code example. " $result = $INET->HTTP($HTTP,"www.activeware.com","anonymous","dada\@perl.it"); # and then for example... ($statuscode, $headers, $file) = $HTTP->Request("/gifs/camel.gif"); $params{"server"} = "www.activeware.com"; $params{"password"} = "dada\@perl.it"; $params{"flags"} = INTERNET_FLAG_RELOAD; $result = $INET->HTTP($HTTP,\%params); " In the code for 0.084, the HTTP method collects its parameters as " sub HTTP { #========= my($self, $new, $server, $username, $password, $port, $flags, $context) = @_; " The $new scalar is never mentioned again the in the source code of HTTP method. The source code, says the HTTP handle number is returned and also the handle number is blessed into an object and then assigned back by reference to $_[1], which would become the HTTP object in the method parameters. Also the code example in the introduction won't work, " $INET = new Win32::Internet(); $HTTP = $INET->HTTP("www.yahoo.com", "anonymous", "dada@perl.it"); ($statuscode, $headers, $file) = $HTTP->Request("/"); $HTTP->Close(); " I changed it to " use Win32::Internet; $c = new Win32::Internet(); $HTTP = $c->HTTP("www.yahoo.com"); ($statuscode, $headers, $file) = $HTTP->Request("/"); $HTTP->Close(); " and got " Can't call method "Request" without a package or object reference at C:\Documents and Settings\Owner\Desktop\w32inet.pl line 4. " Debugger says $HTTP is a handle number, not an object. The code says the introduction is wrong, and the HTTP method documentation is right. I'm not sure if the documentation is supposed to be right and the code wrong, or the code is right and the documentation is wrong.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.