# If the user has the SubRequest plugin installed, tell them to upgrade
my $subreq = $build->check_installed_status('Catalyst::Plugin::SubRequest');
-if ( $subreq->{have} le '0.08' ) {
+if ( $subreq->{have} lt '0.08' ) {
print "** WARNING **\n"
. "You appear to have a version of Catalyst::Plugin::SubRequest "
. "older than 0.08.\n"
Revision history for Perl extension Catalyst::Plugin::Static::Simple
+0.11
+ - Changed 5.5 writing method to pass an IO::File object directly to
+ $c->res->body.
+
0.10 2005-10-19 17:20:00
- Added tt2 to the list of ignored extensions.
- For Catalyst 5.5+, replaced File::Slurp with a buffered read/write
---
name: Catalyst-Plugin-Static-Simple
-version: 0.09
+version: 0.10
author:
- 'Andy Grundman, <andy@hybridized.org>'
abstract: Make serving static pages painless.
license: perl
requires:
Catalyst: 5.30
- File::Slurp: 0
MIME::Types: 1.15
provides:
Catalyst::Plugin::Static::Simple:
file: lib/Catalyst/Plugin/Static/Simple.pm
- version: 0.09
+ version: 0.11
generated_by: Module::Build version 0.2611
use warnings;
use base qw/Class::Accessor::Fast Class::Data::Inheritable/;
use File::stat;
+use IO::File;
use MIME::Types;
use NEXT;
require File::Slurp;
}
-our $VERSION = '0.10';
+our $VERSION = '0.11';
__PACKAGE__->mk_classdata( qw/_static_mime_types/ );
__PACKAGE__->mk_accessors( qw/_static_file
if ( Catalyst->VERSION le '5.33' ) {
# old File::Slurp method
my $content = File::Slurp::read_file( $full_path );
- $c->res->output( $content );
+ $c->res->body( $content );
}
else {
- # new write method
- open my $fh, '<', $full_path
- or Catalyst::Exception->throw(
+ # new method, pass an IO::File object to body
+ my $fh = IO::File->new( $full_path, 'r' );
+ if ( defined $fh ) {
+ $c->res->body( $fh );
+ }
+ else {
+ Catalyst::Exception->throw(
message => "Unable to open $full_path for reading" );
- while ( $fh->read( my $buffer, 4096 ) ) {
- $c->res->write( $buffer );
}
- close $fh;
}
return 1;
if ( $type ) {
$c->_debug_msg( "as $type" )
if ( $c->config->{static}->{debug} );
- return $type;
+ return ( ref $type ) ? $type->type : $type;
}
else {
$c->_debug_msg( "as text/plain (unknown extension $ext)" )