From: t0m Date: Thu, 5 Feb 2009 23:16:21 +0000 (+0000) Subject: Reformat docs, couple of other misc dinks X-Git-Tag: 1.100~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0561a987338e016ed662d5565bf2b7556faa69af;p=catagits%2FCatalyst-View-ContentNegotiation-XHTML.git Reformat docs, couple of other misc dinks --- diff --git a/lib/Catalyst/View/ContentNegotiation/XHTML.pm b/lib/Catalyst/View/ContentNegotiation/XHTML.pm index 23d142a..256804f 100644 --- a/lib/Catalyst/View/ContentNegotiation/XHTML.pm +++ b/lib/Catalyst/View/ContentNegotiation/XHTML.pm @@ -55,9 +55,8 @@ __END__ =head1 NAME -Catalyst::View::ContentNegotiation::XHTML - Adjusts the -response Content-Type header to application/xhtml+xml -if the browser accepts it. +Catalyst::View::ContentNegotiation::XHTML - Adjusts the response Content-Type +header to application/xhtml+xml if the browser accepts it. =head1 SYNOPSIS @@ -73,19 +72,18 @@ if the browser accepts it. =head1 DESCRIPTION -This is a simple Role which sets the response C to be -C if the users browser sends an C header +This is a simple Role which sets the response C to be +C if the users browser sends an C header indicating that it is willing to process that MIME type. -Changing the C to C causes -browsers to interpret the page as XML, meaning that your markup must -be well formed. +Changing the C to C causes browsers to +interpret the page as XML, meaning that your markup must be well formed. =head1 CAVEATS -This is useful when you're developing your application, as you know that -all pages you view are parsed as XML, so any errors caused by your markup -not being well-formed will show up at once. +This is useful when you're developing your application, as you know that all +pages you view are parsed as XML, so any errors caused by your markup not +being well-formed will show up at once. Whilst this module is has been tested against most popular browsers including Internet Explorer, it may cause unexpected results on browsers which do not @@ -95,24 +93,25 @@ properly support the C MIME type. =head2 after process -Changes the response C if appropriate (from the requests C header). +Changes the response C if appropriate (from the requests +C header). =head1 METHODS =head2 pragmatic_accept -Some browsers (such as Internet Explorer) have a nasty way of sending -Accept */* and this claiming to support XHTML just as well as HTML. -Saving to a file on disk or opening with another application does -count as accepting, but it really should have a lower q value then -text/html. This sub takes a pragmatic approach and corrects this mistake -by modifying the Accept header before passing it to content negotiation. +Some browsers (such as Internet Explorer) have a nasty way of sending Accept +*/* and this claiming to support XHTML just as well as HTML. Saving to a file +on disk or opening with another application does count as accepting, but it +really should have a lower q value then text/html. This sub takes a pragmatic +approach and corrects this mistake by modifying the Accept header before +passing it to content negotiation. =head1 ATTRIBUTES =head2 variants -Returns an array ref of 3 part arrays, comprising name, priority, output +Returns an array ref of 3 part arrays, comprising name, priority, output mime-type, which is used for the content negotiation algorithm. =head1 PRIVATE METHODS @@ -127,30 +126,36 @@ Returns the default variant attribute contents. =item L - Trivial Catalyst TT view using this role. -=item L - Content negotiation RFC. +=item L - Content +negotiation RFC. =back =head1 BUGS -Should be split into a base ContentNegotiation role which is consumed by ContentNegotiation::XHTML. +Should be split into a base ContentNegotiation role which is consumed by +ContentNegotiation::XHTML. =head1 AUTHOR -Tomas Doran (t0m) C<< >> +Original author and maintainer - Tomas Doran (t0m) +C<< >> =head1 CONTRIBUTORS =over -=item David Dorward - test patches and */* pragmatism. +=item David Dorward - test patches and */* pragmatism to make it work for +browsers which aren't firefox. -=item Florian Ragwitz (rafl) C<< >> - Conversion into a Moose Role +=item Florian Ragwitz (rafl) C<< >> - Conversion into a +Moose Role, which is what the module should have been originally. =back =head1 COPYRIGHT -This module itself is copyright (c) 2008 Tomas Doran and is licensed under the same terms as Perl itself. +This module itself is copyright (c) 2008 Tomas Doran and is licensed under the +same terms as Perl itself. =cut diff --git a/lib/Catalyst/View/TT/XHTML.pm b/lib/Catalyst/View/TT/XHTML.pm index 526bca6..8e5a59d 100644 --- a/lib/Catalyst/View/TT/XHTML.pm +++ b/lib/Catalyst/View/TT/XHTML.pm @@ -3,8 +3,10 @@ package Catalyst::View::TT::XHTML; use Moose; use namespace::clean -except => 'meta'; -extends qw/Catalyst::View::TT/; -with qw/Catalyst::View::ContentNegotiation::XHTML/; +BEGIN { # You can have chain endpoints in your view if you smoked enough crack.. + extends qw/Catalyst::View::TT/; + with qw/Catalyst::View::ContentNegotiation::XHTML/; +} our $VERSION = '1.100'; @@ -14,8 +16,8 @@ __END__ =head1 NAME -Catalyst::View::TT::XHTML - A sub-class of the standard TT view which -serves application/xhtml+xml content if the browser accepts it. +Catalyst::View::TT::XHTML - A sub-class of the standard TT view which serves +application/xhtml+xml content if the browser accepts it. =head1 SYNOPSIS @@ -28,32 +30,37 @@ serves application/xhtml+xml content if the browser accepts it. =head1 DESCRIPTION -This is a very simple sub-class of L, which sets -the response C to be C if the -user's browser sends an C header indicating that it is willing -to process that MIME type. +This is a very simple sub-class of L, which sets the +response C to be C if the user's browser +sends an C header indicating that it is willing to process that MIME +type. -Changing the C causes browsers to interpret the page as -XML, meaning that the markup must be well formed. +Changing the C causes browsers to interpret the page as XML, +meaning that the markup must be well formed. -This is useful when you're developing your application, as you know that -all pages you view are parsed as XML, so any errors caused by your markup -not being well-formed will show up at once. +This is useful when you're developing your application, as you know that all +pages you view are parsed as XML, so any errors caused by your markup not +being well-formed will show up at once. =head1 NOTE -This module is a very simple demonstration of a consumer of the -L role. +This module is a very simple demonstration of a consumer of the +L role. -If your needs are not trivial, then it is recommended that you consume -that role yourself. +If your needs are not trivial, then it is recommended that you consume that +role yourself. =head1 AUTHOR -Tomas Doran (t0m) C<< >> +Original author and maintainer - Tomas Doran (t0m) +C<< >> + +Now mostly the work of other, smarter people - see +L. =head1 COPYRIGHT -This module itself is copyright (c) 2008 Tomas Doran and is licensed under the same terms as Perl itself. +This module itself is copyright (c) 2008 Tomas Doran and is licensed under the +same terms as Perl itself. =cut diff --git a/t/podspelling.t b/t/podspelling.t index f5fd76f..0c530e7 100644 --- a/t/podspelling.t +++ b/t/podspelling.t @@ -21,3 +21,4 @@ Dorward rafl ContentNegotiation Ragwitz +firefox