You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Carlos Kassab <ck...@glin.com.mx> on 2002/12/26 23:34:10 UTC

Importing variables and subrutines from a config and/or subs file, please help..

Hi:


I have a config file conf.epl and its content is:

[-
$dbname="mydb";
$dbusername = "ckg";
$dbpassword = "clave";
$stylecss="files/style/style.css";
-]

In other file i load this file(conf.epl):

[-

Execute ({inputfile => 'conf.epl', import =>1, package =>__PACKAGE__});

-]

<LINK REL="StyleSheet" HREF="[+ $stylecss +]" TYPE="text/css">

but sometimes it prints:

<LINK REL="StyleSheet" HREF="" TYPE="text/css">

The problem is that some times the file loads fine and the variables are
imported, but some times not.

Is there another way to load the config file to import the variables?

I am using Advanced extranet server on a Mandrake Linux 9.0, so i am
using embperl 1.3.4 and apache server 1.3.26



Thank you in advance.

Carlos Kassab 



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Importing variables and subrutines from a config and/or subsfile, please help..

Posted by Gerald Richter <ri...@ecos.de>.
>I am Executing the file but, I do not know how to append the variables to
the $req object.


In the file you are executing:

[-
$r = shift ;
$r -> {foo} = 'bar' ;
$r -> {foo2} = 'bar2' ;
-]

Call it with

[- Execute ('file.epl') -]

and access you vars with

[-
$r = shift ; # only once per page

$foo = $r -> {foo} ;
-]

That is really a better way then setting globals

Gerald



It would be great if you can post some examples.

Thank you

Carlos Kassab

El vie, 27-12-2002 a las 06:21, Luiz Fernando B. Ribeiro escribió:
> Em 26 Dec 2002 16:34:10 -0600
> Carlos Kassab <ck...@glin.com.mx> escreveu:
>
> > Hi:
> >
> >
> > I have a config file conf.epl and its content is:
> >
> > [-
> > $dbname="mydb";
> > $dbusername = "ckg";
> > $dbpassword = "clave";
> > $stylecss="files/style/style.css";
> > -]
> >
> > In other file i load this file(conf.epl):
> >
> > [-
> >
> > Execute ({inputfile => 'conf.epl', import =>1, package
> > =>__PACKAGE__});
> >
> > -]
> >
> > <LINK REL="StyleSheet" HREF="[+ $stylecss +]" TYPE="text/css">
> >
> > but sometimes it prints:
> >
> > <LINK REL="StyleSheet" HREF="" TYPE="text/css">
> >
> > The problem is that some times the file loads fine and the variables
> > are imported, but some times not.
> >
> > Is there another way to load the config file to import the variables?
> >
> > I am using Advanced extranet server on a Mandrake Linux 9.0, so i am
> > using embperl 1.3.4 and apache server 1.3.26
>
> Hi,
>
> In this case you should use a require or do statement.
> Or if you are using mod_perl you can Execute the file and append
> the variables to the $req object that is passed in @_ to all pages
> executed. If you don't know how to do this I can post some examples.
>
> Regards,
>
> Luiz Fernando B. Ribeiro
> Engenho Soluções para a Internet
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
--
Consultoría ERP BaaN Tools
Aplicaciones Internet/Intranet
http://www.glin.com.mx



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Importing variables and subrutines from a config and/or subs file, please help..

Posted by Carlos Kassab <ck...@glin.com.mx>.
Luiz Fernando:

I am using mod_perl.

I am Executing the file but, I do not know how to append the variables to the $req object. 

It would be great if you can post some examples.

Thank you

Carlos Kassab

El vie, 27-12-2002 a las 06:21, Luiz Fernando B. Ribeiro escribió:
> Em 26 Dec 2002 16:34:10 -0600
> Carlos Kassab <ck...@glin.com.mx> escreveu:
> 
> > Hi:
> > 
> > 
> > I have a config file conf.epl and its content is:
> > 
> > [-
> > $dbname="mydb";
> > $dbusername = "ckg";
> > $dbpassword = "clave";
> > $stylecss="files/style/style.css";
> > -]
> > 
> > In other file i load this file(conf.epl):
> > 
> > [-
> > 
> > Execute ({inputfile => 'conf.epl', import =>1, package
> > =>__PACKAGE__});
> > 
> > -]
> > 
> > <LINK REL="StyleSheet" HREF="[+ $stylecss +]" TYPE="text/css">
> > 
> > but sometimes it prints:
> > 
> > <LINK REL="StyleSheet" HREF="" TYPE="text/css">
> > 
> > The problem is that some times the file loads fine and the variables
> > are imported, but some times not.
> > 
> > Is there another way to load the config file to import the variables?
> > 
> > I am using Advanced extranet server on a Mandrake Linux 9.0, so i am
> > using embperl 1.3.4 and apache server 1.3.26
> 
> Hi,
> 
> In this case you should use a require or do statement.
> Or if you are using mod_perl you can Execute the file and append
> the variables to the $req object that is passed in @_ to all pages
> executed. If you don't know how to do this I can post some examples.
> 
> Regards,
> 
> Luiz Fernando B. Ribeiro
> Engenho Soluções para a Internet
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
-- 
Consultoría ERP BaaN Tools
Aplicaciones Internet/Intranet
http://www.glin.com.mx



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Importing variables and subrutines from a config and/or subs file, please help..

Posted by "Luiz Fernando B. Ribeiro" <lu...@engenhosolucoes.com.br>.
Em 26 Dec 2002 16:34:10 -0600
Carlos Kassab <ck...@glin.com.mx> escreveu:

> Hi:
> 
> 
> I have a config file conf.epl and its content is:
> 
> [-
> $dbname="mydb";
> $dbusername = "ckg";
> $dbpassword = "clave";
> $stylecss="files/style/style.css";
> -]
> 
> In other file i load this file(conf.epl):
> 
> [-
> 
> Execute ({inputfile => 'conf.epl', import =>1, package
> =>__PACKAGE__});
> 
> -]
> 
> <LINK REL="StyleSheet" HREF="[+ $stylecss +]" TYPE="text/css">
> 
> but sometimes it prints:
> 
> <LINK REL="StyleSheet" HREF="" TYPE="text/css">
> 
> The problem is that some times the file loads fine and the variables
> are imported, but some times not.
> 
> Is there another way to load the config file to import the variables?
> 
> I am using Advanced extranet server on a Mandrake Linux 9.0, so i am
> using embperl 1.3.4 and apache server 1.3.26

Hi,

In this case you should use a require or do statement.
Or if you are using mod_perl you can Execute the file and append
the variables to the $req object that is passed in @_ to all pages
executed. If you don't know how to do this I can post some examples.

Regards,

Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Importing variables and subrutines from a config and/or subs file,please help..

Posted by Gerald Richter <ri...@ecos.de>.
Hi:
>
>
> I have a config file conf.epl and its content is:
>
> [-
> $dbname="mydb";
> $dbusername = "ckg";
> $dbpassword = "clave";
> $stylecss="files/style/style.css";
> -]
>
> In other file i load this file(conf.epl):
>
> [-
>
> Execute ({inputfile => 'conf.epl', import =>1, package =>__PACKAGE__});
>
> -]
>

import does not import any variables (only [$ sub xx $]), without the import
=> 1 it will work, because the variables are set for every run

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org