For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > May 2004 > CGI module comparison









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author CGI module comparison
John Goodleaf

2004-05-22, 11:30 am

Hello,
I'm not on the list, so please CC me directly.

Although I'm a reasonably competent Perl user I have never actually
used it for CGI purposes, just for database querying/data munging.
You can imagine my perpetual confusion at finding the Perl books in
the "Web programming" section of the bookstore.

Anyway, I suddenly need to create CGIish app on short notice so I
need to ramp up quickly. I notice there are a lot of CGI modules on
CPAN, so I wonder if anyone has ever seen some kind of comprehensive
review of these modules--a summary of their various strengths and
weaknesses. I'd like to figure out which ones I might make use of,
so I'm actually looking to RTFM. I just haven't found an M that
suits.

Thanks,
John

PS How do you pronounce 'munging'? I'm having an argument with a
coworker. The split is between 'munjing' and 'mung -ing' (hard G).
Andrew Gaffney

2004-05-22, 11:30 am

John Goodleaf wrote:
> Hello,
> I'm not on the list, so please CC me directly.
>
> Although I'm a reasonably competent Perl user I have never actually
> used it for CGI purposes, just for database querying/data munging.
> You can imagine my perpetual confusion at finding the Perl books in
> the "Web programming" section of the bookstore.
>
> Anyway, I suddenly need to create CGIish app on short notice so I
> need to ramp up quickly. I notice there are a lot of CGI modules on
> CPAN, so I wonder if anyone has ever seen some kind of comprehensive
> review of these modules--a summary of their various strengths and
> weaknesses. I'd like to figure out which ones I might make use of,
> so I'm actually looking to RTFM. I just haven't found an M that
> suits.


CGI.pm seems to be the standard module for CGI programming. Look here:

http://search.cpan.org/~lds/CGI.pm-3.04/CGI.pm

> PS How do you pronounce 'munging'? I'm having an argument with a
> coworker. The split is between 'munjing' and 'mung -ing' (hard G).


I've always pronounced it the first way.

--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548

Wiggins D'Anconia

2004-05-22, 11:31 am

Andrew Gaffney wrote:
> John Goodleaf wrote:
>
>
>
> CGI.pm seems to be the standard module for CGI programming. Look here:
>
> http://search.cpan.org/~lds/CGI.pm-3.04/CGI.pm
>


Agreed, but do you have any particular ones in mind? Some are wrappers
or off shoots of the one referenced, such as

CGI::Lite and CGI::Safe

Others may be part of the core CGI installation. Speaking of 'core'
that would be a good reason to choose CGI.pm, aka it comes with newer
versions of Perl by default.

>
>
> I've always pronounced it the first way.
>


Yep, first.

http://danconia.org
Zentara

2004-05-22, 11:31 am

On Fri, 26 Mar 2004 14:23:04 -0800 (PST), john@goodleaf.net (John
Goodleaf) wrote:

>Anyway, I suddenly need to create CGIish app on short notice so I
>need to ramp up quickly. I notice there are a lot of CGI modules on
>CPAN, so I wonder if anyone has ever seen some kind of comprehensive
>review of these modules--a summary of their various strengths and
>weaknesses. I'd like to figure out which ones I might make use of,
>so I'm actually looking to RTFM. I just haven't found an M that
>suits.


If you are not familiar with the CGI.pm module, and need to whip
something up "on short notice", just do the HTML manually
and use just use the form parsing subroutines of CGI.pm.

The biggest complaint about CGI.pm is it's too big.

The following snippet will echo back any form values
you send to it. It uses CGI to decode the vars, which is
the tricky part, but uses manually creation of the html.

#!/usr/bin/perl
use warnings;
use strict;
use CGI qw/:standard/;
use CGI;
my $cgi=new CGI;
my %in = $cgi->Vars();

print "Content-type: text/html\n\n";

foreach my $key (keys %in){
print "$key -> $in{$key}<br>";
}

__END__

For manual creation of complex html, like tables,etc,
you can use HERE docs. For example:

#Print on the browser:
print <<eof;
<br><br>
The file $filename was successfully uploaded!<br>
The file has $filesize.<br>
<div class="center">
<a href="$script">Go back if you want to upload one more file.</a>
&nbsp; &nbsp;
<a href="http://zentara.zentara.net/~zentara">Go to home page!</a>
</body></html>
eof

Alot of people use HERE docs because it lets them directly
create the html just the way they want it. Plus you can start
making your html pages right away, from your current html knowledge.





--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com