Static::Simple 0.12, play nice with other plugins
Andy Grundman [Wed, 23 Nov 2005 20:27:34 +0000 (20:27 +0000)]
Changes
META.yml
lib/Catalyst/Plugin/Static/Simple.pm

diff --git a/Changes b/Changes
index 3e17187..67d7098 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,11 @@
 Revision history for Perl extension Catalyst::Plugin::Static::Simple
 
-0.11    
+0.12
+        - Made prepare_action play nice with other plugins by not short-
+          circuiting.
+        - Added tmpl to the ignored extensions.
+
+0.11    2005-11-13 16:25:00
         - Removed the code that set the 304 Not Modified header.  This caused
           problems with IE under Apache.
         - Changed 5.50 writing method to pass an IO::File object directly to
index c2b6b8c..2eabff5 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,6 +1,6 @@
 ---
 name: Catalyst-Plugin-Static-Simple
-version: 0.11
+version: 0.12
 author:
   - 'Andy Grundman, <andy@hybridized.org>'
 abstract: Make serving static pages painless.
@@ -11,5 +11,5 @@ requires:
 provides:
   Catalyst::Plugin::Static::Simple:
     file: lib/Catalyst/Plugin/Static/Simple.pm
-    version: 0.11
-generated_by: Module::Build version 0.2611
+    version: 0.12
+generated_by: Module::Build version 0.26
index 7e79cac..3a5f654 100644 (file)
@@ -8,7 +8,7 @@ use IO::File;
 use MIME::Types;
 use NEXT;
 
-our $VERSION = '0.11';
+our $VERSION = '0.12';
 
 __PACKAGE__->mk_classdata( qw/_static_mime_types/ );
 __PACKAGE__->mk_accessors( qw/_static_file
@@ -28,12 +28,10 @@ sub prepare_action {
             if ( $c->_locate_static_file ) {
                 $c->_debug_msg( 'from static directory' )
                     if ( $c->config->{static}->{debug} );
-                return;
             } else {
                 $c->_debug_msg( "404: file not found: $path" )
                     if ( $c->config->{static}->{debug} );
                 $c->res->status( 404 );
-                return;
             }
         }
     }
@@ -41,7 +39,7 @@ sub prepare_action {
     # Does the path have an extension?
     if ( $path =~ /.*\.(\S{1,})$/xms ) {
         # and does it exist?
-        return if ( $c->_locate_static_file );
+        $c->_locate_static_file;
     }
     
     return $c->NEXT::ACTUAL::prepare_action(@_);
@@ -91,7 +89,8 @@ sub setup {
     $c->config->{static}->{dirs} ||= [];
     $c->config->{static}->{include_path} ||= [ $c->config->{root} ];
     $c->config->{static}->{mime_types} ||= {};
-    $c->config->{static}->{ignore_extensions} ||= [ qw/tt tt2 html xhtml/ ];
+    $c->config->{static}->{ignore_extensions} 
+        ||= [ qw/tmpl tt tt2 html xhtml/ ];
     $c->config->{static}->{ignore_dirs} ||= [];
     $c->config->{static}->{debug} ||= $c->debug;
     if ( ! defined $c->config->{static}->{no_logs} ) {
@@ -336,11 +335,12 @@ For example:
 
 There are some file types you may not wish to serve as static files.  Most
 important in this category are your raw template files.  By default, files
-with the extensions tt, tt2, html, and xhtml will be ignored by Static::Simple
-in the interest of security.  If you wish to define your own extensions to
-ignore, use the ignore_extensions option:
+with the extensions tmpl, tt, tt2, html, and xhtml will be ignored by
+Static::Simple in the interest of security.  If you wish to define your own
+extensions to ignore, use the ignore_extensions option:
 
-    MyApp->config->{static}->{ignore_extensions} = [ qw/tt tt2 html xhtml/ ];
+    MyApp->config->{static}->{ignore_extensions} 
+        = [ qw/tmpl tt tt2 html xhtml/ ];
     
 =head2 Ignoring entire directories
 
@@ -371,17 +371,11 @@ you may enter your own extension to MIME type mapping.
         png => 'image/png',
     };
 
-=head2 Bypassing other plugins
+=head2 Compatibility with other plugins
 
-This plugin checks for a static file in the prepare_action stage.  If the
-request is for a static file, it will bypass all remaining prepare_action
-steps.  This means that by placing Static::Simple before all other plugins,
-they will not execute when a static file is found.  This can be helpful by
-skipping session cookie checks for example.  Or, if you want some plugins
-to run even on static files, list them before Static::Simple.
-
-Currently, work done by plugins in any other prepare method will execute
-normally.
+Since version 0.12, Static::Simple plays nice with other plugins.  It no
+longer short-circuits the prepare_action stage as it was causing too many
+compatibility issues with other plugins.
 
 =head2 Debugging information