Re: Problem using use CGI and LWP modules together



In article <e41tlrKm1jDHFAfU@xxxxxxxxxxxxxxxxxxx>, Nick Wedd
<nick@xxxxxxxxxxxxx> wrote:

I am trying to develop a script to run on a web server. It uses the
modules
GD to do stuff with images
CGI to get the parameters from the URI
LWP to fetch stuff from the web

If my program begins
#!/usr/local/bin/perl
use strict;
use GD;
use GD::Text;
use CGI qw(:standard);
use LWP::Simple;
I get the error message
Prototype mismatch: sub main::head: none vs ($) at s4pngu.pl line 6



My guess is that the LWP and CGI modules are incompatible somehow. Am I
right? Or am I invoking them wrong? Is there a recommended solution?


It does look like a name clash. I am able to reproduce this same error
on my system (perl 5.8.8).

You can use the OO features of CGI and avoid importing subroutines from
the module into your main:: namespace, provided you are comfortable
with the OO method of programming for CGI:

use CGI;
use LWP::Simple;

You will then have to define a CGI object and use method calls instead
of simple function calls.

Note that the following also demonstrates the error:

use CGI qw(head);
use LWP::Simple;

which really does indicate a 'head' clash.

--
Jim Gibson

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
.



Relevant Pages

  • Re: Explicitly telling LWP::UserAgent where Crypt::SSLeay is
    ... > use CGI; ... The reason I ask is that LWP uses Crypt::SSLeay under the covers so ... https requests should work transparently if Crypt::SSLeasy is usable. ...
    (comp.lang.perl.modules)
  • Re: LWP with proxy problem
    ... >> the content of the login page for the site being accessed. ... I also am including the LWP ... This has nothing to do with CGI. ... actually a web client, the example code does not appear related to any ...
    (comp.lang.perl.misc)
  • Re: CGI::Carp die with status
    ... Has anyone experience with dying from CGI::Carp with a status? ... Using LWP one can catch status with: ... on the server. ... You need to post the cgi if you want help fixing it. ...
    (comp.lang.perl.misc)
  • Re: how to get the table from a website and display
    ... cgi i know how to do but cfm i ... It doesn't really matter what the site is using (except applets - LWP ...
    (comp.lang.perl.misc)