[Catalyst-dev] couple of small patches

Geoff Richards qef at ungwe.org
Wed Apr 27 22:18:19 CEST 2005


I get some test failures with current svn trunk of catalyst
(revision 535).  The patch attached fixes them.

 * Minor POD tweak.

 * 't/01use.t' fails because Catalyst.pm comes up with an undefined
   value for '$path' and then tries to pass it to Path::Class.  That
   causes uninitialized value warnings, so I wrapped definedness
   tests round a few pieces of code, which at least makes the tests
   happy.  But does it make any sense to carry on if $home isn't
   defined?

 * When 'use'ing Path::Class I think it would be better to name the
   functions being imported.  Not only is it more greppable, but it will
   work with earlier versions (I tried it first with 0.03 which doesn't
   export those functions by default).

HTH.
   qef

-- 

--- Geoff Richards -------------><-------------- http://ungwe.org/ ---
"I tried to fling my shadow at the moon,
 The while my blood leapt with a wordless song."  --  Theodore Roethke
-------------- next part --------------
Index: lib/Catalyst.pm
===================================================================
--- lib/Catalyst.pm	(revision 535)
+++ lib/Catalyst.pm	(working copy)
@@ -5,7 +5,7 @@
 use UNIVERSAL::require;
 use Catalyst::Log;
 use Text::ASCIITable;
-use Path::Class;
+use Path::Class qw(file dir);
 our $CATALYST_SCRIPT_GEN = 4;
 
 __PACKAGE__->mk_classdata($_) for qw/dispatcher engine log/;
@@ -249,13 +249,16 @@
     my $name = $caller;
     $name =~ s/\:\:/\//g;
     my $path = $INC{"$name.pm"};
-    my $home = file($path)->absolute->dir;
-    $name =~ /(\w+)$/;
-    my $append = $1;
-    my $subdir = dir($home)->subdir($append);
-    for ( split '/', $name ) { $home = dir($home)->parent }
-    if ( $home =~ /blib$/ ) { $home = dir($home)->parent }
-    elsif ( !-f file( $home, 'Makefile.PL' ) ) { $home = $subdir }
+    my $home;
+    if (defined $path) {
+        $home = file($path)->absolute->dir;
+        $name =~ /(\w+)$/;
+        my $append = $1;
+        my $subdir = dir($home)->subdir($append);
+        for ( split '/', $name ) { $home = dir($home)->parent }
+        if ( $home =~ /blib$/ ) { $home = dir($home)->parent }
+        elsif ( !-f file( $home, 'Makefile.PL' ) ) { $home = $subdir }
+    }
 
     if ( $caller->debug ) {
         $home
@@ -265,7 +268,7 @@
           : $caller->log->debug(q/Couldn't find home/);
     }
     $caller->config->{home} = $home;
-    $caller->config->{root} = dir($home)->subdir('root');
+    $caller->config->{root} = dir($home)->subdir('root') if defined $home;
 }
 
 =item $c->engine
Index: lib/Catalyst/Build.pm
===================================================================
--- lib/Catalyst/Build.pm	(revision 535)
+++ lib/Catalyst/Build.pm	(working copy)
@@ -27,6 +27,8 @@
 
 =head1 METHODS
 
+=over 4
+
 =item ACTION_install
 
 =cut


More information about the Catalyst-dev mailing list