Updated helper for Root class
Sebastian Riedel [Sun, 26 Feb 2006 01:41:55 +0000 (01:41 +0000)]
lib/Catalyst.pm
lib/Catalyst/Helper.pm

index f58c9e9..981b20f 100644 (file)
@@ -58,7 +58,7 @@ __PACKAGE__->engine_class('Catalyst::Engine::CGI');
 __PACKAGE__->request_class('Catalyst::Request');
 __PACKAGE__->response_class('Catalyst::Response');
 
-our $VERSION = '5.65';
+our $VERSION = '5.66';
 
 sub import {
     my ( $class, @arguments ) = @_;
@@ -542,7 +542,7 @@ loads and instantiates the given class.
 
 sub plugin {
     my ( $class, $name, $plugin, @args ) = @_;
-    $class->_register_plugin($plugin, 1);
+    $class->_register_plugin( $plugin, 1 );
 
     eval { $plugin->import };
     $class->mk_classdata($name);
@@ -722,7 +722,8 @@ sub uri_for {
     $namespace = '' if $path =~ /^\//;
     $path =~ s/^\///;
 
-    my $params = (scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {});
+    my $params =
+      ( scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {} );
 
     # join args with '/', or a blank string
     my $args = ( scalar @args ? '/' . join( '/', @args ) : '' );
@@ -1863,7 +1864,8 @@ the plugin name does not begin with C<Catalyst::Plugin::>.
 
 {
     my %PLUGINS;
-    sub registered_plugins { 
+
+    sub registered_plugins {
         my $proto = shift;
         return sort keys %PLUGINS unless @_;
         my $plugin = shift;
@@ -1883,7 +1885,7 @@ the plugin name does not begin with C<Catalyst::Plugin::>.
                 message => qq/Couldn't load ${type}plugin "$plugin", $error/ );
         }
 
-        $PLUGINS{$plugin} = 1;        
+        $PLUGINS{$plugin} = 1;
         unless ($instant) {
             no strict 'refs';
             unshift @{"$class\::ISA"}, $plugin;
index 9e0e9ea..1838b7a 100644 (file)
@@ -332,6 +332,9 @@ sub _mk_dirs {
         $self->{c} = File::Spec->catdir( $self->{mod}, 'Controller' );
         $self->mk_dir( $self->{c} );
     }
+    my $name = $self->{name};
+    $self->{rootname} =
+      $self->{short} ? "$name\::C::Root" : "$name\::Controller::Root";
     $self->{base} = File::Spec->rel2abs( $self->{dir} );
 }
 
@@ -343,11 +346,8 @@ sub _mk_appclass {
 
 sub _mk_rootclass {
     my $self = shift;
-    my $c    = $self->{c};
-    my $name = $self->{name};
-    $self->{rootname} =
-      $self->{short} ? "$name\::C::Root" : "$name\::Controller::Root";
-    $self->render_file( 'rootclass', File::Spec->catfile( $c, "Root.pm" ) );
+    $self->render_file( 'rootclass',
+        File::Spec->catfile( $self->{c}, "Root.pm" ) );
 }
 
 sub _mk_makefile {
@@ -556,6 +556,10 @@ our $VERSION = '0.01';
 #
 __PACKAGE__->setup;
 
+#
+# IMPORTANT: Please look into [% rootname %] for more
+#
+
 =head1 NAME
 
 [% name %] - Catalyst based application
@@ -568,6 +572,10 @@ __PACKAGE__->setup;
 
 Catalyst based application.
 
+=head1 SEE ALSO
+
+L<[% rootname %]>, L<Catalyst>
+
 =head1 AUTHOR
 
 [% author %]
@@ -588,13 +596,14 @@ use warnings;
 use base 'Catalyst::Controller';
 
 #
-# A empty namespace attaches this Controller to the root
+# Sets the actions in this controller to be registered with no prefix
+# so they function identically to actions created in MyApp.pm
 #
 __PACKAGE__->config->{namespace} = '';
 
 =head1 NAME
 
-[% rootname %] - Root Controller of this Catalyst based application
+[% rootname %] - Root Controller for this Catalyst based application
 
 =head1 SYNOPSIS
 
@@ -602,7 +611,7 @@ See L<[% name %]>.
 
 =head1 DESCRIPTION
 
-Root Controller of this Catalyst based application.
+Root Controller for this Catalyst based application.
 
 =head1 METHODS