Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
On 05/10/06, Jonathan Rockway <[EMAIL PROTECTED]> wrote: > I'll put it in Catalyst svn and fix anything obvious, if you want, but > since I don't actually use the module, I don't want to commit to > maintaining it long term. Hopefully a user will step forward to > maintain it, but if not, I'll deal with it for now. > > Do you keep it in svn, or do you use some other RCS? I would prefer to > import the whole change history, if possible (never know when you need > to go back to an older version for whatever reason). > No Jonathan, i don't have the MicroMason view in any RCS. Was a very small module that didn't use very much. Putting it in the Catalyst svn is a great idea. Thanks very much. I can make a new release with the bug fix after that. Or i can give you PAUSE access to the module. -- Jonas ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
I'll put it in Catalyst svn and fix anything obvious, if you want, but since I don't actually use the module, I don't want to commit to maintaining it long term. Hopefully a user will step forward to maintain it, but if not, I'll deal with it for now. Do you keep it in svn, or do you use some other RCS? I would prefer to import the whole change history, if possible (never know when you need to go back to an older version for whatever reason). Regards, Jonathan Rockway Jonas Alves wrote: > Hi, > I can apply the patch, but i don't use the MicroMason view anymore. > Someone want to maintain it? > -- package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do { $,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //, ";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup; ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
On 03/10/06, Jon Warbrick <[EMAIL PROTECTED]> wrote: > On Mon, 2 Oct 2006, Matt S Trout wrote: > > > Jon Warbrick wrote: > > > But for some reason my Catalyst::View::MicroMason > > > view, called Lookup::View::MicroMason _isn't_ successfully configured - it > > > behaves as if the extra mixins are not present. Anyone any idea why? > > > > Yes. Because it's broken. > > > > my @Mixins = @{ $self->config->{Mixins} || [] }; > > > > should be > > > > my @Mixins = @{ $self->{Mixins} || [] }; > > > > and similarly throughout the module. > > > > I've cc'ed the author on this message in the hopes he'll fix it :) > > Here's a patch, in effect a rewrite of new() based on > Catalyst::View::TT::new(), which _appears_ to resolve the problem though I > still don't feel I entirely understand what should be happening here... > > Jon. Hi, I can apply the patch, but i don't use the MicroMason view anymore. Someone want to maintain it? -- Jonas ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
On Mon, 2 Oct 2006, Matt S Trout wrote: > Jon Warbrick wrote: > > But for some reason my Catalyst::View::MicroMason > > view, called Lookup::View::MicroMason _isn't_ successfully configured - it > > behaves as if the extra mixins are not present. Anyone any idea why? > > Yes. Because it's broken. > > my @Mixins = @{ $self->config->{Mixins} || [] }; > > should be > > my @Mixins = @{ $self->{Mixins} || [] }; > > and similarly throughout the module. > > I've cc'ed the author on this message in the hopes he'll fix it :) Here's a patch, in effect a rewrite of new() based on Catalyst::View::TT::new(), which _appears_ to resolve the problem though I still don't feel I entirely understand what should be happening here... Jon. --- MicroMason.pm.orig 2006-10-03 09:59:40.0 +0100 +++ MicroMason.pm 2006-10-03 11:49:48.0 +0100 @@ -5,7 +5,7 @@ use Text::MicroMason; use NEXT; -our $VERSION = '0.03'; +our $VERSION = '0.03_001'; __PACKAGE__->mk_accessors('template'); @@ -53,17 +53,25 @@ =cut sub new { -my $self = shift; -my $c= shift; -$self = $self->NEXT::new(@_); +my ( $class, $c, $arguments ) = @_; my $root = $c->config->{root}; -my @Mixins = @{ $self->config->{Mixins} || [] }; +my $config = { +template_root => "$root", +%{ $class->config }, +%{ $arguments }, +}; + +my $self = $class->NEXT::new( +$c, { %$config }, +); + +$self->config($config); + +my @Mixins = @{ $config->{Mixins} || [] }; push @Mixins, qw(-TemplateDir -AllowGlobals); -my %attribs = %{ $self->config }; -$self->template( Text::MicroMason->new( @Mixins, - template_root => "$root", - #allow_globals => [qw($c $base $name)], - %attribs ) ); +delete ($config->{Mixins}); + +$self->template( Text::MicroMason->new( @Mixins, %$config )); return $self; } -- Jon Warbrick Web/News Development, Computing Service, University of Cambridge ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
On Mon, 2 Oct 2006, Matt S Trout wrote: > Jon Warbrick wrote: > > But for some reason my Catalyst::View::MicroMason > > view, called Lookup::View::MicroMason _isn't_ successfully configured - it > > behaves as if the extra mixins are not present. Anyone any idea why? > > Yes. Because it's broken. > > ... Ta. That would explain why I've not been making any progress! Note for the record: MicroMason's -CompileCache mixin seems to be broken (twice) when it comes to expiring cached content when source files change (see [1]). Hence wanting different configurations for development and deployment. Hence wanting to configure it via ConfigLoader. Argh! Bugs! Jon. [1] http://rt.cpan.org/Public/Bug/Display.html?id=21802 -- Jon Warbrick Web/News Development, Computing Service, University of Cambridge ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
Jon Warbrick wrote: > But for some reason my Catalyst::View::MicroMason > view, called Lookup::View::MicroMason _isn't_ successfully configured - it > behaves as if the extra mixins are not present. Anyone any idea why? Yes. Because it's broken. my @Mixins = @{ $self->config->{Mixins} || [] }; should be my @Mixins = @{ $self->{Mixins} || [] }; and similarly throughout the module. I've cc'ed the author on this message in the hopes he'll fix it :) -- Matt S Trout Offering custom development, consultancy and support Technical Directorcontracts for Catalyst, DBIx::Class and BAST. Contact Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ + ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
On Sun, 1 Oct 2006, Matthieu Codron wrote: > Ash Berlin a écrit : > > > As to where it's documented, I cant seem to find it, but I'm sure it is > > somewhere, tho its clearly not obvious enough since I know its there and > > cant find it. > > I found it here: > http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7003/lib/Catalyst/Component.pm#COMPONENT(%24c%2C_%24arguments) > > But it was not quite obvious ... Ah, now I know what this is about it makes some sense. If I'm right, Catalyst::Plugin::ConfigLoader simply populates the $c->config hash. For each component, Catalyst arranges to look for keys in $c->config that are named after the component's package (but with the application name removed, so FooBar::Model::FooBarDB becomes Model::FooBarDB) and if found the resulting values are merged into the component's own config before calling it's new(). Hence allowing components to be configured via ConfigLoader. Is that vaguely right? If so it explains why the following YAML seems to correctly configure my Catalyst::Model::DBIC::Schema model, which is called lookup::Model::LookupDB. But for some reason my Catalyst::View::MicroMason view, called Lookup::View::MicroMason _isn't_ successfully configured - it behaves as if the extra mixins are not present. Anyone any idea why? Jon. --- name: Lookup Model::LookupDB: schema_class: Ucam::LookupDB connect_info: - dbi:Pg:dbname=jw35 View::MicroMason: Mixins: - -Filters - -CompileCache -- Jon Warbrick Web/News Development, Computing Service, University of Cambridge___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
Hi, Ash Berlin a écrit : > Jon Warbrick wrote: >> Can a Catalyst::Model::DBIC::Schema model be configured from a YAML >> file via Catalyst::Plugin::Config::YAML? If so, how? Apologies if it's in >> the documentation somewhere, but if so I've yet to find it... >> >> Jon. >> >> > The answer is yes. Strip off "Catalyst::" from the component name. e.g. > > name: MyApp > Model::MyModel: > arg1: foo > arg2: > - bar > - baz > View::TT > DEBUG: 1 > > As to where it's documented, I cant seem to find it, but I'm sure it is > somewhere, tho its clearly not obvious enough since I know its there and > cant find it. I found it here: http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7003/lib/Catalyst/Component.pm#COMPONENT(%24c%2C_%24arguments) But it was not quite obvious ... Putting database connection information in config files is really basic stuff. An example in the tutorial could be very useful to lots of people, I think. -- Matthieu ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
On Thu, 28 Sep 2006, Ash Berlin wrote: > Jon Warbrick wrote: > > Can a Catalyst::Model::DBIC::Schema model be configured from a YAML > > file via Catalyst::Plugin::Config::YAML? If so, how? Apologies if it's in > > the documentation somewhere, but if so I've yet to find it... > > > > Jon. > > > > > The answer is yes. Strip off "Catalyst::" from the component name. e.g. > > name: MyApp > Model::MyModel: > arg1: foo > arg2: > - bar > - baz > View::TT > DEBUG: 1 Many thanks (and to Brian Cassidy who said much the same). I thought I'd tried most combinations of various truncated component names but obviously not this one. Now working. > As to where it's documented, I cant seem to find it, but I'm sure it is > somewhere, tho its clearly not obvious enough since I know its there and > cant find it. Glad it's not just me! Jon. -- Jon Warbrick Web/News Development, Computing Service, University of Cambridge ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
Jon Warbrick wrote: > Can a Catalyst::Model::DBIC::Schema model be configured from a YAML > file via Catalyst::Plugin::Config::YAML? If so, how? Apologies if it's in > the documentation somewhere, but if so I've yet to find it... > > Jon. > > The answer is yes. Strip off "Catalyst::" from the component name. e.g. name: MyApp Model::MyModel: arg1: foo arg2: - bar - baz View::TT DEBUG: 1 As to where it's documented, I cant seem to find it, but I'm sure it is somewhere, tho its clearly not obvious enough since I know its there and cant find it. Ash ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
Jon Warbrick wrote: > Can a Catalyst::Model::DBIC::Schema model be configured from a YAML > file via Catalyst::Plugin::Config::YAML? If so, how? Apologies if it's in > the documentation somewhere, but if so I've yet to find it... > > Jon. > > package MyApp; use Catalyst qw( ConfigLoader ); # ... 1; in myapp.yml Model::MyModel: schema_class: MySchema connect_info: - dbi:blahblah - username - password ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Configuring Catalyst::Model::DBIC::Schema from YAML
Can a Catalyst::Model::DBIC::Schema model be configured from a YAML file via Catalyst::Plugin::Config::YAML? If so, how? Apologies if it's in the documentation somewhere, but if so I've yet to find it... Jon. -- Jon Warbrick Web/News Development, Computing Service, University of Cambridge ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/