1 package Catalyst::View;
4 use base qw/Catalyst::Component/;
8 Catalyst::View - Catalyst View base class
12 package Catalyst::View::Homebrew;
14 use base qw/Catalyst::View/;
17 # template processing goes here.
22 This is the Catalyst View base class. It's meant to be used as
23 a base class by Catalyst views.
25 As a convention, views are expected to read template names from
26 $c->stash->{template}, and put the output into $c->res->body.
27 Some views default to render a template named after the dispatched
28 action's private name. (See L<Catalyst::Action>.)
32 Implements the same methods as other Catalyst components, see
33 L<Catalyst::Component>
37 gives an error message about direct use.
43 Catalyst::Exception->throw( message => ( ref $_[0] || $_[0] ).
44 " directly inherits from Catalyst::View. You need to\n".
45 " inherit from a subclass like Catalyst::View::TT instead.\n" );
49 =head2 $c->merge_hash_config( $hashref, $hashref )
51 Merges two hashes together recursively, giving right-hand precedence.
55 sub merge_config_hashes {
56 my ( $self, $lefthash, $righthash ) = @_;
58 my %merged = %$lefthash;
59 for my $key ( keys %$righthash ) {
\r
60 my $right_ref = ( ref $righthash->{ $key } || '' ) eq 'HASH';
\r
61 my $left_ref = ( ( exists $lefthash->{ $key } && ref $lefthash->{ $key } ) || '' ) eq 'HASH';
\r
62 if( $right_ref and $left_ref ) {
\r
63 $merged{ $key } = $self->merge_config_hashes(
64 $lefthash->{ $key }, $righthash->{ $key }
73 Sebastian Riedel, C<sri@oook.de>
74 Marcus Ramberg, C<mramberg@cpan.org>
78 This program is free software, you can redistribute it and/or modify it under
79 the same terms as Perl itself.