use MIME::Types;
use NEXT;
-our $VERSION = '0.08';
+our $VERSION = '0.09';
__PACKAGE__->mk_classdata( qw/_static_mime_types/ );
__PACKAGE__->mk_accessors( qw/_static_file
return if ( $c->_locate_static_file );
}
- return $c->NEXT::prepare_action(@_);
+ return $c->NEXT::ACTUAL::prepare_action(@_);
}
# dispatch takes the file found during prepare_action and serves it
return if ( $c->res->status != 200 );
if ( $c->_static_file ) {
+ if ( $c->config->{static}->{no_logs} && $c->log->can('abort') ) {
+ $c->log->abort( 1 );
+ }
return $c->_serve_static;
}
else {
- return $c->NEXT::dispatch(@_);
+ return $c->NEXT::ACTUAL::dispatch(@_);
}
}
# display all log messages
if ( $c->config->{static}->{debug} && scalar @{$c->_debug_msg} ) {
- $c->log->debug( "Static::Simple: Serving " .
- join( " ", @{$c->_debug_msg} )
- );
+ $c->log->debug( "Static::Simple: Serving " .
+ join( " ", @{$c->_debug_msg} ) );
}
# return DECLINED when under mod_perl
return $c->finalize_headers;
}
- return $c->NEXT::finalize(@_);
+ return $c->NEXT::ACTUAL::finalize(@_);
}
sub setup {
$c->config->{static}->{mime_types} ||= {};
$c->config->{static}->{use_apache} ||= 0;
$c->config->{static}->{debug} ||= $c->debug;
+ if ( ! defined $c->config->{static}->{no_logs} ) {
+ $c->config->{static}->{no_logs} = 1;
+ }
# load up a MIME::Types object, only loading types with
# at least 1 file extension
MyApp->config->{static}. If you use any of these options, the module will
probably feel less "simple" to you!
+=head2 Aborting request logging
+
+Since Catalyst 5.50, there has been added support for dropping logging for a
+request. This is enabled by default for static files, as static requests tend
+to clutter the log output. However, if you want logging of static requests,
+you can enable it by setting MyApp->config->{static}->{no_logs} to 0.
+
=head2 Forcing directories into static mode
Define a list of top-level directories beneath your 'root' directory that
qr/^(images|css)/,
];
-=head2 Including additional directories (experimental!)
+=head2 Including additional directories
You may specify a list of directories in which to search for your static
files. The directories will be searched in order and will return the first
Andy Grundman, <andy@hybridized.org>
+=head1 CONTRIBUTORS
+
+Marcus Ramberg, <mramberg@cpan.org>
+
=head1 THANKS
The authors of Catalyst::Plugin::Static: