[PLUG] Trouble with CGU forms...

Jeme A Brelin jeme at brelin.net
Sun Nov 23 23:51:02 UTC 2003


On Sun, 23 Nov 2003, Michael C. Robinson wrote:
> Well, if I can find the right way to execute a non perl command like sed
> in the client perl CGI script, I should be able to break the long line
> and assign the pieces off.

If you are calling sed from within perl, you really shouldn't be using
perl.  I mean, that makes absolutely no sense whatsoever.

> I've executed other non perl commands.

... probably unnecessarily.

> I think there are some bugs in my script overall.

No offense, but judging from the level of knowledge your question belies,
I'd say there has to be.

> Lining parentheses up in the way that looks correct oddly breaks it.

Are you using an editor that helps you with this?

> I thought all variables were global in perl.

No.  And some of the scoping can be a real hassle unless you explicitly
narrow everything to where it is declared.

use strict;

perldoc strict

> Maybe my subroutines need to be defined within the main function to give
> all the variables global scope.

I think you don't know how perl works.  There are lots of good tutorials,
but I happen to like Programming Perl.  It's a fine book.

For this purpose, you should certainly be using the perl CGI library.
While it's not always necessary for simple applications, it might help you
to deal with things that you're finding difficult.

use CGI;

Add all that up, and your CGI script should start like this:

#! /usr/bin/perl -wT

use strict;
use CGI;

Got it?

J.
-- 
   -----------------
     Jeme A Brelin
    jeme at brelin.net
   -----------------
 [cc] counter-copyright
 http://www.openlaw.org




More information about the PLUG mailing list