Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > I hate CGI.pm

Reply
Thread Tools

I hate CGI.pm

 
 
Ben Bullock
Guest
Posts: n/a
 
      06-23-2008
Today I wanted to write a web interface for something, and I opted to
use CGI.pm. It's a core module, something distributed with Perl, and
yet it's painful to use. I started out using CGI.pm a few years ago
when I knew next to no Perl, and at the time I blamed myself for the
module's unuseability. Since then I've been learning more and more
Perl, and yet coming back to CGI.pm I find that it's just as unuseable
to me now as it was then. Some of its behaviours are just stupid and
extremely annoying.

What do other people think of it? Am I a lone CGI.pm hater, or do
other people use some superior system instead of CGI.pm?

I tried to read the documentation for Catalyst, and it makes no sense
to me - it looks like you have to buy a book and spend hours and hours
to understand it. Since I don't usually even write web things, I don't
want to spend a lot of time studying the systems - I just want a
"better CGI module". Does it exist?

 
Reply With Quote
 
 
 
 
Brad Baxter
Guest
Posts: n/a
 
      06-23-2008
On Jun 23, 9:20 am, Ben Bullock <(E-Mail Removed)> wrote:
> Today I wanted to write a web interface for something, and I opted to
> use CGI.pm. It's a core module, something distributed with Perl, and
> yet it's painful to use. I started out using CGI.pm a few years ago
> when I knew next to no Perl, and at the time I blamed myself for the
> module's unuseability. Since then I've been learning more and more
> Perl, and yet coming back to CGI.pm I find that it's just as unuseable
> to me now as it was then. Some of its behaviours are just stupid and
> extremely annoying.
>
> What do other people think of it? Am I a lone CGI.pm hater, or do
> other people use some superior system instead of CGI.pm?
>
> I tried to read the documentation for Catalyst, and it makes no sense
> to me - it looks like you have to buy a book and spend hours and hours
> to understand it. Since I don't usually even write web things, I don't
> want to spend a lot of time studying the systems - I just want a
> "better CGI module". Does it exist?


I've had good success with CGI:Minimal. http://search.cpan.org/dist/CGI-Minimal/

You have to bake your own cookies.

--
Brad
 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      06-23-2008
Ben Bullock wrote:
> Today I wanted to write a web interface for something, and I opted to
> use CGI.pm. It's a core module, something distributed with Perl, and
> yet it's painful to use. I started out using CGI.pm a few years ago
> when I knew next to no Perl, and at the time I blamed myself for the
> module's unuseability. Since then I've been learning more and more
> Perl, and yet coming back to CGI.pm I find that it's just as unuseable
> to me now as it was then. Some of its behaviours are just stupid and
> extremely annoying.
>
> What do other people think of it? Am I a lone CGI.pm hater, or do
> other people use some superior system instead of CGI.pm?
>
> I tried to read the documentation for Catalyst, and it makes no sense
> to me - it looks like you have to buy a book and spend hours and hours
> to understand it. Since I don't usually even write web things, I don't
> want to spend a lot of time studying the systems - I just want a
> "better CGI module". Does it exist?


It depends on what you mean by "painful", "unusable", "stupid",
"annoying" and "better".

Personally I tend to avoid CGI.pm because it's slow. As regards parsing
form data, there are several alternative modules available, e.g.
CGI::Lite and CGI::Minimal.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
Mirco Wahab
Guest
Posts: n/a
 
      06-23-2008
Ben Bullock wrote:
> Today I wanted to write a web interface for something, and I opted to
> use CGI.pm. It's a core module, something distributed with Perl, and
> yet it's painful to use. I started out using CGI.pm a few years ago
> when I knew next to no Perl, and at the time I blamed myself for the
> module's unuseability. Since then I've been learning more and more
> Perl, and yet coming back to CGI.pm I find that it's just as unuseable
> to me now as it was then. Some of its behaviours are just stupid and
> extremely annoying.
>
> What do other people think of it? Am I a lone CGI.pm hater, or do
> other people use some superior system instead of CGI.pm?
>
> I tried to read the documentation for Catalyst, and it makes no sense
> to me - it looks like you have to buy a book and spend hours and hours
> to understand it. Since I don't usually even write web things, I don't
> want to spend a lot of time studying the systems - I just want a
> "better CGI module". Does it exist?


