with 'MooseX::Emulate::Class::Accessor::Fast';
-# Change Catalyst/Devel.pm also
-our $VERSION = '1.33';
+our $VERSION = '1.41';
+$VERSION =~ tr/_//d;
my %cache;
-=head1 NAME
-
-Catalyst::Helper - Bootstrap a Catalyst application
-
-=head1 SYNOPSIS
-
- catalyst.pl <myappname>
-
-=cut
-
sub get_sharedir_file {
my ($self, @filename) = @_;
my $dist_dir;
}
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;
}
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->$_;
}
}
$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->$_;
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;
# 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 ) = @_;
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 {
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") );
}
}
+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};
my $script = $self->{script};
my $appprefix = $self->{appprefix};
$self->render_sharedir_file( file('script', 'myapp_cgi.pl.tt'),
- file($script,"$appprefix\_cgi.pl"), undef, 0700 );
+ file($script,"$appprefix\_cgi.pl"), undef, 0755 );
}
sub _mk_fastcgi {
my $script = $self->{script};
my $appprefix = $self->{appprefix};
$self->render_sharedir_file( file('script', 'myapp_fastcgi.pl.tt'),
- file($script, "$appprefix\_fastcgi.pl"), undef, 0700 );
+ file($script, "$appprefix\_fastcgi.pl"), undef, 0755 );
}
sub _mk_server {
my $script = $self->{script};
my $appprefix = $self->{appprefix};
$self->render_sharedir_file( file('script', 'myapp_server.pl.tt'),
- file($script, "$appprefix\_server.pl"), undef, 0700 );
+ file($script, "$appprefix\_server.pl"), undef, 0755 );
}
sub _mk_test {
my $script = $self->{script};
my $appprefix = $self->{appprefix};
$self->render_sharedir_file( file('script', 'myapp_test.pl.tt'),
- file($script, "$appprefix\_test.pl"), undef, 0700 );
+ file($script, "$appprefix\_test.pl"), undef, 0755 );
}
sub _mk_create {
my $script = $self->{script};
my $appprefix = $self->{appprefix};
$self->render_sharedir_file( file('script', 'myapp_create.pl.tt'),
- file($script, "$appprefix\_create.pl"), undef, 0700 );
+ file($script, "$appprefix\_create.pl"), undef, 0755 );
}
sub _mk_compclass {
}
}
+1;
+__END__
+
+=head1 NAME
+
+Catalyst::Helper - Bootstrap a Catalyst application
+
+=head1 SYNOPSIS
+
+ catalyst.pl <myappname>
+
=head1 DESCRIPTION
This module is used by B<catalyst.pl> to create a set of scripts for a
=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<Template Toolkit|Template> and $perms are desired permissions (or system
defaults if not set).
Method for getting a file out of share/
-=cut
-
=head2 render_file_contents
Process a L<Template::Toolkit> template.
-=cut
-
=head2 render_sharedir_file
Render a template/image file from our share directory
-=cut
-
=head1 NOTE
The helpers will read author name from /etc/passwd by default.
it under the same terms as Perl itself.
=cut
-
-1;
-