RE: Porting CGI scripts help needed

2001-07-26 Thread Joe Breeden

You might try adding use lib '/path/to/global.pm'; to you startup.pl.
(Without the s of course)

Good luck.

--Joe Breeden

--
Sent from my Outlook 2000 Wired Deskheld (www.microsoft.com)


 -Original Message-
 From: Bryan Coon [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 26, 2001 6:01 PM
 To: '[EMAIL PROTECTED]'
 Subject: Porting CGI scripts help needed
 
 
 Hi,
 
 I have (happily) compiled and configured Apache with 
 mod_perl, mod_ssl,
 mod_php and DSO.  Whee!
 
 Now I am working on porting my scripts over...
 
 I have always used strict and perl -w, so for the most part, 
 I think I can
 just pop my cgis in the /perl directory as Ive defined it in 
 httpd.conf.
 
 However, I had to implement some trickery for my scripts a 
 while ago via
 require/use and am having problems getting my scripts to work.
 
 Heres what I did:
 I had many scripts in one dir that shared many things; 
 subroutines, global
 variables and modules.  I wanted to clean things up, so I 
 created a module
 called global.pm structured like this:
 ---
 use strict;
 
 ## Local parameters
 our $cgibin = http://path/cgi-bin;;
 our $htmldir = /apache/htdocs
 our $a = /some/path;
 our $b = /some/other/path;
 
 ## Common modules
 use CGI qw(:standard);
 use DBI;
 use Data::Table;
 
 ## Custom stuff
 require /path/to/custom/script1.pl;
 require /path/to/custom/script2.pl;
 1;
 ---
 
 The custom stuff scripts all end in 1;, and are loaded with my custom
 subroutines.  For example, I have one called cgi.pl, that 
 contains all subs
 for cgi related tasks, i.e. checkUser(), which verifies a 
 users cookie.
 
 Each cgi simply calls 'use global;' and then off we go.  
 However, after
 moving all this stuff into /perl, none of the subs in the 
 custom .pl files
 are found, I get a complaint:
 Undefined Subroutine Apache::ROOT::compar_2ecgi::checkUser 
 called at .
 
 compare.cgi calls 'use global;' and then 'checkUser()'.  
 
 What am I doing wrong with this?  Any ideas?  
 
 Thanks!
 Bryan
 



RE: Porting CGI scripts help needed

2001-07-26 Thread Rob Bloodgood

 Heres what I did:
 I had many scripts in one dir that shared many things; subroutines, global
 variables and modules.  I wanted to clean things up, so I created a module
 called global.pm structured like this:

snip

 The custom stuff scripts all end in 1;, and are loaded with my custom
 subroutines.  For example, I have one called cgi.pl, that
 contains all subs
 for cgi related tasks, i.e. checkUser(), which verifies a users cookie.

 Each cgi simply calls 'use global;' and then off we go.  However, after
 moving all this stuff into /perl, none of the subs in the custom .pl files
 are found, I get a complaint:
 Undefined Subroutine Apache::ROOT::compar_2ecgi::checkUser
 called at .

 compare.cgi calls 'use global;' and then 'checkUser()'.

global.pm isn't exporting the symbol names it's defining.
if you were to refer to global::checkUser() in one of your scripts, and it
worked, then mebbe an EXPORT() list for global.pm is in order

so that the function names get defined in the package
(Apache::ROOT::compar_2ecgi, made up by apache on the spot)
that is accessing them.

HTH!

L8r,
Rob