X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FView.pm;h=51ff5d41836048a9f8746f7d0b68ddda6afce221;hp=d9e884fa21290b3ac058405e004a9ed9e1635b12;hb=a8dc76a1260561f17e6513a243473967582ed48a;hpb=9a6ecf4f8186b42c4c86206b20435c60dc03e012 diff --git a/lib/Catalyst/View.pm b/lib/Catalyst/View.pm index d9e884f..51ff5d4 100644 --- a/lib/Catalyst/View.pm +++ b/lib/Catalyst/View.pm @@ -32,6 +32,42 @@ action's private name. (See L.) Implements the same methods as other Catalyst components, see L +=head2 process + +gives an error message about direct use. + +=cut + +sub process { + + Catalyst::Exception->throw( message => ( ref $_[0] || $_[0] ). + " directly inherits from Catalyst::View. You need to\n". + " inherit from a subclass like Catalyst::View::TT instead.\n" ); + +} + +=head2 $c->merge_hash_config( $hashref, $hashref ) + +Merges two hashes together recursively, giving right-hand precedence. + +=cut + +sub merge_config_hashes { + my ( $self, $lefthash, $righthash ) = @_; + + my %merged = %$lefthash; + for my $key ( keys %$righthash ) { + my $right_ref = ( ref $righthash->{ $key } || '' ) eq 'HASH'; + my $left_ref = ( ( exists $lefthash->{ $key } && ref $lefthash->{ $key } ) || '' ) eq 'HASH'; + if( $right_ref and $left_ref ) { + $merged{ $key } = $self->merge_config_hashes( + $lefthash->{ $key }, $righthash->{ $key } + ); + } + } +} + + =head1 AUTHOR Sebastian Riedel, C