fixed non-moosey action classes and documented isa option
[catagits/CatalystX-Declare.git] / lib / CatalystX / Declare / Keyword / Application.pm
CommitLineData
856ac9a7 1use MooseX::Declare;
2
3class CatalystX::Declare::Keyword::Application
4 extends MooseX::Declare::Syntax::Keyword::Class {
5
6
7 override auto_make_immutable { 0 }
8
9 override add_with_option_customizations (Object $ctx, Str $package, ArrayRef $plugins, HashRef $options) {
10
11 $ctx->add_cleanup_code_parts(
12 sprintf(
13 '%s->setup(qw( %s ))',
14 $package,
15 join(' ', @$plugins),
16 ),
17 '1;',
18 );
19 }
20
21 before add_namespace_customizations (Object $ctx, Str $package) {
22
23 $ctx->add_preamble_code_parts(
24 'use CLASS',
25 'use parent q{Catalyst}',
26 );
27 }
28}
29
30=head1 NAME
31
32CatalystX::Declare::Keyword::Application - Declare Catalyst Application Classes
33
34=head1 SYNOPSIS
35
36 use CatalystX::Declare;
37
38 application MyApp::Web
39 with Static::Simple
40 with ConfigLoader {
41
42 $CLASS->config(name => 'My App');
43
44 method debug_timestamp {
45 $self->log->debug('Timestamp: ' . time)
46 if $self->debug;
47 }
48 }
49
50=head1 DESCRIPTION
51
52This module provides a keyword handler for the C<application> keyword. It is an
53extension of L<MooseX::Declare/class>. The role application mechanism behind
54the C<with> specification is hijacked and the arguments are passed to
55Catalyst's C<setup> method. This hijacking is proably going away someday since
56in the future plugins will be actual roles.
57
58You don't have to call the C<setup> method yourself, this will be done by the
744e2821 59handler after the body has been run.
856ac9a7 60
61=head1 SUPERCLASSES
62
63=over
64
65=item L<MooseX::Declare::Syntax::Keyword::Class>
66
67=back
68
69=head1 METHODS
70
71=head2 auto_make_immutable
72
73 Bool Object->auto_make_immutable ()
74
75A modified method that returns C<0> to signal to L<MooseX::Declare> that it
76should not make this class immutable. Currently, making application classes
77immutable isn't supported yet, therefore C<is mutable> is currently a no-op.
78This will likely change as soon as application classes can be made immutable,
79
80=head1 SEE ALSO
81
82=over
83
84=item L<CatalystX::Declare>
85
86=item L<MooseX::Declare/class>
87
88=item L<MooseX::Declare::Syntax::Keyword::Class>
89
90=back
91
92=head1 AUTHOR
93
94See L<CatalystX::Declare/AUTHOR> for author information.
95
96=head1 LICENSE
97
98This program is free software; you can redistribute it and/or modify it under
99the same terms as perl itself.
100
101=cut