3 SGN::View::Mason - Mason View Component for SGN
7 Mason View Component for SGN. This extends Catalyst::View::HTML::Mason.
11 package SGN
::View
::Mason
;
13 use Moose
::Util
::TypeConstraints
;
14 use namespace
::autoclean
;
16 extends
'Catalyst::View::HTML::Mason';
17 with
'Catalyst::Component::ApplicationAttribute';
21 template_extension
=> '.mas',
23 data_dir
=> SGN
->tempfiles_base->subdir('mason'),
25 [ main
=> SGN
->path_to('mason') ],
27 preamble
=> "use utf8; ",
31 =head1 CONFIGURATION SETTINGS (which are also accessors)
35 Configurable arrayref of additional Mason component roots. These will
36 be searched before the default ones. Must be absolute paths.
40 # munges the interp_args comp_root to include the add_comp_root
41 # configuration, plus the comp roots for SiteFeatures
43 my ( $class, $c, $args ) = @_;
45 $args = $class->merge_config_hashes( $class->config, $args );
47 # coerce add_comp_root to arrayref
48 if( $args->{add_comp_root
} && ! ref $args->{add_comp_root
} ) {
49 $args->{add_comp_root
} = [ $args->{add_comp_root
} ];
52 # add comp roots for features and add_comp_root
53 unshift @
{ $args->{interp_args
}->{comp_root
} }, (
55 ( map [ additional
=> $_ ], @
{ $args->{add_comp_root
} || [] } ),
57 ( map [ $_->feature_name, $_->path_to('mason')], $c->features ),
60 return $class->new($c, $args);
65 =head2 $self->component_exists($component)
67 Check if a Mason component exists. Returns 1 if the component exists, otherwise 0.
72 sub component_exists
{
73 my ( $self, $component ) = @_;
75 return $self->interp->comp_exists( $component ) ?
1 : 0;
80 L<SGN>, L<HTML::Mason>, L<Catalyst::View::HTML::Mason>
84 Robert Buels, Jonathan "Duke" Leto
88 This library is free software . You can redistribute it and/or modify it under
89 the same terms as perl itself.
93 __PACKAGE__
->meta->make_immutable;