[Israel.pm] Importing variable

Roey Almog (Infoneto Ltd) almog at infoneto.co.il
Tue Aug 31 04:07:50 PDT 2010


You have to define what parameters exists in the configuration file:

Regarding your example it should be something like:

use AppConfig;
my $file = 'file.cfg';
my $config = AppConfig->new();
# say we have two parameters one called path the called DSN
$config->define('path=s', 'DSN=s');
$config->file($file);

print $conf->path, $conf->DSN;


On Tue, Aug 31, 2010 at 1:26 PM, Levenglick Dov-RM07994 <
RM07994 at freescale.com> wrote:

> I have a script:
>
> use AppConfig;
> my $file = 'file.cfg';
> my $config = AppConfig->new();
> $config->file($file);
>
> This results in file.cfg is not exported by the AppConfig module. What
> does this mean and how do I get around it?
>
>
> Best Regards,
> Dov Levenglick
> SmartDSP OS Development Leader
>
> -----Original Message-----
> From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
> Behalf Of Roey Almog (Infoneto Ltd)
> Sent: Tuesday, August 31, 2010 13:00
> To: Perl in Israel
> Subject: Re: [Israel.pm] Importing variable
>
> IMHO it is better to use one of the config modules (we use AppConfig)
> to do this
>
> also see http://www.ibm.com/developerworks/linux/library/l-perl3/
>
> Roey
>
>
> On Tue, Aug 31, 2010 at 12:47 PM, Levenglick Dov-RM07994
> <RM07994 at freescale.com> wrote:
> >
> > Hi,
> > Although this is bound to be the oldest question in the book, how do I
> > perform the C equivalent of #include "defines.h" in Perl 5.12
> > I want to have a separate file that will define variables accessible
> to
> > all parts of my script. If it makes the answer any easier, they can
> > become environment variables (i.e. inserted into %ENV).
> >
> >
> > Best Regards,
> > Dov Levenglick
> >
> >
> > _______________________________________________
> > Perl mailing list
> > Perl at perl.org.il
> > http://mail.perl.org.il/mailman/listinfo/perl
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl
>
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20100831/396c9852/attachment-0001.htm 


More information about the Perl mailing list