NAME

CatalystX::ComponentsFromConfig::ViewPlugin - plugin to create Views from configuration

VERSION

version 1.0

SYNOPSIS

In your application:

package My::App;
use Catalyst qw(
    ConfigLoader
    +CatalystX::ComponentsFromConfig::ViewPlugin
);

In your config:

<View::MyClass>
 class My::Class
 <args>
   some  param
 </args>
 <traits>
   +My::Special::Role
 </traits>
</View::MyClass>

Now, $c->view('MyClass') will contain an object built just like:

my $obj = My::Class->new({some=>'param'});
apply_all_roles($obj,'My::Special::Role');

DESCRIPTION

This plugin, built on CatalystX::ComponentsFromConfig::Role::PluginRole, allows you to create view components at application setup time, just by specifying them in the configuration.

GLOBAL CONFIGURATION

<views_from_config>
 base_class My::ViewAdaptor
</views_from_config>

The default base_class is CatalystX::ComponentsFromConfig::ViewAdaptor, buty you can specify whatever adaptor you want. Of course, you have to make sure that the view-specific configuration block is in the format that your adaptor expects.

AUTHORS

  • Tomas Doran (t0m) <bobtfish@bobtfish.net>

  • Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Net-a-porter.com.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.