Perl CGI no longer used?

Discussion in 'Perl Misc' started by Bush is a Fascist, Jul 24, 2005.

  1. I am starting to wonder if Perl CGI is used anymore,
    because the basic CGI module doesn't seem to function
    any longer.

    I tried writing a simple CGI script for Perl, using
    examples from the web, and I found that the code
    oddly enough doesn't work. I'm using the CGI module,
    as follows:

    #!/usr/bin/perl
    use DBI;
    use CGI;
    my $query = new CGI;
    print $query->header ( );
    my $tt = $query->param("tt");
    print "tt = ";
    print $tt;

    My form definitely passes tt in the URL as a Get parameter,
    yet the Perl script prints nothing for tt.

    What is going wrong here? Has CGI fallen into disuse and
    decay, having been replaced by something else?

    Has everyone moved over to using PHP?
    Bush is a Fascist, Jul 24, 2005
    #1
    1. Advertising

  2. Bush is a Fascist

    Mike Guest

    On 2005-07-24, Bush is a Fascist <> wrote:
    > I am starting to wonder if Perl CGI is used anymore,
    > because the basic CGI module doesn't seem to function
    > any longer.
    >
    > I tried writing a simple CGI script for Perl, using
    > examples from the web, and I found that the code
    > oddly enough doesn't work. I'm using the CGI module,
    > as follows:
    >
    > #!/usr/bin/perl
    > use DBI;
    > use CGI;
    > my $query = new CGI;
    > print $query->header ( );
    > my $tt = $query->param("tt");
    > print "tt = ";
    > print $tt;
    >
    > My form definitely passes tt in the URL as a Get parameter,
    > yet the Perl script prints nothing for tt.
    >
    > What is going wrong here? Has CGI fallen into disuse and
    > decay, having been replaced by something else?
    >
    > Has everyone moved over to using PHP?
    >


    I still use cgi.
    You do not seem to have issued the headers, start and end html tags.
    Properly return an html page to see what it does.
    Mike, Jul 24, 2005
    #2
    1. Advertising

  3. Bush is a Fascist

    Guest

    Bush is a Fascist <> wrote:
    > I am starting to wonder if Perl CGI is used anymore,
    > because the basic CGI module doesn't seem to function
    > any longer.


    > I tried writing a simple CGI script for Perl, using
    > examples from the web, and I found that the code
    > oddly enough doesn't work. I'm using the CGI module,
    > as follows:


    > #!/usr/bin/perl
    > use DBI;
    > use CGI;
    > my $query = new CGI;
    > print $query->header ( );
    > my $tt = $query->param("tt");
    > print "tt = ";
    > print $tt;


    The script works... test it yourself by running it from the
    command line and manually passing in the parameter.

    I suggest the problem lies elsewhere in the interaction between
    your webserver.

    Perhaps you could try the following:

    #!/usr/bin/perl

    use strict;
    use warnings;
    use CGI;

    my $query = new CGI;
    print $query->header ( );

    print "<PRE>\n";
    print "Request-URI => $ENV{'REQUEST_URI'}\n";
    print "Query String => $ENV{'QUERY_STRING'}\n";

    my $tt = $query->param("tt");
    print "tt = $tt\n";
    print "</PRE>\n";
    __END__

    It may aid the disgnosis as to exactly what is happening.

    It may also be worth viewing the source of the returned
    page in your browser as some choke on incorrect HTML.

    Axel
    , Jul 24, 2005
    #3
  4. Only my system it never worked.

    I did however try out the manual approach
    i.e. the split and foreach loop, and that works fine.

    I always find it's better to avoid other people's
    ever-changing libraries and classes if possible, anyway.
    Bush is a Fascist, Jul 24, 2005
    #4
  5. Bush is a Fascist wrote:
    Hi Bush

    > Only my system it never worked.


    What is "it"? Please quote some context such that people have a chance to
    know what you are talking about.

    > I did however try out the manual approach
    > i.e. the split and foreach loop, and that works fine.


    Which manual approach? What split and foreach loop?
    Do you mind explaining what you are talking about?

    > I always find it's better to avoid other people's
    > ever-changing libraries and classes if possible, anyway.


    Well, I guess you've never worked on anything but toy-size projects and love
    reinventing the square wheel.

    jue
    Jürgen Exner, Jul 24, 2005
    #5
  6. Bush is a Fascist

    Guest

    "Bush is a Fascist" <> wrote:
    >
    > What is going wrong here? Has CGI fallen into disuse and
    > decay, having been replaced by something else?


    No.

    >
    > Has everyone moved over to using PHP?


    No, but you probably should. Anyone who can't deal with their own
    problems without creating fantastically improbable theories bordering
    on world-wide conspiracy is probably not suited to work with Perl.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    , Jul 24, 2005
    #6
  7. wrote:

    > > Has everyone moved over to using PHP?

    >
    > Anyone who can't deal with their own
    > problems without creating fantastically improbable theories bordering
    > on world-wide conspiracy is probably not suited to work with Perl.


    So, is Perl the only thing you have going on in your life?
    Bush is a Fascist, Jul 24, 2005
    #7
  8. Alexandre Jaquet wrote:

    > <troll>
    > Perl rocks, you can code properly without writting your code
    > into web page.
    > </troll>


    I agree, PHP is uglier in that sense, however if Perl's modules
    don't function reliably over time then that is a major disadvantage
    of Perl.
    Bush is a Fascist, Jul 24, 2005
    #8
  9. Jürgen Exner wrote:

    > > I did however try out the manual approach
    > > i.e. the split and foreach loop, and that works fine.

    >
    > Which manual approach? What split and foreach loop?
    > Do you mind explaining what you are talking about?


    Are you new to Perl?
    Bush is a Fascist, Jul 24, 2005
    #9
  10. Bush is a Fascist

    Keith Keller Guest

    On 2005-07-24, Bush is a Fascist <> wrote:

    > if Perl's modules
    > don't function reliably over time then that is a major disadvantage
    > of Perl.


    Perl's modules work fine. I suspect PEBKAC.

    --keith

    --
    -francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
    see X- headers for PGP signature information
    Keith Keller, Jul 25, 2005
    #10
  11. Also sprach Bush is a Fascist:

    > Alexandre Jaquet wrote:
    >
    >> <troll>
    >> Perl rocks, you can code properly without writting your code
    >> into web page.
    >> </troll>

    >
    > I agree, PHP is uglier in that sense, however if Perl's modules
    > don't function reliably over time then that is a major disadvantage
    > of Perl.


    That's a fairly bold statement to make about a module such as CGI which
    is one of the most widely used and most mature modules around. It's also
    part of the core Perl distribution which would not be the case if it
    didn't work.

    Tassilo
    --
    use bigint;
    $n=71423350343770280161397026330337371139054411854220053437565440;
    $m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
    Tassilo v. Parseval, Jul 25, 2005
    #11
  12. Bush is a Fascist

    Tintin Guest

    "Bush is a Fascist" <> wrote in message
    news:...
    Jürgen Exner wrote:

    > > > I did however try out the manual approach
    > > > i.e. the split and foreach loop, and that works fine.

    > >
    > > Which manual approach? What split and foreach loop?
    > > Do you mind explaining what you are talking about?


    > Are you new to Perl?


    You're obviously new to Usenet.
    Tintin, Jul 25, 2005
    #12
  13. Bush is a Fascist

    Ian Wilson Guest

    Ian Wilson, Jul 25, 2005
    #13
  14. Bush is a Fascist

    Tintin Guest

    "Bush is a Fascist" <> wrote in message
    news:...
    >I am starting to wonder if Perl CGI is used anymore,
    > because the basic CGI module doesn't seem to function
    > any longer.


    Really? What evidence do you have for the Perl CGI module not working? In
    what circumstances?

    >
    > I tried writing a simple CGI script for Perl, using
    > examples from the web, and I found that the code
    > oddly enough doesn't work. I'm using the CGI module,
    > as follows:
    >
    > #!/usr/bin/perl
    > use DBI;


    Why use DBI in this example if you aren't going to use it?

    > use CGI;
    > my $query = new CGI;
    > print $query->header ( );
    > my $tt = $query->param("tt");
    > print "tt = ";
    > print $tt;
    >
    > My form definitely passes tt in the URL as a Get parameter,
    > yet the Perl script prints nothing for tt.


    How do you know? Do you get a blank page, an error? If a blank what does
    viewing the source show?


    >
    > What is going wrong here? Has CGI fallen into disuse and
    > decay, having been replaced by something else?


    Nope.

    > Has everyone moved over to using PHP?


    Nope.
    Tintin, Jul 25, 2005
    #14
  15. Bush is a Fascist

    Ian Wilson Guest

    Bush is a Fascist wrote:
    > Jürgen Exner wrote:
    >
    >
    >>>I did however try out the manual approach
    >>>i.e. the split and foreach loop, and that works fine.

    >>
    >>Which manual approach? What split and foreach loop?
    >>Do you mind explaining what you are talking about?

    >
    >
    > Are you new to Perl?
    >


    You appear to be posting from Google Groups
    Have you read Google's advice on using their service? It is quite good!
    http://groups-beta.google.com/support/bin/answer.py?answer=12348&topic=250

    The posting guidelines for this newsgroup are well worth reading too:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

    For me at least, Google Groups is rapidly developing the same sort of
    notoriety as AOL!
    Ian Wilson, Jul 25, 2005
    #15
  16. Bush is a Fascist

    Guest

    Sven-Thorsten Fahrbach <> wrote:
    > On 24 Jul 2005 05:35:42 -0700
    > "Bush is a Fascist" <> wrote:


    >> I am starting to wonder if Perl CGI is used anymore,
    >> because the basic CGI module doesn't seem to function
    >> any longer.


    >> I tried writing a simple CGI script for Perl, using
    >> examples from the web, and I found that the code
    >> oddly enough doesn't work. I'm using the CGI module,
    >> as follows:


    >> #!/usr/bin/perl
    >> use DBI;
    >> use CGI;
    >> my $query = new CGI;
    >> print $query->header ( );
    >> my $tt = $query->param("tt");
    >> print "tt = ";
    >> print $tt;


    >> My form definitely passes tt in the URL as a Get parameter,
    >> yet the Perl script prints nothing for tt.


    >> What is going wrong here? Has CGI fallen into disuse and
    >> decay, having been replaced by something else?


    >> Has everyone moved over to using PHP?



    > Is it only me or is this a genuine troll? I bet someone over at
    > a.r.k. is having hours of fun at the moment ;-).


    I do now think it is a troll. I should have been alerted by the
    last two paragraphs of the OP, but only considered why the script
    did not deliver results.

    The OP's follow-up and subsequent postings show this as no loops
    were ever mentioned and his comments on other posters make this
    clear.

    Axel
    , Jul 25, 2005
    #16
  17. On 24 Jul 2005 05:35:42 -0700
    "Bush is a Fascist" <> wrote:

    > I am starting to wonder if Perl CGI is used anymore,
    > because the basic CGI module doesn't seem to function
    > any longer.
    >
    > I tried writing a simple CGI script for Perl, using
    > examples from the web, and I found that the code
    > oddly enough doesn't work. I'm using the CGI module,
    > as follows:
    >
    > #!/usr/bin/perl
    > use DBI;
    > use CGI;
    > my $query = new CGI;
    > print $query->header ( );
    > my $tt = $query->param("tt");
    > print "tt = ";
    > print $tt;
    >
    > My form definitely passes tt in the URL as a Get parameter,
    > yet the Perl script prints nothing for tt.
    >
    > What is going wrong here? Has CGI fallen into disuse and
    > decay, having been replaced by something else?
    >
    > Has everyone moved over to using PHP?
    >


    Is it only me or is this a genuine troll? I bet someone over at a.r.k. is having hours of fun at the moment ;-).
    Sven-Thorsten Fahrbach, Jul 25, 2005
    #17
  18. On Mon, 25 Jul 2005 15:19:38 GMT
    wrote:

    > I do now think it is a troll. I should have been alerted by the
    > last two paragraphs of the OP, but only considered why the script
    > did not deliver results.
    >
    > The OP's follow-up and subsequent postings show this as no loops
    > were ever mentioned and his comments on other posters make this
    > clear.
    >
    > Axel
    >


    Yup. ark would be a better place for him or maybe alt.politics.communism judging from his from-line.
    Sven-Thorsten Fahrbach, Jul 25, 2005
    #18
  19. On Sun, 24 Jul 2005 05:35:42 -0700, Bush is a Fascist wrote:

    > I tried writing a simple CGI script for Perl, using
    > examples from the web, and I found that the code
    > oddly enough doesn't work. I'm using the CGI module,
    > as follows:
    >
    > #!/usr/bin/perl
    > use DBI;
    > use CGI;
    > my $query = new CGI;
    > print $query->header ( );
    > my $tt = $query->param("tt");
    > print "tt = ";
    > print $tt;
    >
    > My form definitely passes tt in the URL as a Get parameter,
    > yet the Perl script prints nothing for tt.


    Sorry, guys, I can't resist feeding the troll because I've been bitten by
    a very similar problem before. This might actually help a Googler in
    the future. The clue is in the question (given the horribly confused
    terminology, this may not be what is meant) ...

    "My form definitely passes tt in the URL as a Get parameter"

    If the HTML looks like this:

    <form method="POST" action="broken.cgi?tt=oh+dear">

    then CGI.pm will not parse the URL parameters when the method/function
    param is used. They can be retrieved by using url_param.

    grep -5 cake `locate CGI.pm | head -1`

    HTH
    Rich
    Richard Gration, Jul 25, 2005
    #19
  20. On Mon, 25 Jul 2005 18:19:20 +0200
    Sven-Thorsten Fahrbach <> wrote:

    > Yup. ark would be a better place for him or maybe alt.politics.communism judging from his from-line.


    Sorry, my temper got the better of me. I didn't intend this to become insulting.
    Sven-Thorsten Fahrbach, Jul 25, 2005
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AFN
    Replies:
    0
    Views:
    617
  2. Xeno Campanoli / Eskimo North and Gmail

    Is the CGI instance "html" method no longer available?

    Xeno Campanoli / Eskimo North and Gmail, Jun 24, 2010, in forum: Ruby
    Replies:
    2
    Views:
    114
    Xeno Campanoli / Eskimo North and Gmail
    Jun 24, 2010
  3. James
    Replies:
    1
    Views:
    84
    David Efflandt
    Aug 16, 2003
  4. kath
    Replies:
    4
    Views:
    579
    J. Gleixner
    Apr 9, 2007
  5. Ted Byers
    Replies:
    23
    Views:
    420
    Peter J. Holzer
    Nov 15, 2008
Loading...

Share This Page