mro compat stuff
[catagits/Catalyst-Runtime.git] / lib / Catalyst / View.pm
1 package Catalyst::View;
2
3 use MRO::Compat;
4 use mro 'c3';
5 use Moose;
6 extends qw/Catalyst::Component/;
7
8 =head1 NAME
9
10 Catalyst::View - Catalyst View base class
11
12 =head1 SYNOPSIS
13
14     package Catalyst::View::Homebrew;
15
16     use base qw/Catalyst::View/;
17
18     sub process {
19     # template processing goes here.
20     }
21
22 =head1 DESCRIPTION
23
24 This is the Catalyst View base class. It's meant to be used as 
25 a base class by Catalyst views.
26
27 As a convention, views are expected to read template names from 
28 $c->stash->{template}, and put the output into $c->res->body.
29 Some views default to render a template named after the dispatched
30 action's private name. (See L<Catalyst::Action>.)
31
32 =head1 METHODS 
33
34 Implements the same methods as other Catalyst components, see
35 L<Catalyst::Component>
36
37 =head2 process
38
39 gives an error message about direct use.
40
41 =cut
42
43 sub process {
44
45     Catalyst::Exception->throw( message => ( ref $_[0] || $_[0] ).
46             " directly inherits from Catalyst::View. You need to\n".
47             " inherit from a subclass like Catalyst::View::TT instead.\n" );
48
49 }
50
51 =head2 $c->merge_hash_config( $hashref, $hashref )
52
53 Merges two hashes together recursively, giving right-hand precedence.
54
55 =cut
56
57 =head1 AUTHOR
58
59 Sebastian Riedel, C<sri@oook.de>
60 Marcus Ramberg, C<mramberg@cpan.org>
61
62 =head1 COPYRIGHT
63
64 This program is free software, you can redistribute it and/or modify it under
65 the same terms as Perl itself.
66
67 =cut
68
69 no Moose;
70 #__PACKAGE__->meta->make_immutable();
71
72 1;