Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.

X Report information
Id: 34437
Status: resolved
Left: 0 min
Priority: 0/0
Queue: Catalyst-Runtime

Owner: Nobody
Requestors: iang <Ian.Goodacre [...] xtra.co.nz>
Cc:
AdminCc:

Severity: Normal
Broken in: 5.7012
Fixed in: (no value)



X History Display mode: Brief headersFull headers
#   Wed Mar 26 05:15:23 2008 iang - Ticket created  
Subject: Catalyst::Utils::home
[text/plain 1.6k]
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
#   Thu Mar 27 13:29:49 2008 iang - Correspondence added  
Subject: Re: [rt.cpan.org #34437] AutoReply: Catalyst::Utils::home
Date: Fri, 28 Mar 2008 06:27:10 +1300
To: bug-Catalyst-Runtime[...]rt.cpan.org
From: Ian Goodacre <Ian.Goodacre[...]xtra.co.nz>
[text/plain 612b]
Sorry, but my "fix" was broken...

The following might be better:

[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-28 06:23:51.000000000 +1300
@@ -160,7 +160,7 @@

# find the @INC entry in which $file was found
(my $path = $inc_entry) =~ s/$file$//;
- my $home = dir($path)->absolute->cleanup;
+ my $home = dir(($path eq "")?():$path)->absolute->cleanup;

# pop off /lib and /blib if they're there
$home = $home->parent while $home =~ /b?lib$/;



#   Mon May 26 21:55:50 2008 BRICAS - Status changed from 'new' to 'open'  
#   Mon May 26 22:43:52 2008 BRICAS - Correspondence added  
[text/plain 53b]
Alternate fix + test checked in to svn revision 7811.
#   Mon May 26 22:43:53 2008 BRICAS - Status changed from 'open' to 'resolved'