X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FHelper.pm;h=b2780f0c9bf3804db9faa74e1ddf0072b44c967a;hb=d1d9793fe292adfeb6894a4c419dd9c9c4fa814a;hp=f2393c6677d621894c2d52f0e9214b6e1203e8e6;hpb=4efc6b10bc03a7f8d7390e1f58bfb9ae9341863b;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index f2393c6..b2780f0 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -65,7 +65,7 @@ sub mk_app { $self->{startperl} = $Config{startperl}; $self->{scriptgen} = $Catalyst::CATALYST_SCRIPT_GEN; $self->{author} = $self->{author} = $ENV{'AUTHOR'} - || @{ [ getpwuid($<) ] }[6]; + || eval { @{ [ getpwuid($<) ] }[6] } || 'A clever guy'; $self->_mk_dirs; $self->_mk_appclass; $self->_mk_build; @@ -93,7 +93,7 @@ sub mk_component { my $app = shift; $self->{app} = $app; $self->{author} = $self->{author} = $ENV{'AUTHOR'} - || @{ [ getpwuid($<) ] }[6]; + || eval { @{ [ getpwuid($<) ] }[6] } || 'A clever guy'; $self->{base} = File::Spec->catdir( $FindBin::Bin, '..' ); unless ( $_[0] =~ /^model|m|view|v|controller|c\$/i ) { my $helper = shift; @@ -107,8 +107,8 @@ sub mk_component { } else { my $type = shift; - my $name = shift; - my $helper = shift; + my $name = shift || "Missing name for model/view/controller"; + my $helper = shift ; my @args = @_; return 0 if $name =~ /[^\w\:]/; $type = 'M' if $type =~ /model|m/i; @@ -444,6 +444,37 @@ it under the same terms as perl itself. 1; +__makefile__ + unless ( eval "use Module::Build::Compat 0.02; 1" ) { + print "This module requires Module::Build to install itself.\n"; + + require ExtUtils::MakeMaker; + my $yn = + ExtUtils::MakeMaker::prompt( ' Install Module::Build now from CPAN?', 'y' ); + + unless ( $yn =~ /^y/i ) { + die " *** Cannot install without Module::Build. Exiting ...\n"; + } + + require Cwd; + require File::Spec; + require CPAN; + + # Save this 'cause CPAN will chdir all over the place. + my $cwd = Cwd::cwd(); + my $makefile = File::Spec->rel2abs($0); + + CPAN::Shell->install('Module::Build::Compat') + or die " *** Cannot install without Module::Build. Exiting ...\n"; + + chdir $cwd or die "Cannot chdir() back to $cwd: $!"; + } + eval "use Module::Build::Compat 0.02; 1" or die $@; + use lib '_build/lib'; + Module::Build::Compat->run_build_pl( args => \@ARGV ); + require Module::Build; + Module::Build::Compat->write_makefile( build_class => 'Module::Build' ); + __build__ use strict; use Catalyst::Build; @@ -452,7 +483,8 @@ my $build = Catalyst::Build->new( create_makefile_pl => 'passthrough', license => 'perl', module_name => '[% name %]', - requires => { Catalyst => '5.04' }, + requires => { Catalyst => '5.10' }, + create_makefile_pl => 'passthrough', script_files => [ glob('script/*') ], test_files => [ glob('t/*.t'), glob('t/*/*.t') ] ); @@ -532,7 +564,7 @@ it under the same terms as perl itself. __fcgi__ [% startperl %] -w -BEGIN { $ENV{CATALYST_ENGINE} = 'FCGI' } +BEGIN { $ENV{CATALYST_ENGINE} = 'FastCGI' } use strict; use FindBin;