[thelist] Perl problem and question

Katherine Spice k.spice at acu.ac.uk
Tue Aug 7 05:12:48 CDT 2001


> > The form parsing code (i.e. just
> > the code that gets the variables passed from the form) that I use is less
> > than 15 lines, pretty basic stuff. I often just copy and paste it from one
> > script to another, so I'm not actually writing the code anew each time.
>
> cutting and pasting a bit of code into a script doesn't seem like a lot of 
> work, but it can lead to maintainance problems. what if you find a bug in it? 
> you'll be scouring old scripts for various versions of the function. (this is 
> more an argument for keeping frequently used functions in their own library, 
> but if you can use functions in a library that someone else is maintaining, 
> that's even better).

If you want to use your own, here's how....

at the top of each script:

#!/usr/bin/perl
require ("generic.pl");

where generic.pl contains the parsing subroutine, which you can then
call from the main script (note: you _do_not_ need the path to perl at
the top of the generic file, it _does_not_ need to be executable, it
_must_ have 1; as the last line).

CSS for perl!!

Katherine




More information about the thelist mailing list