[NTLUG:Discuss] portable perl question...

MadHat madhat at unspecific.com
Wed Jun 6 09:13:12 CDT 2001


Speaking of which, the perl news letter this week is titled

Using CGI::Application

"Have you ever written any CGI applications? I've been maintaining one
recently which browses the Perl source repository, and it's really,
really boring.

Why? Because most CGI programs end up with the same basic design -
take in some parameters which represent the state, one of which will
tell you which "action" to perform; then a big switch statement to
select the possible actions; then code to perform the actions. Once
you've done it 10 times, you really, really don't want to do it
again.

When faced with a recurring design scenario like that, Jesse Erlbaum
took the obvious but innovative move - abstract it away! He brings
us a tutorial introduction to his "CGI::Application" module, which
allows you to create CGI Web applications just like object-oriented
modules, including inheritance and, if you want, distributing them
on CPAN.

Well worth a look if you do anything to do with CGI - it may even
save you a bunch of time!

     http://www.perl.com/pub/2001/06/05/cgi.html"


At 08:42 AM 6/6/2001 -0500, you wrote:
>At 11:49 PM 6/5/2001 -0500, Fred James wrote:
>>(perhaps not really as off the track as it may seem at first)
>>Here I am learning Perl on a Linux machine and I get an opportunity to
>>take a class or two in it - what's the catch?
>>The class is being taught on MS machines - but of course they promise
>>not to be MS specific.
>>What's my question?
>>Got any hints on what to avoid in Perl on an MS machine - my aim is
>>portable, and my interest is Linux.
>
>Remember that a \n (new line) is normally sufficient on non-MS machines, 
>while MS can and will use a combination of \n\r (new line and carriage 
>return) without you knowing if it is using one or both.  This is important 
>when using something like chomp, as it does not work the same on MS as it 
>does on Unix style boxes. (ended up having to use s/\n|\r//g I think, or 2 
>lines, one for each, can't remember)
>
>Aslo, the difference in / and \.  Remember to use a \ you have to use it 
>twice \\ to make sure it is escaped (perl sees \ as an escape character 
>for what ever come next, so \n is newline and \c is control, \t is tab, 
>etc...), but don't let people lie to you, the / has worked fine on all 
>versions of Perl I have used on Win32 (being versions of ActivePerl and 
>Cygwin Perl).  Test it and find out for yourself.
>
>There are other differences, like some modules not being portable, but 
>there are too many details to list.  These are the 2 items I have had bite 
>me in the ass, so here they are.
>
>
>>The class is suppose to introduce us to CGI in Perl, and right away the
>>guy says nobody writes CGI in Perl any more - is that true, or is he
>>possibly misinformed?
>
>Perl is still very popular...  even on IIS.  But it is true that many 
>people are moving away from perl to ASP, PHP and others like cold 
>fusion.  The reason is because of simplified languages (like ColdFusion 
>looks like html) and that the designers of these languages are catering to 
>the web world and CGIs specifically making more resources available for 
>CGIs and ease of development.  Personally, I teach perl and CGI with perl 
>and would never use anything else.  I write perl scripts on a daily basis 
>and not because it is my job, but because it makes my job easier...
>
>
>>--
>>...small is beautiful...
>>_______________________________________________
>>http://www.ntlug.org/mailman/listinfo/discuss
>
>--
>MadHat at unspecific.com
>
>"Focus on the packet.  It's better that way."
>                                              -tb
>
>_______________________________________________
>http://www.ntlug.org/mailman/listinfo/discuss

--
MadHat at unspecific.com

"Focus on the packet.  It's better that way."
                                              -tb




More information about the Discuss mailing list