From: Sebastian Riedel Date: Mon, 21 Nov 2005 14:45:23 +0000 (+0000) Subject: Replaced -short with auto-detection X-Git-Tag: 5.7099_04~849 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=b2d40c03a584dac092c64ebc632397264fc57dc7 Replaced -short with auto-detection --- diff --git a/Changes b/Changes index 2620bdd..ed99ec2 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ This file documents the revision history for Perl extension Catalyst. +5.58 + - Replaced -short with auto-detection + 5.57 2005-11-20 22:45:00 - Updated uri_for to accept undef actions - Switched to Module::Install diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 5f47a65..933c071 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -43,7 +43,7 @@ our $DETACH = "catalyst_detach\n"; require Module::Pluggable::Fast; # Helper script generation -our $CATALYST_SCRIPT_GEN = 19; +our $CATALYST_SCRIPT_GEN = 20; __PACKAGE__->mk_classdata($_) for qw/components arguments dispatcher engine log dispatcher_class @@ -54,7 +54,7 @@ __PACKAGE__->engine_class('Catalyst::Engine::CGI'); __PACKAGE__->request_class('Catalyst::Request'); __PACKAGE__->response_class('Catalyst::Response'); -our $VERSION = '5.57'; +our $VERSION = '5.58'; sub import { my ( $class, @arguments ) = @_; diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index eaef933..dc30f1d 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -134,13 +134,16 @@ 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, + 'Controller' ); + $type = $self->{long_type} if -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; @@ -880,18 +883,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 +908,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