X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FHelper.pm;h=c25dde9923eac9ebc4c909a7da9e7c2b67eca88a;hb=0afeb5f5303b4806e30c09cfae58e8448a64177a;hp=6a57f5ee88ef9f34ed81c2dfeb38ab8581f6ecce;hpb=d30e01db2092a05fca10e0efbacbb71d4554a468;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index 6a57f5e..c25dde9 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -134,13 +134,15 @@ sub mk_component { $type = 'M' if $type =~ /model/i; $type = 'V' if $type =~ /view/i; $type = 'C' if $type =~ /controller/i; - $type = $self->{long_type} unless $self->{short}; - $self->{type} = $type; - $self->{name} = $name; - $self->{class} = "$app\::$type\::$name"; + my $appdir = File::Spec->catdir( split /\:\:/, $app ); + my $test_path = + File::Spec->catdir( $FindBin::Bin, '..', 'lib', $appdir, 'C' ); + $type = $self->{long_type} unless -d $test_path; + $self->{type} = $type; + $self->{name} = $name; + $self->{class} = "$app\::$type\::$name"; # Class - my $appdir = File::Spec->catdir( split /\:\:/, $app ); my $path = File::Spec->catdir( $FindBin::Bin, '..', 'lib', $appdir, $type ); my $file = $name; @@ -538,7 +540,7 @@ sub default : Private { # my ( $self, $c ) = @_; # # # Forward to View unless response body is already defined -# $c->forward('View::') unless $c->response->body; +# $c->forward( $c->view('') ) unless $c->response->body; #} =head1 AUTHOR @@ -556,7 +558,7 @@ it under the same terms as Perl itself. __makefile__ use inc::Module::Install; -name('[% name %]'); +name('[% dir %]'); abstract('Catalyst Application'); author('[% author %]'); version_from('[% path %]'); @@ -880,18 +882,15 @@ use Catalyst::Helper; my $force = 0; my $help = 0; -my $short = 0; GetOptions( 'nonew|force' => \$force, - 'help|?' => \$help, - 'short' => \$short + 'help|?' => \$help ); pod2usage(1) if ( $help || !$ARGV[0] ); -my $helper = - Catalyst::Helper->new( { '.newfiles' => !$force, short => $short } ); +my $helper = Catalyst::Helper->new( { '.newfiles' => !$force } ); pod2usage(1) unless $helper->mk_component( '[% name %]', @ARGV ); @@ -908,7 +907,6 @@ pod2usage(1) unless $helper->mk_component( '[% name %]', @ARGV ); Options: -force don't create a .new file where a file to be created exists -help display this help and exits - -short use short types, like C instead of Controller... Examples: [% appprefix %]_create.pl controller My::Controller @@ -964,6 +962,8 @@ Catalyst [% long_type %]. [% IF long_type == 'Controller' %] =head1 METHODS +=cut + # # Uncomment and modify this or add new actions to fit your needs #