minor pod fix to make tests pass.
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Helper.pm
index 53adcaa..a717bee 100644 (file)
@@ -9,6 +9,7 @@ use IO::File;
 use FindBin;
 use Template;
 use Catalyst;
+use Catalyst::Exception;
 
 my %cache;
 
@@ -63,7 +64,7 @@ sub mk_app {
     $self->{appprefix} = lc $self->{dir};
     $self->{appprefix} =~ s/-/_/g;
     $self->{startperl} = $Config{startperl};
-    $self->{scriptgen} = $Catalyst::CATALYST_SCRIPT_GEN;
+    $self->{scriptgen} = $Catalyst::CATALYST_SCRIPT_GEN || 4;
     $self->{author}    = $self->{author} = $ENV{'AUTHOR'}
       || eval { @{ [ getpwuid($<) ] }[6] }
       || 'Catalyst developer';
@@ -102,7 +103,13 @@ sub mk_component {
         my @args   = @_;
         my $class  = "Catalyst::Helper::$helper";
         eval "require $class";
-        die qq/Couldn't load helper "$class", "$@"/ if $@;
+        
+        if ( $@ ) {
+            Catalyst::Exception->throw( 
+                message => qq/Couldn't load helper "$class", "$@"/
+            );
+        }
+        
         if ( $class->can('mk_stuff') ) {
             return 1 unless $class->mk_stuff( $self, @args );
         }
@@ -145,7 +152,13 @@ sub mk_component {
             $comp = 'Controller' if $type eq 'C';
             my $class = "Catalyst::Helper::$comp\::$helper";
             eval "require $class";
-            die qq/Couldn't load helper "$class", "$@"/ if $@;
+            
+            if ( $@ ) {
+                Catalyst::Exception->throw( 
+                    message => qq/Couldn't load helper "$class", "$@"/
+                );
+            }            
+        
             if ( $class->can('mk_compclass') ) {
                 return 1 unless $class->mk_compclass( $self, @args );
             }
@@ -178,11 +191,14 @@ sub mk_dir {
         print qq/ exists "$dir"\n/;
         return 0;
     }
-    if ( mkpath $dir) {
+    if ( mkpath [$dir] ) {
         print qq/created "$dir"\n/;
         return 1;
     }
-    die qq/Couldn't create "$dir", "$!"/;
+    
+    Catalyst::Exception->throw( 
+        message => qq/Couldn't create "$dir", "$!"/
+    );    
 }
 
 =head3 mk_file
@@ -202,7 +218,10 @@ sub mk_file {
         print qq/created "$file"\n/;
         return 1;
     }
-    die qq/Couldn't create "$file", "$!"/;
+    
+    Catalyst::Exception->throw( 
+        message => qq/Couldn't create "$file", "$!"/
+    );       
 }
 
 =head3 next_test
@@ -219,6 +238,9 @@ sub next_test {
         $prefix         = $prefix;
         $tname          = $prefix . '.t';
         $self->{prefix} = $prefix;
+        $prefix = lc $prefix;
+        $prefix =~ s/-/\//g;
+        $self->{uri} = $prefix;
     }
     my $dir  = $self->{test_dir};
     my $type = $self->{type};
@@ -396,7 +418,7 @@ Sebastian Riedel, C<sri@oook.de>
 
 =head1 LICENSE
 
-This library is free software . You can redistribute it and/or modify 
+This library is free software . You can redistribute it and/or modify
 it under the same terms as perl itself.
 
 =cut
@@ -449,7 +471,7 @@ sub default : Private {
 
 =head1 LICENSE
 
-This library is free software . You can redistribute it and/or modify 
+This library is free software . You can redistribute it and/or modify
 it under the same terms as perl itself.
 
 =cut
@@ -560,7 +582,7 @@ Sebastian Riedel, C<sri@oook.de>
 
 Copyright 2004 Sebastian Riedel. All rights reserved.
 
-This library is free software. You can redistribute it and/or modify 
+This library is free software. You can redistribute it and/or modify
 it under the same terms as perl itself.
 
 =cut
@@ -598,7 +620,7 @@ Sebastian Riedel, C<sri@oook.de>
 
 Copyright 2004 Sebastian Riedel. All rights reserved.
 
-This library is free software. You can redistribute it and/or modify 
+This library is free software. You can redistribute it and/or modify
 it under the same terms as perl itself.
 
 =cut
@@ -656,7 +678,7 @@ Sebastian Riedel, C<sri@oook.de>
 
 Copyright 2004 Sebastian Riedel. All rights reserved.
 
-This library is free software. You can redistribute it and/or modify 
+This library is free software. You can redistribute it and/or modify
 it under the same terms as perl itself.
 
 =cut
@@ -713,7 +735,7 @@ Sebastian Riedel, C<sri@oook.de>
 
 Copyright 2004 Sebastian Riedel. All rights reserved.
 
-This library is free software. You can redistribute it and/or modify 
+This library is free software. You can redistribute it and/or modify
 it under the same terms as perl itself.
 
 =cut
@@ -772,7 +794,7 @@ Sebastian Riedel, C<sri\@oook.de>
 
 Copyright 2004 Sebastian Riedel. All rights reserved.
 
-This library is free software. You can redistribute it and/or modify 
+This library is free software. You can redistribute it and/or modify
 it under the same terms as perl itself.
 
 =cut
@@ -816,7 +838,7 @@ sub default : Private {
 
 =head1 LICENSE
 
-This library is free software . You can redistribute it and/or modify 
+This library is free software . You can redistribute it and/or modify
 it under the same terms as perl itself.
 
 =cut
@@ -828,7 +850,7 @@ use Test::More tests => 3;
 use_ok( Catalyst::Test, '[% app %]' );
 use_ok('[% class %]');
 
-ok( request('[% prefix %]')->is_success );
+ok( request('[% uri %]')->is_success );
 [% ELSE %]
 use Test::More tests => 1;
 use_ok('[% class %]');