<html>
<br>
Ok, here goes with the background info before I get to the
questions:<br><br>
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. <br><br>
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. <br><br>
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.<br><br>
... I hope that made sense. :o)<br><br>
Questions concerning Exporter:<br><br>
1) Is using Exporter necessary/the best way to include a seperate
package file?<br><br>
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
"<font face="Courier New, Courier">use ModuleName; </font>This
imports all the symbols from ModuleName's @EXPORT into the namespace of
the <font face="Courier New, Courier">use statement." </font>Does
that essentially mean the same thing?<br><br>
3) I read that exporting method names isn't good. Is that why
you would use Modulename();, importing no symbols?<br><br>
4) It seems that 'symbols' refers to references to variable names
or to sub names. Is that right?<br><br>
Thanks in advance...<br>
<x-sigsep><p></x-sigsep>
Rebekah </html>