[Catalyst-commits] r8599 - in Catalyst-Plugin-SmartURI/1.000/trunk: . lib/Catalyst/Plugin

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Wed Nov 12 23:57:17 GMT 2008


Author: caelum
Date: 2008-11-12 23:57:17 +0000 (Wed, 12 Nov 2008)
New Revision: 8599

Modified:
   Catalyst-Plugin-SmartURI/1.000/trunk/Changes
   Catalyst-Plugin-SmartURI/1.000/trunk/META.yml
   Catalyst-Plugin-SmartURI/1.000/trunk/lib/Catalyst/Plugin/SmartURI.pm
Log:
C::P::SmartURI: sync svn with CPAN version


Modified: Catalyst-Plugin-SmartURI/1.000/trunk/Changes
===================================================================
--- Catalyst-Plugin-SmartURI/1.000/trunk/Changes	2008-11-12 21:47:54 UTC (rev 8598)
+++ Catalyst-Plugin-SmartURI/1.000/trunk/Changes	2008-11-12 23:57:17 UTC (rev 8599)
@@ -27,3 +27,9 @@
 
 0.027  2008-07-06 14:17:12
     Improved request class, better Host header parsing, fixed POD.
+
+0.028  2008-08-22 03:53:49
+    Added note to the POD about usage with C::C::REST.
+
+0.029  2008-10-09 07:02:46
+    Fixed the host-header stuff for when there's no port.

Modified: Catalyst-Plugin-SmartURI/1.000/trunk/META.yml
===================================================================
--- Catalyst-Plugin-SmartURI/1.000/trunk/META.yml	2008-11-12 21:47:54 UTC (rev 8598)
+++ Catalyst-Plugin-SmartURI/1.000/trunk/META.yml	2008-11-12 23:57:17 UTC (rev 8599)
@@ -5,11 +5,11 @@
 build_requires:
   Test::More: 0
 distribution_type: module
-generated_by: 'Module::Install version 0.75'
+generated_by: 'Module::Install version 0.77'
 license: perl
 meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.3.html
-  version: 1.3
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
 name: Catalyst-Plugin-SmartURI
 no_index:
   directory:
@@ -22,4 +22,6 @@
   Task::Weaken: 0
   URI::SmartURI: 0
   parent: 0
-version: 0.027
+resources:
+  license: http://dev.perl.org/licenses/
+version: 0.029

Modified: Catalyst-Plugin-SmartURI/1.000/trunk/lib/Catalyst/Plugin/SmartURI.pm
===================================================================
--- Catalyst-Plugin-SmartURI/1.000/trunk/lib/Catalyst/Plugin/SmartURI.pm	2008-11-12 21:47:54 UTC (rev 8598)
+++ Catalyst-Plugin-SmartURI/1.000/trunk/lib/Catalyst/Plugin/SmartURI.pm	2008-11-12 23:57:17 UTC (rev 8599)
@@ -21,11 +21,11 @@
 
 =head1 VERSION
 
-Version 0.027
+Version 0.029
 
 =cut
 
-our $VERSION = '0.027';
+our $VERSION = '0.029';
 
 =head1 SYNOPSIS
 
@@ -139,6 +139,22 @@
 
 =back
 
+=head1 USING WITH Catalyst::Controller::REST
+
+In MyApp.pm do something like this:
+
+    package MyApp;
+
+    use Catalyst::Runtime '5.70';
+    use parent 'Catalyst';
+
+    use Catalyst::Action::REST ();
+
+    __PACKAGE__->setup(qw/... your list of plugins including ... SmartURI .../);
+
+Because L<Catalyst::Action::REST> sets request_class at load time, SmartURI
+needs to see it at setup time to know which request class to extend.
+
 =head1 EXTENDING
 
 $c->prepare_uri actually creates the URI, which you can override.
@@ -244,11 +260,12 @@
     if ($disposition eq 'host-header') {
       $res = $uri_class->new($uri, { reference => $c->req->uri })->absolute;
       my $host = $c->req->header('Host');
-      $host =~ s/:(\d+)$//;
+      my $port = $host =~ s/:(\d+)$// ? $1 : '';
 
-      my $port = $1;
-      $port = '' if $c->req->uri->scheme eq 'http'  && $port == 80;
-      $port = '' if $c->req->uri->scheme eq 'https' && $port == 443;
+      if ($port) {
+          $port = '' if $c->req->uri->scheme eq 'http'  && $port == 80;
+          $port = '' if $c->req->uri->scheme eq 'https' && $port == 443;
+      }
 
       $res->host($host);
       $res->port($port) if $port;




More information about the Catalyst-commits mailing list