Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Configuration process

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


frederic at demians

Jul 1, 2009, 10:30 AM

Post #1 of 7 (611 views)
Permalink
Configuration process

Hello,

It must be a newbie question...

I have a simple application, let say MyApp. In lib/MyApp.pm, I ask for
standard config loading with:

Catalyst qw/ ConfigLoader /

I want to add config variables from another source than myapp.conf. But
in order to construct those variables I need to access configuration
variables loaded by ConfigLoader. But those variables are not yet loaded
when I access them:

myapp.conf contains:

filepath /path/to/config.xml

And in MyApp.pm, I have:

__PACKAGE__->config(
speciolconf => XMLin( __PACKAGE->config->{filepath}
);

This issue is that __PACKAGE->config->{filepath} is not initialized.

How can I do?

Thanks.
--
Frédéric

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


alejandro.imass at gmail

Jul 2, 2009, 8:06 AM

Post #2 of 7 (559 views)
Permalink
Re: Configuration process [In reply to]

Why don't you just use the standard yml config file?

On Thu, Jul 2, 2009 at 1:00 PM, Frederic Demians<frederic[at]demians.fr> wrote:
> Hello,
>
> It must be a newbie question...
>
> I have a simple application, let say MyApp. In lib/MyApp.pm, I ask for
> standard config loading with:
>
> Catalyst qw/ ConfigLoader /
>
> I want to add config variables from another source than myapp.conf. But in
> order to construct those variables I need to access configuration variables
> loaded by ConfigLoader. But those variables are not yet loaded when I access
> them:
>
> myapp.conf contains:
>
> filepath /path/to/config.xml
>
> And in MyApp.pm, I have:
>
> __PACKAGE__->config(
> speciolconf => XMLin( __PACKAGE->config->{filepath}
> );
>
> This issue is that __PACKAGE->config->{filepath} is not initialized.
>
> How can I do?
>
> Thanks.
> --
> Frédéric
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


orasnita at gmail

Jul 2, 2009, 12:17 PM

Post #3 of 7 (558 views)
Permalink
Re: Configuration process [In reply to]

From: "Alejandro Imass" <alejandro.imass[at]gmail.com>
> Why don't you just use the standard yml config file?

If I remember well, the recommended configuration file type is .conf
(Config::General) and not .yaml. Isn't it true?

Octavian


_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


alejandro.imass at gmail

Jul 2, 2009, 1:06 PM

Post #4 of 7 (555 views)
Permalink
Re: Configuration process [In reply to]

You are right and this is something new. I've only ported my apps to
new cat releases but haven't started one from scratch in a while.

I just tested, and sure enough, it creates a .conf file instead of the
traditional yaml file, although it says:

# rename this file to test.yml and put a : in front of "name" if
# you want to use yaml like in old versions of Catalyst

Guess I have to catchup to all these changes... :(


On Fri, Jul 3, 2009 at 2:47 PM, Octavian Râsnita<orasnita[at]gmail.com> wrote:
> From: "Alejandro Imass" <alejandro.imass[at]gmail.com>
>>
>> Why don't you just use the standard yml config file?
>
> If I remember well, the recommended configuration file type is .conf
> (Config::General) and not .yaml. Isn't it true?
>
> Octavian
>
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


marcus at nordaaker

Jul 2, 2009, 1:46 PM

Post #5 of 7 (555 views)
Permalink
Re: Configuration process [In reply to]

This is not a very recent change. It was introduced in 1.07 which were
released 2008-05-28. All documentation should be updated to reflect
this change. Personally I prefer JSON, and anything but
Config::General tho. This is just a default, and can be changed
easily.

With regards
Marcus Ramberg

On Thu, Jul 2, 2009 at 10:06 PM, Alejandro
Imass<alejandro.imass[at]gmail.com> wrote:
> You are right and this is something new. I've only ported my apps to
> new cat releases but haven't started one from scratch in a while.
>
> I just tested, and sure enough, it creates a .conf file instead of the
> traditional yaml file, although it says:
>
> # rename this file to test.yml and put a : in front of "name" if
> # you want to use yaml like in old versions of Catalyst
>
> Guess I have to catchup to all these changes... :(
>
>
> On Fri, Jul 3, 2009 at 2:47 PM, Octavian Râsnita<orasnita[at]gmail.com> wrote:
>> From: "Alejandro Imass" <alejandro.imass[at]gmail.com>
>>>
>>> Why don't you just use the standard yml config file?
>>
>> If I remember well, the recommended configuration file type is .conf
>> (Config::General) and not .yaml. Isn't it true?
>>
>> Octavian
>>
>>
>> _______________________________________________
>> List: Catalyst[at]lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>>
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


bobtfish at bobtfish

Jul 2, 2009, 3:03 PM

Post #6 of 7 (552 views)
Permalink
Re: Configuration process [In reply to]

On 3 Jul 2009, at 15:36, Alejandro Imass wrote:

> You are right and this is something new. I've only ported my apps to
> new cat releases but haven't started one from scratch in a while.
>
> I just tested, and sure enough, it creates a .conf file instead of the
> traditional yaml file, although it says:
>
> # rename this file to test.yml and put a : in front of "name" if
> # you want to use yaml like in old versions of Catalyst
>
> Guess I have to catchup to all these changes... :(

Don't worry. A lot of people still use YAML in preference to
Config::General style .conf.

Both are still fully supported.

The main reason that the default for generated apps was changed is
that it's _FAR TOO EAY_ for a newbie to mess up the whitespace in
YAML (especially when copying it out of POD sections).

This caused a large amount of confusion for people new to the
framework, therefore we changed to Config::General as it doesn't have
those drawbacks.

I still exclusively use YAML in my apps (as it's what I'm used to,
and what all of work's none Catalyst stuff already used).

Cheers
t0m


_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


alejandro.imass at gmail

Jul 2, 2009, 3:58 PM

Post #7 of 7 (552 views)
Permalink
Re: Configuration process [In reply to]

Ok! Good to hear, I honestly prefer YAML/JSON for human-readable
serialization any day.

I just skipped through the Config::General POD and I think I'd rather
write my configs in terse Dumper than learn this yaml (pun intended)
<lol>


On Fri, Jul 3, 2009 at 5:33 PM, Tomas Doran<bobtfish[at]bobtfish.net> wrote:
>
> On 3 Jul 2009, at 15:36, Alejandro Imass wrote:
>
>> You are right and this is something new. I've only ported my apps to
>> new cat releases but haven't started one from scratch in a while.
>>
>> I just tested, and sure enough, it creates a .conf file instead of the
>> traditional yaml file, although it says:
>>
>> # rename this file to test.yml and put a : in front of "name" if
>> # you want to use yaml like in old versions of Catalyst
>>
>> Guess I have to catchup to all these changes... :(
>
> Don't worry. A lot of people still use YAML in preference to Config::General
> style .conf.
>
> Both are still fully supported.
>
> The main reason that the default for generated apps was changed is that it's
> _FAR TOO EAY_ for a newbie to mess up the whitespace in YAML (especially
> when copying it out of POD sections).
>
> This caused a large amount of confusion for people new to the framework,
> therefore we changed to Config::General as it doesn't have those drawbacks.
>
> I still exclusively use YAML in my apps (as it's what I'm used to, and what
> all of work's none Catalyst stuff already used).
>
> Cheers
> t0m
>
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.