Skip Menu |
 

This queue is for tickets about the Config-Auto CPAN distribution.

Report information
The Basics
Id: 5264
Status: resolved
Priority: 0/
Queue: Config-Auto

People
Owner: Nobody in particular
Requestors: abeltje [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: find_file() magic doesn't find files magically
Download (untitled) / with headers
text/plain 175b
The find_file() magic doesn't work when the script is started with a full path: $ /usr/local/bin/mymagic Will not find /etc/mymagic.config This patch makes it work...
Download CA.patch
text/x-diff 736b
--- lib/Config/Auto.pm.orig Mon Feb 9 11:42:31 2004 +++ lib/Config/Auto.pm Mon Feb 9 11:47:41 2004 @@ -3,6 +3,7 @@ use strict; use warnings; use File::Spec::Functions; +use File::Basename; #use XML::Simple; # this is now optional use Config::IniFiles; use Carp; @@ -129,10 +130,12 @@ sub find_file { my $x; - my $whoami = $0; + my $whoami = basename($0); + my $bindir = dirname($0); $whoami =~ s/\.pl$//; for ("${whoami}config", "${whoami}.config", "${whoami}rc", ".${whoami}rc") { return $_ if -e $_; + return $x if -e ($x=catfile($bindir,$_)); return $x if -e ($x=catfile($ENV{HOME},$_)); return "/etc/$_" if -e "/etc/$_"; }
thanks, applied


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.