Subject: | Catalyst::Utils::home |
Thank you for making Catalyst available. I hope the following might
help make it, ever so slightly, better...
Setting home directory fails if the module using Catalyst is loaded
from the current working directory. In this case, Path::Class::dir('')
returns '/' instead of '.'.
The following change to Catalyst::Utils.pm seems to correct this
problem but, of course, it may cause other problems that I am not aware
of.
[root@abas Catalyst]# diff -u Utils.pm.orig Utils.pm
--- Utils.pm.orig 2008-03-26 21:23:37.000000000 +1300
+++ Utils.pm 2008-03-26 21:27:39.000000000 +1300
@@ -159,8 +159,9 @@
# look for an uninstalled Catalyst app
# find the @INC entry in which $file was found
- (my $path = $inc_entry) =~ s/$file$//;
- my $home = dir($path)->absolute->cleanup;
+ my @path = split('/',$inc_entry);
+ pop(@path);
+ my $home = dir(@path)->absolute->cleanup;
# pop off /lib and /blib if they're there
$home = $home->parent while $home =~ /b?lib$/;
In passing, I am puzzled why, for an uninstalled Catalyst app the home
directory is the directory in which the module using Catalyst is
located but for an installed Catalyst app it is a subdirectory of the
same name as the module, less the '.pm'. No doubt this will become
clear to me as I become more familiar with Catalyst but for the moment
it just seems arbitrary and inconsistent. I haven't noticed any
documentation about the significance of the home directory in the
introductory material I have read thus far, but maybe it is there and
this will all seem clear and reasonable when I find it.
Cheers,
Ian