[Catalyst-commits] r10328 - in Catalyst-Plugin-Static-Simple/trunk:
. lib/Catalyst/Plugin/Static
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Thu May 28 01:13:42 GMT 2009
Author: t0m
Date: 2009-05-28 01:13:42 +0000 (Thu, 28 May 2009)
New Revision: 10328
Modified:
Catalyst-Plugin-Static-Simple/trunk/Changes
Catalyst-Plugin-Static-Simple/trunk/lib/Catalyst/Plugin/Static/Simple.pm
Log:
Revert config key change which broke all the tests and provided no back compat. svn diff -r9644:9643 . | patch -p0
Modified: Catalyst-Plugin-Static-Simple/trunk/Changes
===================================================================
--- Catalyst-Plugin-Static-Simple/trunk/Changes 2009-05-28 00:14:47 UTC (rev 10327)
+++ Catalyst-Plugin-Static-Simple/trunk/Changes 2009-05-28 01:13:42 UTC (rev 10328)
@@ -1,6 +1,5 @@
Revision history for Perl extension Catalyst::Plugin::Static::Simple
- - Fix config key (mst)
- Fix docs to not include plugins in call to ->setup() (t0m)
0.21 2009-03-29 20:31:49
Modified: Catalyst-Plugin-Static-Simple/trunk/lib/Catalyst/Plugin/Static/Simple.pm
===================================================================
--- Catalyst-Plugin-Static-Simple/trunk/lib/Catalyst/Plugin/Static/Simple.pm 2009-05-28 00:14:47 UTC (rev 10327)
+++ Catalyst-Plugin-Static-Simple/trunk/lib/Catalyst/Plugin/Static/Simple.pm 2009-05-28 01:13:42 UTC (rev 10328)
@@ -13,12 +13,10 @@
__PACKAGE__->mk_accessors( qw/_static_file _static_debug_message/ );
-my $CONFIG_KEY = "Plugin::Static::Simple";
-
sub prepare_action {
my $c = shift;
my $path = $c->req->path;
- my $config = $c->config->{$CONFIG_KEY} ||= $c->config->{static};
+ my $config = $c->config->{static};
$path =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
@@ -61,7 +59,7 @@
return if ( $c->res->status != 200 );
if ( $c->_static_file ) {
- if ( $c->config->{$CONFIG_KEY}{no_logs} && $c->log->can('abort') ) {
+ if ( $c->config->{static}{no_logs} && $c->log->can('abort') ) {
$c->log->abort( 1 );
}
return $c->_serve_static;
@@ -75,7 +73,7 @@
my $c = shift;
# display all log messages
- if ( $c->config->{$CONFIG_KEY}{debug} && scalar @{$c->_debug_msg} ) {
+ if ( $c->config->{static}{debug} && scalar @{$c->_debug_msg} ) {
$c->log->debug( 'Static::Simple: ' . join q{ }, @{$c->_debug_msg} );
}
@@ -91,7 +89,7 @@
require File::Slurp;
}
- my $config = $c->config->{$CONFIG_KEY} ||= {};
+ my $config = $c->config->{static} ||= {};
$config->{dirs} ||= [];
$config->{include_path} ||= [ $c->config->{root} ];
@@ -119,7 +117,7 @@
File::Spec->no_upwards( File::Spec->splitdir( $path ) )
);
- my $config = $c->config->{$CONFIG_KEY};
+ my $config = $c->config->{static};
my @ipaths = @{ $config->{include_path} };
my $dpaths;
my $count = 64; # maximum number of directories to search
@@ -207,7 +205,7 @@
sub serve_static_file {
my ( $c, $full_path ) = @_;
- my $config = $c->config->{$CONFIG_KEY} ||= {};
+ my $config = $c->config->{static} ||= {};
if ( -e $full_path ) {
$c->_debug_msg( "Serving static file: $full_path" )
@@ -228,7 +226,7 @@
sub _ext_to_type {
my ( $c, $full_path ) = @_;
- my $config = $c->config->{$CONFIG_KEY};
+ my $config = $c->config->{static};
if ( $full_path =~ /.*\.(\S{1,})$/xms ) {
my $ext = $1;
@@ -339,8 +337,8 @@
=head1 ADVANCED CONFIGURATION
Configuration is completely optional and is specified within
-C<MyApp-E<gt>config-E<gt>{'Plugin::Static::Simple'}>. If you use any of these
-options, this module will probably feel less "simple" to you!
+C<MyApp-E<gt>config-E<gt>{static}>. If you use any of these options,
+this module will probably feel less "simple" to you!
=head2 Enabling request logging
@@ -348,7 +346,7 @@
default; static requests tend to clutter the log output and rarely
reveal anything useful. However, if you want to enable logging of static
requests, you can do so by setting
-C<MyApp-E<gt>config-E<gt>{'Plugin::Static::Simple'}-E<gt>{logging}> to 1.
+C<MyApp-E<gt>config-E<gt>{static}-E<gt>{logging}> to 1.
=head2 Forcing directories into static mode
@@ -356,7 +354,7 @@
that should always be served in static mode. Regular expressions may be
specified using C<qr//>.
- MyApp->config->{'Plugin::Static::Simple'}->{dirs} = [
+ MyApp->config->{static}->{dirs} = [
'static',
qr/^(images|css)/,
];
@@ -369,7 +367,7 @@
added to the search path when you specify an C<include_path>. You should
use C<MyApp-E<gt>config-E<gt>{root}> to add it.
- MyApp->config->{'Plugin::Static::Simple'}->{include_path} = [
+ MyApp->config->{static}->{include_path} = [
'/path/to/overlay',
\&incpath_generator,
MyApp->config->{root}
@@ -409,7 +407,7 @@
If you wish to define your own extensions to ignore, use the
C<ignore_extensions> option:
- MyApp->config->{'Plugin::Static::Simple'}->{ignore_extensions}
+ MyApp->config->{static}->{ignore_extensions}
= [ qw/html asp php/ ];
=head2 Ignoring entire directories
@@ -419,7 +417,7 @@
directory paths to ignore. If using C<include_path>, the path will be
checked against every included path.
- MyApp->config->{'Plugin::Static::Simple'}->{ignore_dirs} = [ qw/tmpl css/ ];
+ MyApp->config->{static}->{ignore_dirs} = [ qw/tmpl css/ ];
For example, if combined with the above C<include_path> setting, this
C<ignore_dirs> value will ignore the following directories if they exist:
@@ -436,7 +434,7 @@
To override or add to the default MIME types set by the L<MIME::Types>
module, you may enter your own extension to MIME type mapping.
- MyApp->config->{'Plugin::Static::Simple'}->{mime_types} = {
+ MyApp->config->{static}->{mime_types} = {
jpg => 'image/jpg',
png => 'image/png',
};
@@ -452,7 +450,7 @@
Enable additional debugging information printed in the Catalyst log. This
is automatically enabled when running Catalyst in -Debug mode.
- MyApp->config->{'Plugin::Static::Simple'}->{debug} = 1;
+ MyApp->config->{static}->{debug} = 1;
=head1 USING WITH APACHE
More information about the Catalyst-commits
mailing list