CatalystX::Imports::Context::Config - Import Configuration Constants
CatalystX::Imports::Context
package MyApp::Controller::Foo; use base 'Catalyst::Controller'; use CatalystX::Imports Config => [qw(bar baz)]; __PACKAGE__->config( bar => 23, baz => 17, ); sub bar_and_baz: Local { my ($self, $c) = @_; $c->response->body( bar + baz ); # now 40 } 1;
This class provides exports for the CatalystX::Imports module. It does not, however, define exports in the usual sense. Instead, it will export inline accessors to your local controller configuration.
This library does not accept any tags. If you try to pass some anyway, for example :all, an error will be raised. Naturally, this module will not export anything by default.
:all
To avoid symbol name conflicts, you can pass a hash reference with "configuration name"/"alias to export" pairs, like this:
use CatalystX::Imports Config => { model => 'model_name' };
Often you won't need to alias all of them, but just a few. Fortunately, you can mix them:
use CatalystX::Imports Config => ['model_order', { model => 'model_name' }];
This overrides the original in CatalystX::Imports::Context to raise an error when tags are used. It also contains some internal convenience transformations for aliasing.
This too overrides its original in CatalystX::Imports::Context. It will return export information for returning the configuration value.
You tried to import symbols by specifying a tag, like :all, to the import arguments of this library. However, this module doesn't respond to tags, and therefore fails to accept them generally.
To solve this problem, specify the configuration values you want to export explicitly.
Catalyst, CatalystX::Imports::Context, CatalystX::Imports
Robert 'phaylon' Sedlacek <rs@474.at>
<rs@474.at>
This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.
To install CatalystX::Imports, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::Imports
CPAN shell
perl -MCPAN -e shell install CatalystX::Imports
For more information on module installation, please visit the detailed CPAN module installation guide.