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') ],
30 =head1 CONFIGURATION SETTINGS (which are also accessors)
34 Configurable arrayref of additional Mason component roots. These will
35 be searched before the default ones. Must be absolute paths.
39 # munges the interp_args comp_root to include the add_comp_root
40 # configuration, plus the comp roots for SiteFeatures
42 my ( $class, $c, $args ) = @_;
44 $args = $class->merge_config_hashes( $class->config, $args );
46 # coerce add_comp_root to arrayref
47 if( $args->{add_comp_root
} && ! ref $args->{add_comp_root
} ) {
48 $args->{add_comp_root
} = [ $args->{add_comp_root
} ];
51 # add comp roots for features and add_comp_root
52 unshift @
{ $args->{interp_args
}->{comp_root
} }, (
54 ( map [ additional
=> $_ ], @
{ $args->{add_comp_root
} || [] } ),
56 ( map [ $_->feature_name, $_->path_to('mason')], $c->features ),
59 return $class->new($c, $args);
64 =head2 $self->component_exists($component)
66 Check if a Mason component exists. Returns 1 if the component exists, otherwise 0.
71 sub component_exists
{
72 my ( $self, $component ) = @_;
74 return $self->interp->comp_exists( $component ) ?
1 : 0;
79 L<SGN>, L<HTML::Mason>, L<Catalyst::View::HTML::Mason>
83 Robert Buels, Jonathan "Duke" Leto
87 This library is free software . You can redistribute it and/or modify it under
88 the same terms as perl itself.
92 __PACKAGE__
->meta->make_immutable;