Skip Menu |
 

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 34437
Status: resolved
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: Nobody in particular
Requestors: Ian.Goodacre [...] xtra.co.nz
Cc:
AdminCc:

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



Subject: Catalyst::Utils::home
Download (untitled) / with headers
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
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>
Download (untitled) / with headers
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$/;
Alternate fix + test checked in to svn revision 7811.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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