[Gas] Re: Gas FindBin

Zachary C.Miller wolfgang at wolfgang.groogroo.com
Mon May 7 16:27:22 CDT 2001


Alright I have changed the "use FindBin" to "require FindBin" and
moved it down to be inside the branch of code where FindBin results
are used. cvs update and you'll get it. 

The dir data is needed to set up default locations for things in other
Gas modules. OutputManager needs to know where the tmpl directory
is. AuthManager should/could use this to set a default location for
the keys directory (but it doesn't...because it uses /tmp as the
default...). 

Anyway you have the option of doing your own calculation for $dir
(hard code it or figure it out some other way) in your .cgi program
and then pass it as a parameter to Gas::new like this:

Gas->new(-cgi => $cgi, 
         -dir => $dir); 

If you pass the -dir option to Gas::new it will not call the FindBin
routines so any errors associated with FindBin will not occur. 

So the idiom would be something like this:

# at the top of driver.cgi
use vars qw($dir);
BEGIN {
  # some calculation setting $dir here
  $dir = "/home/bobcook/project/"; 
};
use lib "$dir/lib";

use BobsProject;

my ($cgi, $gas, $om, $em, $db, $am, $sm);

eval {
    $cgi = CGI->new();
    $gas = Gas->new(-cgi => $cgi, 
                    -dir => $dir);

# etc....

-- 
Zachary C. Miller - @= - http://wolfgang.groogroo.com/
IMSA 1995 - UIUC 2000 - Just Another Leftist Muppet - Ya Basta!
 Social Justice, Community, Nonviolence, Decentralization, Feminism,
 Sustainability, Responsibility, Diversity, Democracy, Ecology








More information about the Gas mailing list