Subject: [LON-CAPA-dev] Using a loncapa.conf variable

From: Mark Lucas <[email-masked]>
Date: Fri, 25 Oct 2002 18:05:48 -0400 (EDT)

Hi-

	I want to reference a variable in LON-CAPA conf, such as 
lonHostID.

	What is the explicit protocol?

I see references to $perlvar in lonnet.pm

I see usage of $r->dir_config('lonHostID') elsewhere (which requires
 the presence of $r).

What are the other options (if any) for access? Any that do not require
the use of the request handle?

(I want to reference one of these variables in a routine within loncommon 
and currently the handle is not passed into this routine).

						Thanks,
						    Mark

----------------------------------------------------------------------------
Mark Lucas					email: [email-masked]
252D Clippinger Lab  				phone: (740)597-2984
Department of Physics and Astronomy             fax:   (740)593-0433
Ohio University
Athens, OH 45701

---

From: Scott Harrison <[email-masked]>
Date: Fri, 25 Oct 2002 18:26:04 -0400

Dear Highly Esteemed Sir:

loncapa/loncom/configuration/Configuration.pm has the API
for accessing LON-CAPA configuration variables.

For documentation, type
perldoc ./Configuration.pm

An example is from lond:
# ---------------------------------- Read loncapa_apache.conf and loncapa.conf
&status("Read loncapa.conf and loncapa_apache.conf");
my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf');
my %perlvar=%{$perlvarref};
undef $perlvarref;

Regards,
Scott

On Fri, Oct 25, 2002 at 06:05:48PM -0400, Mark Lucas wrote:
> _______________________________________________
> LON-CAPA-dev mailing list
> [email-masked]
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
> ------( NOTE )------------->
> This E-mail was scanned for viruses by Ramcell Online (http://www.ramcell.net/antivirus.asp)
> 

-- 
Scott Harrison, [email-masked]

---

From: Scott Harrison <[email-masked]>
Date: Fri, 25 Oct 2002 18:34:47 -0400

> my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf');

Note that the &read_conf subroutine is "hard-wired" to always
read loncapa_apache.conf.

Regards,
Scott

---

From: Guy Albertelli II <[email-masked]>
Date: Fri, 25 Oct 2002 20:28:51 -0400 (EDT)

Hi Mark,

> I see references to $perlvar in lonnet.pm

$Apache::lonnet::perlvar{'lonHostID'}

You probably should put a use Apache::lonnet at the top.

And if you aren't writing an Apache Module, then you should you
LONCAPA::Configuration as Scott mentioned.

-- 
[email-masked]          BM: n^20 t20 z20 qS 
Guy Albertelli -7-7-7-  O-
    I seldom buy things that have wacky smiling cartoon cephalopods 
    on the package.                 -Kibo