3 class CatalystX::Declare::Keyword::Application
4 extends MooseX::Declare::Syntax::Keyword::Class {
6 use aliased 'CatalystX::Declare::Context::AppSetup';
9 override auto_make_immutable { 0 }
11 around context_traits { $self->$orig, AppSetup }
13 override add_with_option_customizations (Object $ctx, Str $package, ArrayRef $plugins, HashRef $options) {
15 $ctx->add_setup_code_parts($package, $plugins)
18 before add_namespace_customizations (Object $ctx, Str $package) {
20 $ctx->add_preamble_code_parts(
22 'use parent q{Catalyst}',
26 after add_optional_customizations (Object $ctx, Str $package) {
28 $ctx->add_setup_code_parts($package)
29 unless $ctx->setup_was_called;
35 CatalystX::Declare::Keyword::Application - Declare Catalyst Application Classes
39 use CatalystX::Declare;
41 application MyApp::Web
45 $CLASS->config(name => 'My App');
47 method debug_timestamp {
48 $self->log->debug('Timestamp: ' . time)
55 This module provides a keyword handler for the C<application> keyword. It is an
56 extension of L<MooseX::Declare/class>. The role application mechanism behind
57 the C<with> specification is hijacked and the arguments are passed to
58 Catalyst's C<setup> method. This hijacking is proably going away someday since
59 in the future plugins will be actual roles.
61 You don't have to call the C<setup> method yourself, this will be done by the
62 handler after the body has been run.
68 =item L<MooseX::Declare::Syntax::Keyword::Class>
74 =head2 auto_make_immutable
76 Bool Object->auto_make_immutable ()
78 A modified method that returns C<0> to signal to L<MooseX::Declare> that it
79 should not make this class immutable. Currently, making application classes
80 immutable isn't supported yet, therefore C<is mutable> is currently a no-op.
81 This will likely change as soon as application classes can be made immutable,
85 List[ClassName] Object->context_traits ()
87 This extends the remaining context traits with
88 L<CatalystX::Declare::Context::AppSetup> to manage calls to
89 L<Catalyst/MyApp-E<gt>setup>.
91 =head2 add_with_option_customizations
93 Object->add_with_option_customizations (
100 This will prepare L<Catalyst/MyApp-E<gt>setup> to be called with the list of
101 plugins that were specified as roles.
103 =head2 add_namespace_customizations
105 Object->add_namespace_customizations (Object $ctx, Str $package)
107 This will prepare L<Catalyst> as a parent and import L<CLASS> into the
108 application's namespace before the other customizations are run.
110 =head2 add_optional_customizations
112 Object->add_optional_customizations (Object $ctx, Str $package)
114 After all customizations have been done, this modifier will push a call to
115 L<Catalyst/MyApp-E<gt>setup> if this wasn't already done by the plugin
122 =item L<CatalystX::Declare>
124 =item L<MooseX::Declare/class>
126 =item L<MooseX::Declare::Syntax::Keyword::Class>
132 See L<CatalystX::Declare/AUTHOR> for author information.
136 This program is free software; you can redistribute it and/or modify it under
137 the same terms as perl itself.