[Catalyst] Re: setup_home bug (with fix): wrong detection of
home directory
Ash Berlin
ash_cpan at firemirror.com
Mon Oct 8 10:03:59 GMT 2007
Oleg Pronin wrote:
> hello?
>
> 2007/9/28, Oleg Pronin <syber.rus at gmail.com <mailto:syber.rus at gmail.com>>:
>
> Hello.
>
> I put the service script into
> APP_HOME/script/service/online_users.plx
>
> In the script:
>
> use FindBin;
> use lib "$FindBin::Bin/../../lib";
> use MyApp;
>
> print MyApp->path_to('/'); # prints APP_HOME/script/service/
>
> Fix for Catalyst::Utils (sub Catalyst::Utils::home):
>
> 174,176c174,177
> < my ($lastdir) = $home->dir_list( -1, 1 );
> < if ( $lastdir eq '..' ) {
> < $home = dir($home)->parent->parent;
> ---
> > my $i = 0;
> > $i++ while $home->dir_list( -$i, 1 ) eq '..';
> > if ($i) {
> > $home = dir($home)->parent for 1..($i*2);
>
> in my case at line 174 $home = 'APP_HOME/script/service/../../'
>
Can you redo that patch with a test case please?
Also there is a function in Path::Class::Dir called absolute that might
do that job for you. (think about HOME/script/service/../foo as a dir)
-ash
More information about the Catalyst
mailing list