Hi Ben,

I almost always use HTML::Template and use CGI
only sometimes for POST/GET parameter extraction
and url encoding (seems to work). I tend to give
the html-template exactly the same name as the
corresponding Perl script and change the extension
to htm (by convention: .htm is template, .html
is static content).

If HTML::Template doesn't fit, I use HTML::Mason
(but that's only on somehow complicated things).

Regards

M.

 
Reply With Quote
 
brian d foy
Guest
Posts: n/a
 
      06-23-2008
In article <g3o7vm$4m7$(E-Mail Removed)>, Ben Bullock
<(E-Mail Removed)> wrote:

> Today I wanted to write a web interface for something, and I opted to
> use CGI.pm. It's a core module, something distributed with Perl, and
> yet it's painful to use.


I think you'd need to define "painful to use". What was painful? What
did you have trouble doing?
 
Reply With Quote
 
Ron Bergin
Guest
Posts: n/a
 
      06-23-2008
On Jun 23, 6:20 am, Ben Bullock <(E-Mail Removed)> wrote:
> Today I wanted to write a web interface for something, and I opted to
> use CGI.pm. It's a core module, something distributed with Perl, and
> yet it's painful to use. I started out using CGI.pm a few years ago
> when I knew next to no Perl, and at the time I blamed myself for the
> module's unuseability. Since then I've been learning more and more
> Perl, and yet coming back to CGI.pm I find that it's just as unuseable
> to me now as it was then. Some of its behaviours are just stupid and
> extremely annoying.
>
> What do other people think of it? Am I a lone CGI.pm hater, or do
> other people use some superior system instead of CGI.pm?
>


I think CGI.pm is an excellent module and fairly easy to use once you
thoroughly read the documentation. However, it's not perfect, but
then nothing is ever perfect.

If you truly believe that it's that bad, why don't you write/publish
your own version, rather than simply complaining without specific
details and examples.
 
Reply With Quote
 
xhoster@gmail.com
Guest
Posts: n/a
 
      06-23-2008
Ben Bullock <(E-Mail Removed)> wrote:
> Today I wanted to write a web interface for something, and I opted to
> use CGI.pm. It's a core module, something distributed with Perl, and
> yet it's painful to use. I started out using CGI.pm a few years ago
> when I knew next to no Perl, and at the time I blamed myself for the
> module's unuseability. Since then I've been learning more and more
> Perl, and yet coming back to CGI.pm I find that it's just as unuseable
> to me now as it was then. Some of its behaviours are just stupid and
> extremely annoying.
>
> What do other people think of it? Am I a lone CGI.pm hater, or do
> other people use some superior system instead of CGI.pm?


I like CGI.pm. I have been frustrated with it at times, but that
frustration was usually resolved when I tried to do the same thing myself
and thus discovered the subtleties involved, and then appreciated why CGIs
needlessly complicated approach wasn't so needless after all.

> I tried to read the documentation for Catalyst, and it makes no sense
> to me - it looks like you have to buy a book and spend hours and hours
> to understand it. Since I don't usually even write web things, I don't
> want to spend a lot of time studying the systems - I just want a
> "better CGI module". Does it exist?


Have you looked at CGI::Lite? I didn't consider it better last I looked at
it, but YMMV.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 
Reply With Quote
 
cartercc
Guest
Posts: n/a
 
      06-23-2008
On Jun 23, 9:20 am, Ben Bullock <(E-Mail Removed)> wrote:
> What do other people think of it? Am I a lone CGI.pm hater, or do
> other people use some superior system instead of CGI.pm?


> want to spend a lot of time studying the systems - I just want a
> "better CGI module". Does it exist?


I've been using Perl for about ten years for web programming. I took
one look at CGI and decided to 'roll my own.' I use CGI to pass
parameters from forms to scripts, but the big module that I find
absolutely essential is DBI.

When I develop a web project, I first start by building a module for
database connectivity and HTML components (like the header, footer,
buttons, menus, and so on.) I then build scripts that encapsulate
functionality depending on the data. A very rough sample of pseudo
code follows.

I initialize my variables and then use heredocs to spit out HTML. To
me, this is more intuitive than using any kind of includes tags, like
JSP, PHP, ColdFusion, Catlyst, etc.) You can use the http header of
the requested URL as a key into your database to dynamically generate
pages depending on the user input. Essentially, you are writing a
program to write a program to generate a website.

