Typo
[catagits/Catalyst-Devel.git] / lib / Catalyst / Helper.pm
index 0e40e3c..3d46c3f 100644 (file)
@@ -329,7 +329,7 @@ sub _mk_config {
     my $dir       = $self->{dir};
     my $appprefix = $self->{appprefix};
     $self->render_file( 'config',
-        File::Spec->catfile( $dir, "$appprefix.yml" ) );
+        File::Spec->catfile( $dir, "$appprefix.conf" ) );
 }
 
 sub _mk_readme {
@@ -499,8 +499,8 @@ So when you call C<scripts/myapp_create.pl view MyView TT>, create
 will try to execute Catalyst::Helper::View::TT->mk_compclass and
 Catalyst::Helper::View::TT->mk_comptest.
 
-See L<Catalyst::Helper::View::TT> and L<Catalyst::Helper::Model::DBIC> for
-examples.
+See L<Catalyst::Helper::View::TT> and
+L<Catalyst::Helper::Model::DBIC::Schema> for examples.
 
 All helper classes should be under one of the following namespaces.
 
@@ -544,36 +544,41 @@ There is no fallback for this method.
 These are the methods that the Helper classes can call on the
 <$helper> object passed to them.
 
-=head2 render_file
+=head2 render_file ($file, $path, $vars)
 
-Render and create a file from a template in DATA using 
-Template Toolkit.
+Render and create a file from a template in DATA using Template
+Toolkit. $file is the relevent chunk of the __DATA__ section, $path is
+the path to the file and $vars is the hashref as expected by
+L<Template Toolkit|Template>.
 
-=head2 get_file
+=head2 get_file ($class, $file)
 
 Fetch file contents from the DATA section. This is used internally by
-L</render_file>.
+L</render_file>.  $class is the name of the class to get the DATA
+section from.  __PACKAGE__ or ( caller(0) )[0] might be sensible
+values for this.
 
 =head2 mk_app
 
 Create the main application skeleton. This is called by L<catalyst.pl>.
 
-=head2 mk_component
+=head2 mk_component ($app)
 
 This method is called by L<create.pl> to make new components
 for your application.
 
-=head3 mk_dir
+=head3 mk_dir ($path)
 
 Surprisingly, this function makes a directory.
 
-=head2 mk_file
+=head2 mk_file ($file, $content)
 
 Writes content to a file. Called by L</render_file>.
 
-=head2 next_test
+=head2 next_test ($test_name)
 
 Calculates the name of the next numbered test file and returns it.
+Don't give the number or the .t suffix for the test name.
 
 =head1 NOTE
 
@@ -585,9 +590,9 @@ To override, please export the AUTHOR variable.
 L<Catalyst::Manual>, L<Catalyst::Test>, L<Catalyst::Request>,
 L<Catalyst::Response>, L<Catalyst>
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Sebastian Riedel, C<sri@oook.de>
+Catalyst Contributors, see Catalyst.pm
 
 =head1 LICENSE
 
@@ -612,28 +617,30 @@ use Catalyst::Runtime '5.70';
 # Set flags and add plugins for the application
 #
 #         -Debug: activates the debug mode for very useful log messages
-#   ConfigLoader: will load the configuration from a YAML file in the
+#   ConfigLoader: will load the configuration from a Config::General file in the
 #                 application's home directory
-# Static::Simple: will serve static files from the application's root 
+# Static::Simple: will serve static files from the application's root
 #                 directory
 
-use Catalyst qw/-Debug ConfigLoader Static::Simple/;
-
+use parent qw/Catalyst/;
+use Catalyst qw/-Debug
+                ConfigLoader
+                Static::Simple/;
 our $VERSION = '0.01';
 
-# Configure the application. 
+# Configure the application.
 #
-# Note that settings in [% appprefix %].yml (or other external
+# Note that settings in [% appprefix %].conf (or other external
 # configuration file that you set up manually) take precedence
 # over this when using ConfigLoader. Thus configuration
 # details given here can function as a default configuration,
-# with a external configuration file acting as an override for
+# with an external configuration file acting as an override for
 # local deployment.
 
 __PACKAGE__->config( name => '[% name %]' );
 
 # Start the application
-__PACKAGE__->setup;
+__PACKAGE__->setup();
 
 
 =head1 NAME
@@ -669,7 +676,7 @@ package [% rootname %];
 
 use strict;
 use warnings;
-use base 'Catalyst::Controller';
+use parent 'Catalyst::Controller';
 
 #
 # Sets the actions in this controller to be registered with no prefix
@@ -689,22 +696,28 @@ __PACKAGE__->config->{namespace} = '';
 
 =cut
 
-=head2 default
+=head2 index
 
 =cut
 
-sub default : Private {
+sub index :Path :Args(0) {
     my ( $self, $c ) = @_;
 
     # Hello World
     $c->response->body( $c->welcome_message );
 }
 
+sub default :Path {
+    my ( $self, $c ) = @_;
+    $c->response->body( 'Page not found' );
+    $c->response->status(404);
+}
+
 =head2 end
 
 Attempt to render a view, if needed.
 
-=cut 
+=cut
 
 sub end : ActionClass('RenderView') {}
 
@@ -721,6 +734,8 @@ it under the same terms as Perl itself.
 
 1;
 __makefile__
+# IMPORTANT: if you delete this file your app will not work as
+# expected.  you have been warned
 use inc::Module::Install;
 
 name '[% dir %]';
@@ -730,7 +745,8 @@ requires 'Catalyst::Runtime' => '[% catalyst_version %]';
 requires 'Catalyst::Plugin::ConfigLoader';
 requires 'Catalyst::Plugin::Static::Simple';
 requires 'Catalyst::Action::RenderView';
-requires 'YAML'; # This should reflect the config file format you've chosen
+requires 'parent';
+requires 'Config::General'; # This should reflect the config file format you've chosen
                  # See Catalyst::Plugin::ConfigLoader for supported formats
 catalyst;
 
@@ -738,8 +754,9 @@ install_script glob('script/*.pl');
 auto_install;
 WriteAll;
 __config__
----
-name: [% name %]
+# rename this file to [% name %].yml and put a : in front of "name" if
+# you want to use yaml like in old versions of Catalyst
+name [% name %]
 __readme__
 Run script/[% appprefix %]_server.pl to test the application.
 __changes__
@@ -802,9 +819,9 @@ See L<Catalyst::Manual>
 
 Run a Catalyst application as a cgi script.
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Sebastian Riedel, C<sri@oook.de>
+Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
@@ -828,7 +845,7 @@ use [% name %];
 
 my $help = 0;
 my ( $listen, $nproc, $pidfile, $manager, $detach, $keep_stderr );
+
 GetOptions(
     'help|?'      => \$help,
     'listen|l=s'  => \$listen,
@@ -841,10 +858,10 @@ GetOptions(
 
 pod2usage(1) if $help;
 
-[% name %]->run( 
-    $listen, 
+[% name %]->run(
+    $listen,
     {   nproc   => $nproc,
-        pidfile => $pidfile, 
+        pidfile => $pidfile,
         manager => $manager,
         detach  => $detach,
        keep_stderr => $keep_stderr,
@@ -860,7 +877,7 @@ pod2usage(1) if $help;
 =head1 SYNOPSIS
 
 [% appprefix %]_fastcgi.pl [options]
+
  Options:
    -? -help      display this help and exits
    -l -listen    Socket path to listen on
@@ -883,10 +900,9 @@ pod2usage(1) if $help;
 
 Run a Catalyst application as fastcgi.
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Sebastian Riedel, C<sri@oook.de>
-Maintained by the Catalyst Core Team.
+Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
@@ -897,11 +913,11 @@ it under the same terms as Perl itself.
 __server__
 [% startperl %]
 
-BEGIN { 
+BEGIN {
     $ENV{CATALYST_ENGINE} ||= 'HTTP';
     $ENV{CATALYST_SCRIPT_GEN} = [% scriptgen %];
     require Catalyst::Engine::HTTP;
-}  
+}
 
 use strict;
 use warnings;
@@ -918,7 +934,7 @@ my $port              = $ENV{[% appenv %]_PORT} || $ENV{CATALYST_PORT} || 3000;
 my $keepalive         = 0;
 my $restart           = $ENV{[% appenv %]_RELOAD} || $ENV{CATALYST_RELOAD} || 0;
 my $restart_delay     = 1;
-my $restart_regex     = '(?:/|^)(?!\.#).+(?:\.yml$|\.yaml$|\.pm)$';
+my $restart_regex     = '(?:/|^)(?!\.#).+(?:\.yml$|\.yaml$|\.conf|\.pm)$';
 my $restart_directory = undef;
 my $follow_symlinks   = 0;
 
@@ -985,7 +1001,7 @@ require [% name %];
    -rd -restartdelay  delay between file checks
    -rr -restartregex  regex match files that trigger
                       a restart when modified
-                      (defaults to '\.yml$|\.yaml$|\.pm$')
+                      (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
    -restartdirectory  the directory to search for
                       modified files, can be set mulitple times
                       (defaults to '[SCRIPT_DIR]/..')
@@ -999,10 +1015,9 @@ require [% name %];
 
 Run a Catalyst Testserver for this application.
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Sebastian Riedel, C<sri@oook.de>
-Maintained by the Catalyst Core Team.
+Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
@@ -1054,10 +1069,9 @@ print request($ARGV[0])->content . "\n";
 
 Run a Catalyst action from the command line.
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Sebastian Riedel, C<sri@oook.de>
-Maintained by the Catalyst Core Team.
+Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
@@ -1072,7 +1086,19 @@ use strict;
 use warnings;
 use Getopt::Long;
 use Pod::Usage;
-use Catalyst::Helper;
+eval "use Catalyst::Devel;";
+
+if ($@) {
+  die <<END;
+To use the Catalyst development tools including catalyst.pl and the
+generated script/myapp_create.pl you need Catalyst::Helper, which is
+part of the Catalyst-Devel distribution. Please install this via a
+vendor package or by running one of -
+
+  perl -MCPAN -e 'install Catalyst::Devel'
+  perl -MCPANPLUS -e 'install Catalyst::Devel'
+END
+}
 
 my $force = 0;
 my $mech  = 0;
@@ -1130,10 +1156,9 @@ Existing component files are not overwritten.  If any of the component files
 to be created already exist the file will be written with a '.new' suffix.
 This behavior can be suppressed with the C<-force> option.
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Sebastian Riedel, C<sri@oook.de>
-Maintained by the Catalyst Core Team.
+Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT
 
@@ -1146,7 +1171,7 @@ package [% class %];
 
 use strict;
 use warnings;
-use base 'Catalyst::[% long_type %]';
+use parent 'Catalyst::[% long_type %]';
 
 =head1 NAME
 
@@ -1161,11 +1186,11 @@ Catalyst [% long_type %].
 =cut
 
 
-=head2 index 
+=head2 index
 
 =cut
 
-sub index : Private {
+sub index :Path :Args(0) {
     my ( $self, $c ) = @_;
 
     $c->response->body('Matched [% class %] in [%name%].');