[Catalyst-commits] r12815 - in trunk/examples/Tutorial/Hello_Chapter2/Hello: . lib lib/Hello/Controller lib/Hello/View t

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Sun Feb 7 07:37:20 GMT 2010


Author: caelum
Date: 2010-02-07 07:37:19 +0000 (Sun, 07 Feb 2010)
New Revision: 12815

Modified:
   trunk/examples/Tutorial/Hello_Chapter2/Hello/Changes
   trunk/examples/Tutorial/Hello_Chapter2/Hello/Makefile.PL
   trunk/examples/Tutorial/Hello_Chapter2/Hello/hello.conf
   trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello.pm
   trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Root.pm
   trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Site.pm
   trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/View/TT.pm
   trunk/examples/Tutorial/Hello_Chapter2/Hello/t/01app.t
   trunk/examples/Tutorial/Hello_Chapter2/Hello/t/controller_Site.t
   trunk/examples/Tutorial/Hello_Chapter2/Hello/t/view_TT.t
Log:
update Hello app

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/Changes
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/Changes	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/Changes	2010-02-07 07:37:19 UTC (rev 12815)
@@ -1,4 +1,4 @@
 This file documents the revision history for Perl extension Hello.
 
-0.01  2009-11-14 23:31:25
+0.01  2010-02-07 02:21:04
         - initial revision, generated by Catalyst

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/Makefile.PL	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/Makefile.PL	2010-02-07 07:37:19 UTC (rev 12815)
@@ -6,13 +6,15 @@
 name 'Hello';
 all_from 'lib/Hello.pm';
 
-requires 'Catalyst::Runtime' => '5.80013';
+requires 'Catalyst::Runtime' => '5.80018';
 requires 'Catalyst::Plugin::ConfigLoader';
 requires 'Catalyst::Plugin::Static::Simple';
 requires 'Catalyst::Action::RenderView';
-requires 'parent';
+requires 'Moose';
+requires 'namespace::autoclean';
 requires 'Config::General'; # This should reflect the config file format you've chosen
                  # See Catalyst::Plugin::ConfigLoader for supported formats
+test_requires 'Test::More' => '0.88';
 catalyst;
 
 install_script glob('script/*.pl');

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/hello.conf
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/hello.conf	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/hello.conf	2010-02-07 07:37:19 UTC (rev 12815)
@@ -1,3 +1,3 @@
-# rename this file to Hello.yml and put a ':' in front of 'name' if
+# rename this file to hello.yml and put a ':' after 'name' if
 # you want to use YAML like in old versions of Catalyst
 name Hello

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Root.pm
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Root.pm	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Root.pm	2010-02-07 07:37:19 UTC (rev 12815)
@@ -1,29 +1,25 @@
 package Hello::Controller::Root;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-use parent 'Catalyst::Controller';
+BEGIN { extends 'Catalyst::Controller' }
 
 #
 # 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} = '';
+__PACKAGE__->config(namespace => '');
 
 =head1 NAME
 
 Hello::Controller::Root - Root Controller for Hello
 
-=head1 DESCRIPTION
-
-[enter your description here]
-
 =head1 METHODS
 
-=cut
-
 =head2 index
 
+The root page (/)
+
 =cut
 
 sub index :Path :Args(0) {
@@ -33,20 +29,24 @@
     $c->response->body( $c->welcome_message );
 }
 
