2 Catalyst::View::ContentNegotiation::XHTML - A Moose Role to apply to
3 Catalyst views adjusts the response Content-Type header to
4 application/xhtml+xml content if the browser accepts it.
7 package Catalyst::View::TT;
10 use namespace::clean -except => 'meta';
12 extends qw/Catalyst::View::TT/;
13 with qw/Catalyst::View::ContentNegotiation::XHTML/;
18 This is a very simple Role which uses a method modifier to run after the
19 "process" method, and sets the response "Content-Type" to be
20 "application/xhtml+xml" if the users browser sends an "Accept" header
21 indicating that it is willing to process that MIME type.
23 Changing the "Content-Type" causes browsers to interpret the page as
24 XML, meaning that the markup must be well formed.
26 This is useful when you're developing your application, as you know that
27 all pages you view are parsed as XML, so any errors caused by your
28 markup not being well-formed will show up at once.
32 Changes the response "Content-Type" if appropriate (from the requests
37 Some browsers (such as Internet Explorer) have a nasty way of sending
38 Accept */* and this claiming to support XHTML just as well as HTML.
39 Saving to a file on disk or opening with another application does count
40 as accepting, but it really should have a lower q value then text/html.
41 This sub takes a pragmatic approach and corrects this mistake by
42 modifying the Accept header before passing it to content negotiation.
46 Returns an array ref of 3 part arrays, comprising name, priority, output
47 mime-type, which is used for the content negotiation algorithm.
51 Returns the default variant attribute contents.
54 Catalyst::View::TT::XHTML - Trivial Catalyst TT view using this role.
55 <http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html> - Content
59 Will only work with Views which implement a process method.
61 Should be split into a base ContentNegotiation role which is consumed by
62 ContentNegotiation::XHTML.
65 Tomas Doran (t0m) "<bobtfish@bobtfish.net>"
68 David Dorward - test patches and */* pragmatism.
69 Florian Ragwitz (rafl) "<rafl@debian.org>" - Conversion into a Moose
73 This module itself is copyright (c) 2008 Tomas Doran and is licensed
74 under the same terms as Perl itself.