This is what I mean:

use strict;
use CGI;
use DBI;
use myHTMLmodule;

#passed in from an HTML form or from this script
my $what = param('what');
my $name = param('name');
my $number = param('number');
my $answer = param('answer');

#generate dynamic page based on content drawn from database
myHTMLmodule::header;
myHTMLmodule::menu;
&step_1 if $what eq 'Click Here';
&step_2 if $what eq 'Got Name';
&step_3 if $what eq 'Got Number';
&step_4 if($what eq 'Ask Question';
&error if $what eq '';
myHTMLmodule::return_home;
myHTMLmodule::footer;

sub step_1
{
print <<step1
<p>You want to $what</p>
<ul>
step1
my @results = myHTMLmodule::return_query_results($what);
foreach my $result (@results) { print "<li>$result</li>"; }
print <<step1
</ul>
<p>This is the remainder of step 1:</p>
<!-- HTML -->
step1
}

step2, step3, step4, and error similar
 
Reply With Quote
 
szr
Guest
Posts: n/a
 
      06-23-2008
Ben Bullock wrote:
> Today I wanted to write a web interface for something, and I opted to
> use CGI.pm. It's a core module, something distributed with Perl, and
> yet it's painful to use. I started out using CGI.pm a few years ago
> when I knew next to no Perl, and at the time I blamed myself for the
> module's unuseability. Since then I've been learning more and more
> Perl, and yet coming back to CGI.pm I find that it's just as unuseable
> to me now as it was then. Some of its behaviours are just stupid and
> extremely annoying.


Could you be kind enough to provide an example or two where CGI.pm
didn't work well for you? Everyone can have a different experience so it
might help to know where you're coming from via illustration

Also please see my reply to your posting in the related FAQ thread.

--
szr


 
Reply With Quote
 
Ted Zlatanov
Guest
Posts: n/a
 
      06-23-2008
On Mon, 23 Jun 2008 13:20:54 +0000 (UTC) Ben Bullock <(E-Mail Removed)> wrote:

BB> What do other people think of it? Am I a lone CGI.pm hater, or do
BB> other people use some superior system instead of CGI.pm?

mod_perl does most of the things I need (with Template Toolkit). For
quick tasks, I like CGI::FormBuilder. I don't hate CGI.pm, just haven't
found a compelling reason to use it instead of those two. A few times
I've had to import utility functions, but that's about it.

Ted
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
D-Link DSL 504T - I hate my router - No, I really really hate it!!! Simon Harding Computer Support 7 01-03-2006 09:11 PM
Oh How I hate Change... ..brian.. Firefox 8 03-05-2005 11:19 PM
Thunderbird - OK., I know that you will hate this BT Firefox 5 03-05-2005 05:26 PM
The thing I hate about FF and TB Tony Raven Firefox 7 12-13-2004 02:32 AM
I begining to Hate WI-FI! Veritech Wireless Networking 2 08-24-2004 03:37 AM



Advertisments