[Catalyst] ConfigLoader and components

T. H. Lin easy.lin at gmail.com
Wed May 10 10:01:44 CEST 2006


maybe you have wrong syntax in *.yml


On 10/05/06, Nathan Kurz <nate at verse.com> wrote:
> I've been beating my head against this for an hour now, and think I
> must be missing something.  How can I use ConfigLoader to let me set
> the database dsn in myapp.yml, and pass that along to the component
> I'm deriving from Catalyst::Model::DBIC::Schema?
>
> For a plugin, I think I'd just need to override setup(), but for a
> component do I override new()?  COMPONENT()?  Looking at the code in
> setup_components(), it seems I should be able to do something like:
>
> App::Model::DB.pm:
>   sub new {
>       my $c = shift;
>       my ($config) = @_;
>       ...do something with $config...
>       return $c->NEXT::new(@_);
>   }
> ----------------------
> app.yml:
>   Model::DB:
>      dsn: 'dbi:SQLite:dbname=/var/www/sqlite/app.db'
>
> But I can't make this work.   What's the right way to do this?
>
> (sorry if I'm sounding incoherent---I'm feeling that way too)
>
> Nathan Kurz
> nate at verse.com
>
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>



More information about the Catalyst mailing list