Home: Perl Programming Help: Advanced:
Using CGI.pm not advanced?



yapp
User

Sep 4, 2001, 6:52 AM


Views: 2945
Using CGI.pm not advanced?

Sorry, I just read something strange (CGI.pm not advanced)
Off course, you inport a lot of other stuff,
but why dont import
use CGI qw(header, redirect param escape);
or:
use CGI qw(:cgi escape);

You then have all the CGi needs for your perl program.
Besides, I've seen much CGI programs that print "Content-type: text/html\n\n";
but that could cause quite some troubles! Didn't anyone ever hear of the Internet-End-Of-Line standard code? (see perldoc perlport)

I've even seen CGI programs what fail with POST request, because they only expect GET request (or forget a combination of them!), and visa versa.

Some CGI programs that use redirection fail in some cases (and you'll see a blank screen, but that isn't caused by a thrown error).
Those CGI programs just print out bad HTTP redirect headers!!

So Please don't SAY using CGI.pm is not advanced!!
I'm still using CGI.pm and that leaves me with less trouble, so I can focus myself on disigning the CGI program, not the HTTP handling part (or debugging that part of my program).
Most CGI programs that do it their way sux, or fail/die.

Comments to this article are always welcome.;-)



mhx
Enthusiast

Sep 4, 2001, 8:51 AM


Views: 2944
Re: Using CGI.pm not advanced?

Who on this forum says that using CGI isn't advanced? If you have a look at these threads, for example, you'll see that CGI.pm is generally recommended:

http://forums.perlguru.com/showflat.pl?Cat=&Board=Forum2&Number=11868
http://forums.perlguru.com/showflat.pl?Cat=&Board=Forum2&Number=11526

The description of the Advanced forum (I guess that's what you refer to...) only says that if you've been using CGI.pm a few times, you're not neccessarily a person to post to the Advanced forum.
Using CGI is always a good idea and helps you becoming an advanced Perl programmer. (Because you can spend your time exploring the interesting features of Perl instead of debugging your CGI parsers...) The biggest problem with CGI.pm is to get people to actually using it.

-- Marcus


Code
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= 
($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"



yapp
User

Sep 6, 2001, 1:57 AM


Views: 2936
Re: Using CGI.pm not advanced?

Just take a look at the description for the advanced category/forum. It says: Hint: using CGI.pm is not advanced!



mhx
Enthusiast

Sep 6, 2001, 3:13 AM


Views: 2935
Re: Using CGI.pm not advanced?

I hate to repeat myself...
Yes, it says

Code
<COPYPASTE> 
Hint: Using CGI.pm for one or two functions is not advanced.
</COPYPASTE>

I've already explained in my last post that the meaning of this is not that using CGI is not advanced, but the fact that you have used CGI once or twice doesn't neccessarily make you an advanced Perl programmer.
Hope this makes it clearer now... Wink

-- Marcus


Code
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= 
($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"