Perl CGI no longer used?

B

Bush is a Fascist

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?
 
M

Mike

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.
 
A

axel

Bush is a Fascist said:
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
 
B

Bush is a Fascist

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.
 
J

Jürgen Exner

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
 
X

xhoster

Bush is a Fascist said:
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
 
B

Bush is a Fascist

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?
 
B

Bush is a Fascist

Alexandre said:
<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.
 
T

Tassilo v. Parseval

Also sprach Bush is a Fascist:
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
 
T

Tintin

Bush is a Fascist said:
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.
 
I

Ian Wilson

A

axel

Sven-Thorsten Fahrbach said:
On 24 Jul 2005 05:35:42 -0700


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
 
S

Sven-Thorsten Fahrbach

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 ;-).
 
S

Sven-Thorsten Fahrbach

On Mon, 25 Jul 2005 15:19:38 GMT
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.
 
R

Richard Gration

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
 
S

Sven-Thorsten Fahrbach

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top