[Tallahassee-pm] Questions and such

Rebekah Landbeck rlandbeck at uniteddatatronics.com
Tue Jul 1 09:30:28 CDT 2003


Ok, here goes with the background info before I get to the questions:

Whoever wrote this app wrote each CGI script as if it were the only one in 
the whole thing.  Code is duplicated all over the place, particularly 
database connection stuff.  I need to consolidate all the database code 
into a package because the connection info varies.

The CGI scripts are called in the middle of html pages.  All they do (at 
least, the ones I'm dealing with just now) is pull a list of names from the 
database and format them for the html.  I've got the pages using an 
included config file to decide what code to use to run the cgi scripts, 
depending on physical location.  That gruesome hack I referred to comes 
into play here.  PHP uses a regex on the working directory to figure out 
whether it's on the development box (Win2k, how's that for ugly... making 
these things work cross-platform sure is teaching me a lot, though), in the 
test directory on the live server, or in the live directory, and writes a 
string to whereami.txt indicating where it is.

When a CGI script is called, it reads from whereami.txt and sets the 
database connection info accordingly.  That's what I need to put into a 
package.  As a quick fix to get the feature I'm adding right now working, I 
could rewrite those couple of scripts in PHP, but before long I'll need 
that package anyway to make the rest of the site portable between test and 
live versions.

... I hope that made sense.  :o)

Questions concerning Exporter:

1)  Is using Exporter necessary/the best way to include a seperate package 
file?

2)  The PHP include() reads the file into the current one as if the code 
were written in the current file.  I haven't come across anything that I 
can recall in PHP regarding namespaces, but I have an ok grasp of the 
concept.  I think.  The Exporter doc says "use ModuleName; This imports all 
the symbols from ModuleName's @EXPORT into the namespace of the use 
statement." Does that essentially mean the same thing?

3)  I read that exporting method names isn't good.  Is that why you would 
use Modulename();, importing no symbols?

4)  It seems that 'symbols' refers to references to variable names or to 
sub names.  Is that right?

Thanks in advance...

Rebekah 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/tallahassee-pm/attachments/20030701/f565b691/attachment.htm


More information about the Tallahassee-pm mailing list