The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CatalystX::Imports::Context::Config - Import Configuration Constants

BASE CLASSES

CatalystX::Imports::Context

SYNOPSIS

  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;

DESCRIPTION

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.

Aliasing

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' }];

METHODS

context_export_into

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.

get_export

This too overrides its original in CatalystX::Imports::Context. It will return export information for returning the configuration value.

DIAGNOSTICS

CatalystX::Imports::Context::Config does not accept tag specifications

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.

SEE ALSO

Catalyst, CatalystX::Imports::Context, CatalystX::Imports

AUTHOR AND COPYRIGHT

Robert 'phaylon' Sedlacek <rs@474.at>

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.