-sub default :Path {
+sub hello :Global {
     my ( $self, $c ) = @_;
-    $c->response->body( 'Page not found' );
-    $c->response->status(404);
+    
+    $c->stash(template => 'hello.tt');
 }
 
+=head2 default
 
-sub hello : Global {
+Standard 404 error page
+
+=cut
+
+sub default :Path {
     my ( $self, $c ) = @_;
-    
-    $c->stash->{template} = 'hello.tt';
+    $c->response->body( 'Page not found' );
+    $c->response->status(404);
 }
 
-
 =head2 end
 
 Attempt to render a view, if needed.
@@ -55,10 +55,6 @@
 
 sub end : ActionClass('RenderView') {}
 
-=head1 AUTHOR
-
-root
-
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify
@@ -66,4 +62,6 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
+
 1;

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Site.pm
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Site.pm	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Site.pm	2010-02-07 07:37:19 UTC (rev 12815)
@@ -1,8 +1,8 @@
 package Hello::Controller::Site;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-use parent 'Catalyst::Controller';
+BEGIN {extends 'Catalyst::Controller'; }
 
 =head1 NAME
 
@@ -16,7 +16,6 @@
 
 =cut
 
-
 =head2 index
 
 =cut
@@ -27,20 +26,13 @@
     $c->response->body('Matched Hello::Controller::Site in Site.');
 }
 
-
-
-sub test : Local {
+sub test :Local {
     my ( $self, $c ) = @_;
 
     $c->stash->{username} = "John";
     $c->stash->{template} = 'site/test.tt';
 }
 
-
-=head1 AUTHOR
-
-root
-
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify
@@ -48,4 +40,6 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
+
 1;

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/View/TT.pm	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/View/TT.pm	2010-02-07 07:37:19 UTC (rev 12815)
@@ -19,10 +19,6 @@
 
 L<Hello>
 
-=head1 AUTHOR
-
-root
-
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello.pm
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello.pm	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello.pm	2010-02-07 07:37:19 UTC (rev 12815)
@@ -1,8 +1,7 @@
 package Hello;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-
 use Catalyst::Runtime 5.80;
 
 # Set flags and add plugins for the application
@@ -13,11 +12,16 @@
 # Static::Simple: will serve static files from the application's root
 #                 directory
 
-use parent qw/Catalyst/;
-use Catalyst qw/-Debug
-                ConfigLoader
-                Static::Simple/;
+use Catalyst qw/
+    -Debug
+    ConfigLoader
+    Static::Simple
+/;
+
+extends 'Catalyst';
+
 our $VERSION = '0.01';
+$VERSION = eval $VERSION;
 
 # Configure the application.
 #
@@ -28,7 +32,11 @@
 # with an external configuration file acting as an override for
 # local deployment.
 
-__PACKAGE__->config( name => 'Hello' );
+__PACKAGE__->config(
+    name => 'Hello',
+    # Disable deprecated behavior needed by old applications
+    disable_component_resolution_regex_fallback => 1,
+);
 
 # Start the application
 __PACKAGE__->setup();
@@ -50,10 +58,6 @@
 
 L<Hello::Controller::Root>, L<Catalyst>
 
-=head1 AUTHOR
-
-root
-
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/t/01app.t
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/t/01app.t	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/t/01app.t	2010-02-07 07:37:19 UTC (rev 12815)
@@ -1,8 +1,10 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use Test::More tests => 2;
+use Test::More;
 
 BEGIN { use_ok 'Catalyst::Test', 'Hello' }
 
 ok( request('/')->is_success, 'Request should succeed' );
+
+done_testing();

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/t/controller_Site.t
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/t/controller_Site.t	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/t/controller_Site.t	2010-02-07 07:37:19 UTC (rev 12815)
@@ -1,10 +1,9 @@
 use strict;
 use warnings;
-use Test::More tests => 3;
+use Test::More;
 
 BEGIN { use_ok 'Catalyst::Test', 'Hello' }
 BEGIN { use_ok 'Hello::Controller::Site' }
 
 ok( request('/site')->is_success, 'Request should succeed' );
-
-
+done_testing();

Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/t/view_TT.t	2010-02-07 07:01:52 UTC (rev 12814)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/t/view_TT.t	2010-02-07 07:37:19 UTC (rev 12815)
@@ -1,6 +1,7 @@
 use strict;
 use warnings;
-use Test::More tests => 1;
+use Test::More;
 
 BEGIN { use_ok 'Hello::View::TT' }
 
+done_testing();




More information about the Catalyst-commits mailing list