X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FHelper.pm;h=d8aeac9ae868fd352bab873a67f12c3610743b70;hb=8d8cb02e6ad2b6c22f6cbcde9fab8975fd1ad991;hp=94e17e348fca2db09f7f87071345bc14dfe53118;hpb=8b0107a546938fd15588bcfe29dc6167592777ca;p=catagits%2FCatalyst-Devel.git diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index 94e17e3..d8aeac9 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -18,21 +18,11 @@ use namespace::autoclean; with 'MooseX::Emulate::Class::Accessor::Fast'; -# Change Catalyst/Devel.pm also -our $VERSION = '1.33'; +our $VERSION = '1.42'; +$VERSION =~ tr/_//d; my %cache; -=head1 NAME - -Catalyst::Helper - Bootstrap a Catalyst application - -=head1 SYNOPSIS - - catalyst.pl - -=cut - sub get_sharedir_file { my ($self, @filename) = @_; my $dist_dir; @@ -49,7 +39,7 @@ sub get_sharedir_file { } my $file = file( $dist_dir, @filename); Carp::confess("Cannot find $file") unless -r $file; - my $contents = $file->slurp; + my $contents = $file->slurp(iomode => "<:raw"); return $contents; } @@ -121,10 +111,9 @@ sub mk_app { my $gen_app = ( $self->{scripts} || $self->{makefile} ) ? 0 : 1; if ($gen_app) { - for ( qw/ _mk_dirs _mk_config _mk_appclass _mk_rootclass _mk_readme - _mk_changes _mk_apptest _mk_podtest _mk_podcoveragetest + for ( qw/ _mk_dirs _mk_config _mk_psgi _mk_appclass _mk_rootclass + _mk_readme _mk_changes _mk_apptest _mk_podtest _mk_podcoveragetest _mk_images _mk_favicon/ ) { - $self->$_; } } @@ -132,7 +121,7 @@ sub mk_app { $self->_mk_makefile; } if ($gen_scripts) { - for ( qw/ _mk_cgi _mk_fastcgi _mk_server + for ( qw/ _mk_cgi _mk_fastcgi _mk_server _mk_test _mk_create _mk_information / ) { $self->$_; @@ -141,7 +130,7 @@ sub mk_app { return $self->{dir}; } -## not much of this can really be changed, mk_compclass must be left for +## not much of this can really be changed, mk_compclass must be left for ## backcompat sub mk_component { my $self = shift; @@ -267,7 +256,7 @@ sub mk_file { $file .= '.new'; } } - + if ( my $f = IO::File->new("> $file") ) { binmode $f; print $f $content; @@ -300,7 +289,7 @@ sub next_test { # Do not touch this method, *EVER*, it is needed for back compat. ## addendum: we had to split this method so we could have backwards -## compatability. otherwise, we'd have no way to pass stuff from __DATA__ +## compatibility. otherwise, we'd have no way to pass stuff from __DATA__ sub render_file { my ( $self, $file, $path, $vars, $perms ) = @_; @@ -326,6 +315,7 @@ sub render_file_contents { message => qq/Couldn't process "$template", / . $t->error() ); my $file = $self->mk_file( $path, $output ); chmod $perms, file($file) if defined $perms; + return $file; } sub _mk_information { @@ -388,7 +378,7 @@ sub _mk_rootclass { sub _mk_makefile { my $self = shift; - $self->{path} = dir( 'lib', split( '::', $self->{name} ) ); + $self->{path} = join('/', 'lib', split( '::', $self->{name} ) ); $self->{path} .= '.pm'; my $dir = $self->{dir}; $self->render_sharedir_file( 'Makefile.PL.tt', file($dir, "Makefile.PL") ); @@ -401,6 +391,14 @@ sub _mk_makefile { } } +sub _mk_psgi { + my $self = shift; + my $dir = $self->{dir}; + my $appprefix = $self->{appprefix}; + $self->render_sharedir_file( 'myapp.psgi.tt', + file( $dir, "$appprefix.psgi" ) ); +} + sub _mk_config { my $self = shift; my $dir = $self->{dir}; @@ -535,6 +533,17 @@ sub _deprecate_file { } } +1; +__END__ + +=head1 NAME + +Catalyst::Helper - Bootstrap a Catalyst application + +=head1 SYNOPSIS + + catalyst.pl + =head1 DESCRIPTION This module is used by B to create a set of scripts for a @@ -662,7 +671,7 @@ These are the methods that the Helper classes can call on the =head2 render_file ($file, $path, $vars, $perms) Render and create a file from a template in DATA using Template -Toolkit. $file is the relevent chunk of the __DATA__ section, $path is +Toolkit. $file is the relevant chunk of the __DATA__ section, $path is the path to the file, $vars is the hashref as expected by L