[Catalyst-commits] r10508 - in Catalyst-Devel/1.00/branches/helper_refactor: lib/Catalyst share/script

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Fri Jun 12 00:42:35 GMT 2009


Author: t0m
Date: 2009-06-12 00:42:35 +0000 (Fri, 12 Jun 2009)
New Revision: 10508

Added:
   Catalyst-Devel/1.00/branches/helper_refactor/share/script/test.tt
Modified:
   Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Helper.pm
Log:
Unfuck, tests pass again

Modified: Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Helper.pm
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Helper.pm	2009-06-12 00:29:43 UTC (rev 10507)
+++ Catalyst-Devel/1.00/branches/helper_refactor/lib/Catalyst/Helper.pm	2009-06-12 00:42:35 UTC (rev 10508)
@@ -56,6 +56,8 @@
         $cache{$class} = eval "package $class; <DATA>";
     }
     my $data = $cache{$class};
+    Carp::confess("Could not get data from __DATA__ segment for $class")
+        unless $data;
     my @files = split /^__(.+)__\r?\n/m, $data;
     shift @files;
     while (@files) {
@@ -347,12 +349,12 @@
 sub _mk_appclass {
     my $self = shift;
     my $mod  = $self->{mod};
-    $self->render_file( 'appclass.tt', "$mod.pm" );
+    $self->render_sharedir_file( 'lib/appclass.tt', "$mod.pm" );
 }
 
 sub _mk_rootclass {
     my $self = shift;
-    $self->render_file( 'rootclass.tt',
+    $self->render_sharedir_file( 'lib/MyApp/Controller/rootclass.tt',
         File::Spec->catfile( $self->{c}, "Root.pm" ) );
 }
 
@@ -361,7 +363,7 @@
     $self->{path} = File::Spec->catfile( 'lib', split( '::', $self->{name} ) );
     $self->{path} .= '.pm';
     my $dir = $self->{dir};
-    $self->render_file( 'makefile.tt', "$dir\/Makefile.PL" );
+    $self->render_sharedir_file( 'makefile.tt', "$dir\/Makefile.PL" );
 
     if ( $self->{makefile} ) {
 
@@ -375,36 +377,36 @@
     my $self      = shift;
     my $dir       = $self->{dir};
     my $appprefix = $self->{appprefix};
-    $self->render_file( 'config.tt',
+    $self->render_sharedir_file( 'config.tt',
         File::Spec->catfile( $dir, "$appprefix.conf" ) );
 }
 
 sub _mk_readme {
     my $self = shift;
     my $dir  = $self->{dir};
-    $self->render_file( 'readme.tt', "$dir\/README" );
+    $self->render_sharedir_file( 'readme.tt', "$dir\/README" );
 }
 
 sub _mk_changes {
     my $self = shift;
     my $dir  = $self->{dir};
     my $time = strftime('%Y-%m-%d %H:%M:%S', localtime time);
-    $self->render_file( 'changes.tt', "$dir\/Changes", { time => $time } );
+    $self->render_sharedir_file( 'changes.tt', "$dir\/Changes", { time => $time } );
 }
 
 sub _mk_apptest {
     my $self = shift;
     my $t    = $self->{t};
-    $self->render_file( 'apptest.tt',         "$t\/01app.t" );
-    $self->render_file( 'podtest.tt',         "$t\/02pod.t" );
-    $self->render_file( 'podcoveragetest.tt', "$t\/03podcoverage.t" );
+    $self->render_sharedir_file( 't/apptest.tt',         "$t\/01app.t" );
+    $self->render_sharedir_file( 't/podtest.tt',         "$t\/02pod.t" );
+    $self->render_sharedir_file( 't/podcoveragetest.tt', "$t\/03podcoverage.t" );
 }
 
 sub _mk_cgi {
     my $self      = shift;
     my $script    = $self->{script};
     my $appprefix = $self->{appprefix};
-    $self->render_file( 'cgi.tt', "$script\/$appprefix\_cgi.pl" );
+    $self->render_sharedir_file( 'script/cgi.tt', "$script\/$appprefix\_cgi.pl" );
     chmod 0700, "$script/$appprefix\_cgi.pl";
 }
 
@@ -412,7 +414,7 @@
     my $self      = shift;
     my $script    = $self->{script};
     my $appprefix = $self->{appprefix};
-    $self->render_file( 'fastcgi.tt', "$script\/$appprefix\_fastcgi.pl" );
+    $self->render_sharedir_file( 'script/fastcgi.tt', "$script\/$appprefix\_fastcgi.pl" );
     chmod 0700, "$script/$appprefix\_fastcgi.pl";
 }
 
@@ -420,7 +422,7 @@
     my $self      = shift;
     my $script    = $self->{script};
     my $appprefix = $self->{appprefix};
-    $self->render_file( 'server.tt', "$script\/$appprefix\_server.pl" );
+    $self->render_sharedir_file( 'script/server.tt', "$script\/$appprefix\_server.pl" );
     chmod 0700, "$script/$appprefix\_server.pl";
 }
 
@@ -428,7 +430,7 @@
     my $self      = shift;
     my $script    = $self->{script};
     my $appprefix = $self->{appprefix};
-    $self->render_file( 'test.tt', "$script/$appprefix\_test.pl" );
+    $self->render_sharedir_file( 'script/test.tt', "$script/$appprefix\_test.pl" );
     chmod 0700, "$script/$appprefix\_test.pl";
 }
 
@@ -436,20 +438,20 @@
     my $self      = shift;
     my $script    = $self->{script};
     my $appprefix = $self->{appprefix};
-    $self->render_file( 'create.tt', "$script\/$appprefix\_create.pl" );
+    $self->render_sharedir_file( 'script/create.tt', "$script\/$appprefix\_create.pl" );
     chmod 0700, "$script/$appprefix\_create.pl";
 }
 
 sub _mk_compclass {
     my $self = shift;
     my $file = $self->{file};
-    return $self->render_file( 'compclass.tt', "$file" );
+    return $self->render_sharedir_file( 'compclass.tt', "$file" );
 }
 
 sub _mk_comptest {
     my $self = shift;
     my $test = $self->{test};
-    $self->render_file( 'comptest.tt', "$test" );
+    $self->render_sharedir_file( 'comptest.tt', "$test" );
 }
 
 sub _mk_images {

Copied: Catalyst-Devel/1.00/branches/helper_refactor/share/script/test.tt (from rev 10506, Catalyst-Devel/1.00/branches/helper_refactor/share/t/test.tt)
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/share/script/test.tt	                        (rev 0)
+++ Catalyst-Devel/1.00/branches/helper_refactor/share/script/test.tt	2009-06-12 00:42:35 UTC (rev 10508)
@@ -0,0 +1,53 @@
+[% startperl %]
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Catalyst::Test '[% name %]';
+
+my $help = 0;
+
+GetOptions( 'help|?' => \$help );
+
+pod2usage(1) if ( $help || !$ARGV[0] );
+
+print request($ARGV[0])->content . "\n";
+
+1;
+
+=head1 NAME
+
+[% appprefix %]_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+[% appprefix %]_test.pl [options] uri
+
+ Options:
+   -help    display this help and exits
+
+ Examples:
+   [% appprefix %]_test.pl http://localhost/some_action
+   [% appprefix %]_test.pl /some_action
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst action from the command line.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut




More information about the Catalyst-commits mailing list