diff -Nru libconfig-find-perl-0.26/Changes libconfig-find-perl-0.31/Changes --- libconfig-find-perl-0.26/Changes 2008-11-24 10:52:07.000000000 +0000 +++ libconfig-find-perl-0.31/Changes 2015-05-26 10:51:30.000000000 +0000 @@ -1,117 +1,148 @@ -Revision history for Perl extension Config::Find. +Revision history for Config::Find. -0.26 Nov 24, 2008 +0.31 2015-05-26 + - Fix tests for meta files + - Generate META.(yml|json) on the fly when the dist is built + - Several doc fixes, remove non-ASCII characters + +0.30 2015-05-25 + - Fix testing on Windows (bug report and patch by Alexandr + Ciornii) + +0.29 2015-04-21 + - Config::Find::Any::_find must return undef when file not found. + PBP does not apply. + - added initial test script for find() method. + - default to WinAny for Windows OSes, and separate exceptions. + - report versions when testing. + +0.28 2015-04-17 + - documentation updates. + - fixed error message typo. + - added POD coverage tests. + - acknowledged Barbie's contribution, at Salvador's request. + - switched to correct POD encoding. + +0.27 2015-04-16 + - added POD UTF8 encoding directives. (RT#78944) + - fixed minor typos. (RT#82001) + - added Win7.pm. (RT#57625) + - change file dates changed to meet W3CDTF standards. + - updated module versions to be consistent for the distribution. + - added META.json & updated META.yml. + - added META and changefile tests. + - moved older test scripts to newer names. + +0.26 2008-11-24 - remove warning from File::Spec -0.25 Nov 20, 2008 +0.25 2008-11-20 - paths began with '//' on cygwin, use catpath to undo splitpath (bug report from Pablo Torres). -0.24 12 Nov, 2008 +0.24 2008-11-12 - add Config::Find::Where->script_dir() - some minor doc improvements -0.23 17 Sep, 2008 +0.23 2008-09-17 - add Config::Find::Where->lib_dir method - Config::Find::Where->application_dir documented - update to use new File::HomeDir API -0.22 22 Sep 2005 - - pod errors corrected on Config::Find::Where and now using - Test::Pod for automatically finding those errors. - -0.21 8 Aug 2005 - - added work around on WinAny module when ${APPDATA} or - ${LOCAL_APPDATA} point to the user desktop to ignore them. - -0.20 27 Jul 2005 - - look for ~/.foo.conf and ~/.foo.cfg in addition to ~/.foo - -0.19 13 Jul 2005 - - bug on look_for_dir_file passing the wrong app name to - app_dir. - -0.18 13 Apr 2005 - - bug on parent_dir('') going to an inf. loop corrected. - - convert path to absolute on create_dir and create_parent_dir - - create_parent_dirs renamed to create_parent_dir and exported - via Config::Find::Where. - -0.17 13 Apr 2005 - - bug on var_dir corrected, when using scope 'app' a 'var' - part was missing on the path. - - Config::Find::Where::var_dir documented - -0.16 16 Sep 2004 - - create_dir function exported on Config::Find::Where - - support for 'dir' option on Where module functions. - -0.15 11 Feb 2004 - - Corrected bug on "names" handling reported by Bart Schaefer - - Better handling of Win32::GetFolderPath returning invalid - results - -0.14 15 Jan 2004 - - Win2k3.pm missing from MANIFEST - - Use regexps to match Win OSs - - corrected bug on guess_script_dir +0.22 2005-09-22 + - pod errors corrected on Config::Find::Where and now using + Test::Pod for automatically finding those errors. + +0.21 2005-08-08 + - added work around on WinAny module when ${APPDATA} or + ${LOCAL_APPDATA} point to the user desktop to ignore them. + +0.20 2005-07-27 + - look for ~/.foo.conf and ~/.foo.cfg in addition to ~/.foo + +0.19 2005-07-13 + - bug on look_for_dir_file passing the wrong app name to + app_dir. + +0.18 2005-04-13 + - bug on parent_dir('') going to an inf. loop corrected. + - convert path to absolute on create_dir and create_parent_dir + - create_parent_dirs renamed to create_parent_dir and exported + via Config::Find::Where. + +0.17 2005-04-13 + - bug on var_dir corrected, when using scope 'app' a 'var' + part was missing on the path. + - Config::Find::Where::var_dir documented + +0.16 2004-09-16 + - create_dir function exported on Config::Find::Where + - support for 'dir' option on Where module functions. + +0.15 2004-02-11 + - Corrected bug on "names" handling reported by Bart Schaefer + - Better handling of Win32::GetFolderPath returning invalid + results + +0.14 2004-01-15 + - Win2k3.pm missing from MANIFEST + - Use regexps to match Win OSs + - corrected bug on guess_script_dir -0.13 13 Jan 2004 - - NT4 was not being recognised as NT (bug reported by +0.13 2004-01-13 + - NT4 was not being recognised as NT (bug reported by Philip Grivell). -0.12 30 Sep 2003 - - Unix module accepts .cfg extension for read mode - -0.11 12 Jun 2003 - - improved Config::Find::Where->var_dir(scope=>user) on Unix. - - new Config::Find::Where->helper_path method - -0.10 12 Jun 2003 - - corrected several bugs in Windows modules - - new test script 2_where.t - -0.09 5 Jun 2003 - - new file layout, now all the .pm files are under a common - lib dir. - - new Config::Find::Where module with some utility methods - (maybe unrelated to Config::Find, but useful anyway). - - Win32.pm module deleted. - - added supoprt for Windows 2003 - - corrected some errors in the docs - -0.08 29 May 2003 - - look for script on current dir when it doesn't have the path - included in its name and it has not been found on the system - path. - -0.07 29 Apr 2003 - - Accept "WinXP/.NET" as OS - -0.06 Tue Apr 15 2003 - - File::HomeDir dependency added to main module, CPANPLUS - doesn't catch it on the inner module - -0.05 Mon Apr 14 2003 - - support for one liners added to Unix module - -0.04 Thu Apr 10 2003 - - added File::HomeDir dependecy to Config::Find::Unix - -0.03 Wed Apr 9 2003 - - corrected bug in open that returned a valid file handler - even when the configuration file was not found - -0.02 Wed Apr 9 2003 - - corrected bug in 'parent_dir' that was not correctly - handling trailing '/' - - corrected bug in 'guess_script_dir' that was not removing - the script name - - support for 'file' option added - - dependencies added in Makefile.PL - -0.01 Mon Mar 31 13:09:40 2003 - - original version; created by h2xs 1.22 with options - -AX -n Config::Find - +0.12 2003-09-30 + - Unix module accepts .cfg extension for read mode +0.11 2003-06-12 + - improved Config::Find::Where->var_dir(scope=>user) on Unix. + - new Config::Find::Where->helper_path method + +0.10 2003-06-12 + - corrected several bugs in Windows modules + - new test script 2_where.t + +0.09 2003-06-05 + - new file layout, now all the .pm files are under a common + lib dir. + - new Config::Find::Where module with some utility methods + (maybe unrelated to Config::Find, but useful anyway). + - Win32.pm module deleted. + - added supoprt for Windows 2003 + - corrected some errors in the docs + +0.08 2003-05-29 + - look for script on current dir when it doesn't have the path + included in its name and it has not been found on the system + path. + +0.07 2003-04-29 + - Accept "WinXP/.NET" as OS + +0.06 2003-04-15 + - File::HomeDir dependency added to main module, CPANPLUS + doesn't catch it on the inner module + +0.05 2003-04-14 + - support for one liners added to Unix module + +0.04 2003-04-10 + - added File::HomeDir dependecy to Config::Find::Unix + +0.03 2003-04-09 + - corrected bug in open that returned a valid file handler + even when the configuration file was not found + +0.02 2003-04-09 + - corrected bug in 'parent_dir' that was not correctly + handling trailing '/' + - corrected bug in 'guess_script_dir' that was not removing + the script name + - support for 'file' option added + - dependencies added in Makefile.PL + +0.01 2003-03-31T13:09:40 + - original version; created by h2xs 1.22 with options + - AX -n Config::Find diff -Nru libconfig-find-perl-0.26/debian/changelog libconfig-find-perl-0.31/debian/changelog --- libconfig-find-perl-0.26/debian/changelog 2013-05-26 14:22:24.000000000 +0000 +++ libconfig-find-perl-0.31/debian/changelog 2015-08-02 00:40:52.000000000 +0000 @@ -1,3 +1,30 @@ +libconfig-find-perl (0.31-1) unstable; urgency=medium + + * Team upload. + + [ gregor herrmann ] + * Strip trailing slash from metacpan URLs. + + [ Salvatore Bonaccorso ] + * Update Vcs-Browser URL to cgit web frontend + + [ Lucas Kanashiro ] + * Add debian/upstream/metadata + * Import upstream version 0.31 + * Remove unnecessary patches (already fixed in new upstream version) + * Set debhelper >= 9 + * Declare compliance with Debian policy 3.9.6 + * Add autopkgtest-pkg-perl (skip syntax test for Win related modules) + * Fix spelling error in short description + * Add another patch fixing spelling errors in manpages + * Update upstream copyright + + [ gregor herrmann ] + * Drop build dependency on libtest-pod-perl. + The pod test is not run during package build. + + -- Lucas Kanashiro Sat, 01 Aug 2015 15:27:47 -0300 + libconfig-find-perl (0.26-2) unstable; urgency=low * Team upload. diff -Nru libconfig-find-perl-0.26/debian/compat libconfig-find-perl-0.31/debian/compat --- libconfig-find-perl-0.26/debian/compat 2013-05-26 14:22:24.000000000 +0000 +++ libconfig-find-perl-0.31/debian/compat 2015-08-02 00:40:52.000000000 +0000 @@ -1 +1 @@ -8 +9 diff -Nru libconfig-find-perl-0.26/debian/control libconfig-find-perl-0.31/debian/control --- libconfig-find-perl-0.26/debian/control 2013-05-26 14:22:24.000000000 +0000 +++ libconfig-find-perl-0.31/debian/control 2015-08-02 00:40:52.000000000 +0000 @@ -1,24 +1,25 @@ Source: libconfig-find-perl -Section: perl -Priority: optional Maintainer: Debian Perl Group Uploaders: Jotam Jr. Trejo -Build-Depends: debhelper (>= 8) +Section: perl +Testsuite: autopkgtest-pkg-perl +Priority: optional +Build-Depends: debhelper (>= 9) Build-Depends-Indep: libfile-homedir-perl, - libfile-which-perl, - libtest-pod-perl, - perl -Standards-Version: 3.9.4 -Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-perl/packages/libconfig-find-perl.git + libfile-which-perl, + perl +Standards-Version: 3.9.6 +Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libconfig-find-perl.git Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/libconfig-find-perl.git -Homepage: https://metacpan.org/release/Config-Find/ +Homepage: https://metacpan.org/release/Config-Find Package: libconfig-find-perl Architecture: all -Depends: ${misc:Depends}, ${perl:Depends}, - libfile-homedir-perl, - libfile-which-perl -Description: module to search configuration files using OS dependant heuristics +Depends: ${misc:Depends}, + ${perl:Depends}, + libfile-homedir-perl, + libfile-which-perl +Description: module to search configuration files using OS dependent heuristics Every OS has different rules for configuration files placement, this module allows one to easily find and create app configuration files following those rules. diff -Nru libconfig-find-perl-0.26/debian/copyright libconfig-find-perl-0.31/debian/copyright --- libconfig-find-perl-0.26/debian/copyright 2013-05-26 14:22:24.000000000 +0000 +++ libconfig-find-perl-0.31/debian/copyright 2015-08-02 00:40:52.000000000 +0000 @@ -1,14 +1,16 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Config-Find -Source: https://metacpan.org/release/Config-Find/ +Source: https://metacpan.org/release/Config-Find Upstream-Contact: Salvador Fandiño Files: * -Copyright: 2003-2008, Salvador Fandiño +Copyright: 2003-2015, Salvador Fandiño + 2015, Barbie License: Artistic or GPL-1+ Files: debian/* Copyright: 2012, Jotam Jr. Trejo + 2015, Lucas Kanashiro License: Artistic or GPL-1+ License: Artistic diff -Nru libconfig-find-perl-0.26/debian/patches/fix_spelling_error_in_manpage.patch libconfig-find-perl-0.31/debian/patches/fix_spelling_error_in_manpage.patch --- libconfig-find-perl-0.26/debian/patches/fix_spelling_error_in_manpage.patch 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/debian/patches/fix_spelling_error_in_manpage.patch 2015-08-02 00:40:52.000000000 +0000 @@ -0,0 +1,28 @@ +Description: Fix spelling errors in manpages +Author: Lucas Kanashiro +Last-Update: 2015-08-01 +Forwarded: https://rt.cpan.org/Ticket/Display.html?id=106188 +Bug: https://rt.cpan.org/Ticket/Display.html?id=106188 + +--- a/lib/Config/Find.pm ++++ b/lib/Config/Find.pm +@@ -152,7 +152,7 @@ Config::Find - Find configuration files + + =head1 ABSTRACT + +-Config::Find searches for configuration files using OS dependant ++Config::Find searches for configuration files using OS dependent + heuristics. + + =head1 DESCRIPTION +--- a/lib/Config/Find/Where.pm ++++ b/lib/Config/Find/Where.pm +@@ -151,7 +151,7 @@ Config::Find::Where - Find locations in + + =head1 ABSTRACT + +-Config::Find searches for locations using OS dependant heuristics. ++Config::Find searches for locations using OS dependent heuristics. + + =head1 DESCRIPTION + diff -Nru libconfig-find-perl-0.26/debian/patches/manpage-typo-fix.patch libconfig-find-perl-0.31/debian/patches/manpage-typo-fix.patch --- libconfig-find-perl-0.26/debian/patches/manpage-typo-fix.patch 2013-05-26 14:22:24.000000000 +0000 +++ libconfig-find-perl-0.31/debian/patches/manpage-typo-fix.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -Description: Fixes several misspells and typos in manpages -Author: Jotam Jr. Trejo -Bug: https://rt.cpan.org/Public/Bug/Display.html?id=82001 -Last-Update: 2012-12-14 - ---- a/lib/Config/Find.pm -+++ b/lib/Config/Find.pm -@@ -157,13 +157,13 @@ - - =head1 ABSTRACT - --Config::Find searchs for configuration files using OS dependant -+Config::Find searches for configuration files using OS dependent - heuristics. - - =head1 DESCRIPTION - - Every OS has different rules for configuration files placement, this --module allows to easily find and create your app configuration files -+module allows one to easily find and create your app configuration files - following those rules. - - Config::Find references configuration files by the application name or ---- a/lib/Config/Find/Where.pm -+++ b/lib/Config/Find/Where.pm -@@ -156,7 +156,7 @@ - - =head1 ABSTRACT - --Config::Find searchs for locations using OS dependant heuristics. -+Config::Find searches for locations using OS dependent heuristics. - - =head1 DESCRIPTION - -@@ -164,7 +164,7 @@ - reused to also find other interesting things like temporary - directories, the script location, etc. - --This module adds a public API to all the hiden functionallity. -+This module adds a public API to all the hiden functionality. - - =head2 OPTIONS - diff -Nru libconfig-find-perl-0.26/debian/patches/pod-encoding.patch libconfig-find-perl-0.31/debian/patches/pod-encoding.patch --- libconfig-find-perl-0.26/debian/patches/pod-encoding.patch 2013-05-26 14:22:24.000000000 +0000 +++ libconfig-find-perl-0.31/debian/patches/pod-encoding.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -Description: add =encoding to POD - Otherwise the pod test fails under Perl 5.18 -Origin: vendor -Bug-Debian: http://bugs.debian.org/709768 -Bug: https://rt.cpan.org/Ticket/Display.html?id=85626 -Forwarded: https://rt.cpan.org/Ticket/Display.html?id=85626 -Author: gregor herrmann -Last-Update: 2013-05-26 - ---- a/lib/Config/Find/Unix.pm -+++ b/lib/Config/Find/Unix.pm -@@ -205,6 +205,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::Unix - Config::Find plugin for Unixen ---- a/lib/Config/Find/Win2k.pm -+++ b/lib/Config/Find/Win2k.pm -@@ -12,6 +12,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::Win2k - Win2k idiosyncrasies for Config::Find ---- a/lib/Config/Find/Win2k3.pm -+++ b/lib/Config/Find/Win2k3.pm -@@ -12,6 +12,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::Win2k - Win2k idiosyncrasies for Config::Find ---- a/lib/Config/Find/Win95.pm -+++ b/lib/Config/Find/Win95.pm -@@ -12,6 +12,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::Win95 - Win95 idiosyncrasies for Config::Find ---- a/lib/Config/Find/Win98.pm -+++ b/lib/Config/Find/Win98.pm -@@ -12,6 +12,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::Win98 - Win98 idiosyncrasies for Config::Find ---- a/lib/Config/Find/WinAny.pm -+++ b/lib/Config/Find/WinAny.pm -@@ -151,6 +151,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::WinAny - Behaviours common to any Win32 OS for Config::Find ---- a/lib/Config/Find/WinCE.pm -+++ b/lib/Config/Find/WinCE.pm -@@ -12,6 +12,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::WinCE - WinCE idiosyncrasies for Config::Find ---- a/lib/Config/Find/WinME.pm -+++ b/lib/Config/Find/WinME.pm -@@ -12,6 +12,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::WinME - WinME idiosyncrasies for Config::Find ---- a/lib/Config/Find/WinNT.pm -+++ b/lib/Config/Find/WinNT.pm -@@ -12,6 +12,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::WinNT - WinNT idiosyncrasies for Config::Find ---- a/lib/Config/Find/WinXP.pm -+++ b/lib/Config/Find/WinXP.pm -@@ -12,6 +12,8 @@ - 1; - __END__ - -+=encoding latin1 -+ - =head1 NAME - - Config::Find::WinXP - WinXP idiosyncrasies for Config::Find diff -Nru libconfig-find-perl-0.26/debian/patches/series libconfig-find-perl-0.31/debian/patches/series --- libconfig-find-perl-0.26/debian/patches/series 2013-05-26 14:22:24.000000000 +0000 +++ libconfig-find-perl-0.31/debian/patches/series 2015-08-02 00:40:52.000000000 +0000 @@ -1,2 +1 @@ -manpage-typo-fix.patch -pod-encoding.patch +fix_spelling_error_in_manpage.patch diff -Nru libconfig-find-perl-0.26/debian/tests/pkg-perl/skip-syntax libconfig-find-perl-0.31/debian/tests/pkg-perl/skip-syntax --- libconfig-find-perl-0.26/debian/tests/pkg-perl/skip-syntax 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/debian/tests/pkg-perl/skip-syntax 2015-08-02 00:40:52.000000000 +0000 @@ -0,0 +1,10 @@ +/usr/share/perl5/Config/Find/Win2k.pm +/usr/share/perl5/Config/Find/WinAny.pm +/usr/share/perl5/Config/Find/WinNT.pm +/usr/share/perl5/Config/Find/WinME.pm +/usr/share/perl5/Config/Find/Win7.pm +/usr/share/perl5/Config/Find/Win98.pm +/usr/share/perl5/Config/Find/Win2k3.pm +/usr/share/perl5/Config/Find/WinXP.pm +/usr/share/perl5/Config/Find/Win95.pm +/usr/share/perl5/Config/Find/WinCE.pm diff -Nru libconfig-find-perl-0.26/debian/upstream/metadata libconfig-find-perl-0.31/debian/upstream/metadata --- libconfig-find-perl-0.26/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/debian/upstream/metadata 2015-08-02 00:40:52.000000000 +0000 @@ -0,0 +1,4 @@ +--- +Archive: CPAN +Contact: Salvador Fandino +Name: Config-Find diff -Nru libconfig-find-perl-0.26/debian/watch libconfig-find-perl-0.31/debian/watch --- libconfig-find-perl-0.26/debian/watch 2013-05-26 14:22:24.000000000 +0000 +++ libconfig-find-perl-0.31/debian/watch 2015-08-02 00:40:52.000000000 +0000 @@ -1,2 +1,2 @@ version=3 -https://metacpan.org/release/Config-Find/ .*/Config-Find-v?(\d[\d.-]*)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$ +https://metacpan.org/release/Config-Find .*/Config-Find-v?(\d[\d.-]*)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$ diff -Nru libconfig-find-perl-0.26/lib/Config/Find/Any.pm libconfig-find-perl-0.31/lib/Config/Find/Any.pm --- libconfig-find-perl-0.26/lib/Config/Find/Any.pm 2008-11-24 10:52:14.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/Any.pm 2015-05-26 10:40:10.000000000 +0000 @@ -1,7 +1,5 @@ package Config::Find::Any; -our $VERSION = '0.26'; - use strict; use warnings; @@ -10,44 +8,51 @@ use File::Which; use IO::File; +# private methods sub _find { my ($class, $write, $global, @names)=@_; + for my $n (@names) { - my $fn; - if ($n=~/^(.*?)\/(.*)$/) { - my ($dir, $file)=($1, $2); - $fn=$class->look_for_dir_file($dir, $file, $write, $global); - } - else { - $fn=$class->look_for_file($n, $write, $global); - } - return $fn if defined $fn; + my $fn; + if ($n=~/^(.*?)\/(.*)$/) { + my ($dir, $file)=($1, $2); + $fn=$class->look_for_dir_file($dir, $file, $write, $global); + } else { + $fn=$class->look_for_file($n, $write, $global); + } + return $fn if defined $fn; } + return undef; } sub _open { my ($class, $write, $global, $fn)=@_; + if ($write) { - $class->create_parent_dir($fn); - return IO::File->new($fn, 'w'); + $class->create_parent_dir($fn); + return IO::File->new($fn, 'w'); } + defined($fn) ? IO::File->new($fn, 'r') : undef; } sub _install { my ($class, $orig, $write, $global, $fn)=@_; croak "install mode has to be 'write'" unless $write; + my $oh=IO::File->new($orig, 'r') - or croak "unable to open '$orig'"; + or croak "unable to open '$orig'"; my $fh=$class->_open($write, $global, $fn) - or croak "unable to create config file '$fn'"; + or croak "unable to create config file '$fn'"; + while(<$oh>) { $fh->print($_) } + close $fh - or die "unable to write config file '$fn'"; + or die "unable to write config file '$fn'"; close $oh - or die "unable to read '$orig'"; + or die "unable to read '$orig'"; return $fn; } @@ -57,29 +62,40 @@ my $stemp=$class->system_temp; if ($scope eq 'global') { - $class->my_catdir($stemp, $name, $more_name) - } - elsif ($scope eq 'user') { - $class->my_catdir($stemp, $class->my_getlogin, $name, $more_name) - } - elsif ($scope eq 'app') { - $class->my_catdir($class->app_dir($name), 'tmp', $more_name) - } - elsif ($scope eq 'process') { - $class->my_catdir($stemp, $class->my_getlogin, $name, $$, $more_name) - } - else { - croak "scope '$scope' is not valid for temp_dir method"; + $class->my_catdir($stemp, $name, $more_name) + } elsif ($scope eq 'user') { + $class->my_catdir($stemp, $class->my_getlogin, $name, $more_name) + } elsif ($scope eq 'app') { + $class->my_catdir($class->app_dir($name), 'tmp', $more_name) + } elsif ($scope eq 'process') { + $class->my_catdir($stemp, $class->my_getlogin, $name, $$, $more_name) + } else { + croak "scope '$scope' is not valid for temp_dir method"; } } +# public methods, to be overridden + +sub look_for_file { + my $class=shift; + die "unimplemented virtual method $class->look_for_file() called"; +} + +sub look_for_dir_file { + my $class=shift; + die "unimplemented virtual method $class->look_for_dir_file() called"; +} + +# public methods, inherited by sub-classes + sub guess_full_script_name { my $path = (File::Spec->splitpath($0))[1]; if ($path eq '') { - if (my $script=File::Which::which($0)) { - return File::Spec->rel2abs($script); - } + if (my $script = File::Which::which($0)) { + return File::Spec->rel2abs($script); + } } + return File::Spec->rel2abs($0) if -e $0; carp "unable to determine script '$0' location"; @@ -112,15 +128,14 @@ my ($class, $fn)=@_; my $parent=$class->parent_dir($fn); if (-e $parent) { - -d $parent or - croak "'$parent' exists but is not a directory"; - -W $parent or - croak "not allowed to write on directory '$parent'"; - } - else { - $class->create_parent_dir($parent); - mkdir $parent or - die "unable to create directory '$parent' ($!)"; + -d $parent + or croak "'$parent' exists but is not a directory"; + -W $parent + or croak "not allowed to write on directory '$parent'"; + } else { + $class->create_parent_dir($parent); + mkdir $parent + or die "unable to create directory '$parent' ($!)"; } } @@ -135,26 +150,15 @@ sub create_dir { my ($class, $dir)=@_; if (-e $dir) { - -d $dir or croak "'$dir' exists but is not a directory"; - } - else { - $class->create_parent_dir($dir); - mkdir $dir or - die "unable to create directory '$dir' ($!)"; + -d $dir or croak "'$dir' exists but is not a directory"; + } else { + $class->create_parent_dir($dir); + mkdir $dir + or die "unable to create directory '$dir' ($!)"; } $dir; } -sub look_for_file { - my $class=shift; - die "unimplemented virtual method $class->look_for_file() called"; -} - -sub look_for_dir_file { - my $class=shift; - die "unimplemented virtual method $class->look_for_dir_file() called"; -} - sub my_catfile { my $class=shift; pop @_ unless defined $_[-1]; @@ -177,6 +181,8 @@ __END__ +=encoding latin1 + =head1 NAME Config::Find::Any - Perl base class for Config::Find @@ -193,7 +199,10 @@ =head1 DESCRIPTION Every L class has to be derived from this one and two -methods have to be redefined: +methods have to be redefined, while the remainder can be utilized by the +class as required. + +=head2 OVERRIDE METHODS =over 4 @@ -203,9 +212,33 @@ =back -=head2 EXPORT +=head2 CLASS METHODS + +=over 4 + +=item $class->guess_full_script_name($file) + +=item $class->guess_script_name($file) -None. +=item $class->guess_script_dir($file) + +=item $class->is_one_liner($file) + +=item $class->add_extension($name, $extension) + +=item $class->create_parent_dir($file) + +=item $class->parent_dir($dir) + +=item $class->create_dir($dir) + +=item $class->my_catfile($path,$to,$file,...) + +=item $class->my_catdir($path,$to,$dir,...) + +=item $class->my_getlogin() + +=back =head1 SEE ALSO @@ -213,11 +246,16 @@ =head1 AUTHOR -Salvador FandiEo, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003-2005 by Salvador FandiEo +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/Unix.pm libconfig-find-perl-0.31/lib/Config/Find/Unix.pm --- libconfig-find-perl-0.26/lib/Config/Find/Unix.pm 2008-09-17 15:07:09.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/Unix.pm 2015-05-26 10:36:56.000000000 +0000 @@ -1,39 +1,33 @@ package Config::Find::Unix; -use 5.006; - -our $VERSION = '0.23'; - use strict; use warnings; use Carp; - use File::HomeDir; use Config::Find::Any; - - our @ISA=qw(Config::Find::Any); sub app_dir { my ($class, $name)=@_; $name=$class->guess_script_name - unless defined $name; + unless defined $name; my $ename = uc($name).'_HOME'; - if (exists $ENV{$ename}) { - return $ENV{$ename} - } + return $ENV{$ename} if (exists $ENV{$ename}); + $class->parent_dir($class->guess_script_dir); } sub _my_home { my $home = File::HomeDir->my_home; - return $home if defined $home; + return $home if defined $home; + my ($user, $dir) = (getpwuid $>)[0, 7]; - return $dir if defined $dir; - return "/home/$user" if defined $user; + + return $dir if defined $dir; + return "/home/$user" if defined $user; return "/" }; @@ -43,175 +37,167 @@ my ($class, $name, $more_name, $scope) = @_; if ($scope eq 'global') { - $class->my_catfile('/var', $name, $more_name); - } - elsif ($scope eq 'user') { - File::Spec->catfile(_my_home(), '.'.$name, 'var', $more_name); - } - elsif ($scope eq 'app') { - $class->my_catfile($class->app_dir($name), 'var', $more_name); - } - else { - croak "scope '$scope' is not valid for var_dir method"; + $class->my_catfile('/var', $name, $more_name); + } elsif ($scope eq 'user') { + File::Spec->catfile(_my_home(), '.'.$name, 'var', $more_name); + } elsif ($scope eq 'app') { + $class->my_catfile($class->app_dir($name), 'var', $more_name); + } else { + croak "scope '$scope' is not valid for var_dir method"; } } sub _bin_dir { my ($class, $name, $more_name, $scope) = @_; + if ($scope eq 'global') { - '/usr/bin'; - } - elsif ($scope eq 'user') { - File::Spec->catfile(_my_home(), 'bin'); - } - elsif ($scope eq 'app') { - File::Spec->catfile($class->app_dir($name), 'bin'); - } - else { - croak "scope '$scope' is not valid for bin_dir method"; + '/usr/bin'; + } elsif ($scope eq 'user') { + File::Spec->catfile(_my_home(), 'bin'); + } elsif ($scope eq 'app') { + File::Spec->catfile($class->app_dir($name), 'bin'); + } else { + croak "scope '$scope' is not valid for bin_dir method"; } } sub _lib_dir { my ($class, $name, $more_name, $scope) = @_; + if ($scope eq 'global') { - '/usr/lib'; - } - elsif ($scope eq 'user') { - File::Spec->catfile(_my_home(), 'lib'); - } - elsif ($scope eq 'app') { - File::Spec->catfile($class->app_dir($name), 'lib'); - } - else { - croak "scope '$scope' is not valid for lib_dir method"; + '/usr/lib'; + } elsif ($scope eq 'user') { + File::Spec->catfile(_my_home(), 'lib'); + } elsif ($scope eq 'app') { + File::Spec->catfile($class->app_dir($name), 'lib'); + } else { + croak "scope '$scope' is not valid for lib_dir method"; } } sub look_for_file { my ($class, $name, $write, $global)=@_; my $fn; + if ($write) { - if ($global) { - my $fnwe=$class->add_extension($name, 'conf'); + if ($global) { + my $fnwe=$class->add_extension($name, 'conf'); - unless ($class->is_one_liner) { - my $etc=File::Spec->catfile($class->app_dir($name), 'etc'); - return File::Spec->catfile($etc, $fnwe) if -e $etc; - - $etc=File::Spec->catfile($class->app_dir($name), 'conf'); - return File::Spec->catfile($etc, $fnwe) if -e $etc; - } - - return File::Spec->catfile('/etc', $fnwe); - } - else { - return File::Spec->catfile(_my_home(), ".$name"); - } - - } - else { - - # looks in ~/.whatever - unless ($global) { - $fn=File::Spec->catfile(_my_home(), ".$name"); - return $fn if -f $fn; - for my $ext (qw(conf cfg)) { - return "$fn.$ext" if -f "$fn.$ext"; - } - } - - for my $fnwe (map {$class->add_extension($name, $_)} - qw(conf cfg)) { - unless ($class->is_one_liner) { - # looks in ./../etc/whatever.conf relative to the running script - $fn=File::Spec->catfile($class->app_dir($name), 'etc', $fnwe); - return $fn if -f $fn; - - # looks in ./../conf/whatever.conf relative to the running script - $fn=File::Spec->catfile($class->app_dir($name), 'conf', $fnwe); - return $fn if -f $fn; - } - # looks in /etc/whatever.conf - $fn=File::Spec->catfile('/etc', $fnwe); - return $fn if -f $fn; - } + unless ($class->is_one_liner) { + my $etc=File::Spec->catfile($class->app_dir($name), 'etc'); + return File::Spec->catfile($etc, $fnwe) if -e $etc; + + $etc=File::Spec->catfile($class->app_dir($name), 'conf'); + return File::Spec->catfile($etc, $fnwe) if -e $etc; + } + + return File::Spec->catfile('/etc', $fnwe); + } + + return File::Spec->catfile(_my_home(), ".$name"); + + } else { + + # looks in ~/.whatever + unless ($global) { + $fn=File::Spec->catfile(_my_home(), ".$name"); + return $fn if -f $fn; + for my $ext (qw(conf cfg)) { + return "$fn.$ext" if -f "$fn.$ext"; + } + } + + for my $fnwe (map {$class->add_extension($name, $_)} qw(conf cfg)) { + unless ($class->is_one_liner) { + # looks in ./../etc/whatever.conf relative to the running script + $fn=File::Spec->catfile($class->app_dir($name), 'etc', $fnwe); + return $fn if -f $fn; + + # looks in ./../conf/whatever.conf relative to the running script + $fn=File::Spec->catfile($class->app_dir($name), 'conf', $fnwe); + return $fn if -f $fn; + } + + # looks in /etc/whatever.conf + $fn=File::Spec->catfile('/etc', $fnwe); + return $fn if -f $fn; + } } - return undef; + + return; } sub look_for_helper { my ($class, $dir, $helper)=@_; my $path=File::Spec->catfile($dir, $helper); - -e $path or - croak "helper '$helper' not found"; - ((-f $path or -l $path) and -x $path) or - croak "helper '$helper' found at '$path' but it is not executable"; + -e $path + or croak "helper '$helper' not found"; + ((-f $path or -l $path) and -x $path) + or croak "helper '$helper' found at '$path' but it is not executable"; return $path } sub look_for_dir_file { my ($class, $dir, $name, $write, $global)=@_; my $fn; + if ($write) { - my $fnwe=$class->add_extension($name, 'conf'); - if ($global) { - unless ($class->is_one_liner) { - my $etc=File::Spec->catfile($class->app_dir($dir), 'etc'); - return File::Spec->catfile($etc, $dir, $fnwe) if -e $etc; - - $etc=File::Spec->catfile($class->app_dir($dir), 'conf'); - return File::Spec->catfile($etc, $dir, $fnwe) if -e $etc; - } - - return File::Spec->catfile('/etc', $dir, $fnwe); - - } - else { - return File::Spec->catfile(_my_home(), ".$dir", $fnwe); - } - } - else { - # looks in ~/.whatever - for my $fnwe (map {$class->add_extension($name, $_)} - qw(conf cfg)) { - - unless ($global) { - my $fn=File::Spec->catfile(_my_home(), ".$dir", $fnwe); - return $fn if -f $fn; - } - - unless ($class->is_one_liner and not defined $dir) { - # looks in ./../etc/whatever.conf relative to the running script - $fn=File::Spec->catfile($class->app_dir($dir), 'etc', $dir, $fnwe); - return $fn if -f $fn; - - # looks in ./../conf/whatever.conf relative to the running script - $fn=File::Spec->catfile($class->app_dir($dir), 'conf', $dir, $fnwe); - return $fn if -f $fn; - } - - # looks in system /etc/whatever.conf - $fn=File::Spec->catfile('/etc', $dir, $fnwe); - return $fn if -f $fn; - } + my $fnwe=$class->add_extension($name, 'conf'); + if ($global) { + unless ($class->is_one_liner) { + my $etc=File::Spec->catfile($class->app_dir($dir), 'etc'); + return File::Spec->catfile($etc, $dir, $fnwe) if -e $etc; + + $etc=File::Spec->catfile($class->app_dir($dir), 'conf'); + return File::Spec->catfile($etc, $dir, $fnwe) if -e $etc; + } + + return File::Spec->catfile('/etc', $dir, $fnwe); + } + + return File::Spec->catfile(_my_home(), ".$dir", $fnwe); + + } else { + # looks in ~/.whatever + for my $fnwe (map {$class->add_extension($name, $_)} qw(conf cfg)) { + + unless ($global) { + my $fn=File::Spec->catfile(_my_home(), ".$dir", $fnwe); + return $fn if -f $fn; + } + + unless ($class->is_one_liner and not defined $dir) { + # looks in ./../etc/whatever.conf relative to the running script + $fn=File::Spec->catfile($class->app_dir($dir), 'etc', $dir, $fnwe); + return $fn if -f $fn; + + # looks in ./../conf/whatever.conf relative to the running script + $fn=File::Spec->catfile($class->app_dir($dir), 'conf', $dir, $fnwe); + return $fn if -f $fn; + } + + # looks in system /etc/whatever.conf + $fn=File::Spec->catfile('/etc', $dir, $fnwe); + return $fn if -f $fn; + } } - return undef; -} - - + return; +} 1; + __END__ +=encoding latin1 + =head1 NAME Config::Find::Unix - Config::Find plugin for Unixen =head1 SYNOPSIS - # don't use Config::Find::Unix; + # don't use Config::Find::Unix directly use Config::Find; =head1 ABSTRACT @@ -241,8 +227,7 @@ instead. - -When the "several configuration files in one directory" aproach is +When the "several configuration files in one directory" approach is used, the order is somewhat different: 1 ~/.$dir/$name.conf [user] @@ -252,22 +237,22 @@ (also affected by C<$ENV{${name}_HOME}>) - -=head2 EXPORT - -None. - =head1 SEE ALSO L, L. =head1 AUTHOR -Salvador Fandiño García, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño García +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/Where.pm libconfig-find-perl-0.31/lib/Config/Find/Where.pm --- libconfig-find-perl-0.26/lib/Config/Find/Where.pm 2008-11-12 10:41:54.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/Where.pm 2015-05-26 10:36:54.000000000 +0000 @@ -1,47 +1,43 @@ package Config::Find::Where; -our $VERSION = '0.24'; - use strict; use warnings; use Carp; - use Config::Find; our @ISA=@Config::Find::ISA; - sub temp_dir { my $class = shift; my ($name, $more_name, $create, $dn, $scope)= - $class->parse_opts(scope=> 'user', @_); + $class->parse_opts(scope=> 'user', @_); $class->create_dir_if( (defined $dn - ? $dn - : $class->_temp_dir($name, $more_name, $scope)), - $create) + ? $dn + : $class->_temp_dir($name, $more_name, $scope)), + $create) } sub var_dir { my $class = shift; my ($name, $more_name, $create, $dn, $scope)= - $class->parse_opts(scope => 'app', @_); + $class->parse_opts(scope => 'app', @_); $class->create_dir_if( (defined $dn - ? $dn - : $class->_var_dir($name, $more_name, $scope) ), - $create) + ? $dn + : $class->_var_dir($name, $more_name, $scope) ), + $create) } sub bin_dir { my $class = shift; my ($name, $more_name, $create, $dn, $scope)= - $class->parse_opts(scope=> 'app', @_); + $class->parse_opts(scope=> 'app', @_); $class->create_dir_if( (defined $dn - ? $dn - : $class->_bin_dir($name, $more_name, $scope) ), - $create); + ? $dn + : $class->_bin_dir($name, $more_name, $scope) ), + $create); } sub lib_dir { @@ -58,19 +54,19 @@ sub application_dir { my $class=shift; my ($name, $more_name, $create, $dn, $scope)= - $class->parse_opts(@_); + $class->parse_opts(@_); $class->create_dir_if( (defined $dn - ? $dn - : $class->app_dir($name) ), - $create) + ? $dn + : $class->app_dir($name) ), + $create) } sub create_dir_if { my ($class, $dir, $create)=@_; # warn ("$class->create_dir($dir, $create)"); if ($create) { - $class->create_dir($dir); + $class->create_dir($dir); } $dir; } @@ -105,39 +101,39 @@ $create=$opts{create}; if (defined $opts{name}) { - $opts{name}=~m{^([^/]*)(?:/(.*))?$} - or croak "invalid name '$opts{name}' specification"; - $name=$1; - $more_name=$2; - } - else { - $name=$class->guess_script_name; + $opts{name}=~m{^([^/]*)(?:/(.*))?$} + or croak "invalid name '$opts{name}' specification"; + $name=$1; + $more_name=$2; + } else { + $name=$class->guess_script_name; } if (defined $opts{scope}) { - if ($opts{scope}=~/^u(ser)?$/i) { - $scope='user' - } - elsif ($opts{scope}=~/^g(lobal)?$/i) { - $scope='global' - } - elsif ($opts{scope}=~/^a(pp(lication)?)?$/i) { - $scope='app' - } - elsif ($opts{scope}=~/^p(rocess)?$/i) { - $scope='process' - } - else { - croak "invalid option scope => '$opts{scope}'"; - } - } - else { - $scope='global'; + if ($opts{scope}=~/^u(ser)?$/i) { + $scope='user' + } elsif ($opts{scope}=~/^g(lobal)?$/i) { + $scope='global' + } elsif ($opts{scope}=~/^a(pp(lication)?)?$/i) { + $scope='app' + } elsif ($opts{scope}=~/^p(rocess)?$/i) { + $scope='process' + } else { + croak "invalid option scope => '$opts{scope}'"; + } + } else { + $scope='global'; } return ($name, $more_name, $create, $dn, $scope); } +1; + +__END__ + +=encoding latin1 + =head1 NAME Config::Find::Where - Find locations in the native OS fashion @@ -153,10 +149,9 @@ my $path=Config::Find::Where->bin_dir( scope => 'app' ); system $path."/app_helper.exe"; - =head1 ABSTRACT -Config::Find searchs for locations using OS dependant heuristics. +Config::Find searches for locations using OS dependant heuristics. =head1 DESCRIPTION @@ -164,7 +159,7 @@ reused to also find other interesting things like temporary directories, the script location, etc. -This module adds a public API to all the hiden functionallity. +This module adds a public API to all the hidden functionality. =head2 OPTIONS @@ -184,7 +179,7 @@ =item create => 1 -creates any unexistant directory in the path returned +creates any nonexistent directory in the path returned =back @@ -216,7 +211,6 @@ The default scope for this method is C. - =item $path=Config::Find::Where-Ebin_dir(%opts) returns a place to find/place binary files. The default scope for this @@ -270,34 +264,40 @@ =item Config::Find::Where-Ecreate_parent_dir($file) -recursively creates all the non existant parent dirs for C<$file>. - -=back +recursively creates all the nonexistent parent directories for +C<$file>. +=item Config::Find::Where-Ehelper_path($file, %opts) -=head2 EXPORT - -None, this module has an OO interface. +searches for a script, based on the directories given in %opts, which are the +same as bin_dir() method. +=back =head1 BUGS -Some Win32 OSs are not completely implemented and default to inferior -modes, but hey, this is a work in progress!!! +Some Win32 operating systems are not completely implemented and +default to inferior modes, but hey, this is a work in progress!!! Contributions, bug reports, feedback and any kind of comments are welcome. - =head1 SEE ALSO L +=head1 AUTHOR + +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003-2008 by Salvador FandiEo GarcEa -(sfandino@yahoo.com) +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/Win2k3.pm libconfig-find-perl-0.31/lib/Config/Find/Win2k3.pm --- libconfig-find-perl-0.26/lib/Config/Find/Win2k3.pm 2005-12-11 16:46:35.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/Win2k3.pm 2015-05-26 10:36:51.000000000 +0000 @@ -1,7 +1,5 @@ package Config::Find::Win2k3; -our $VERSION = '0.01'; - use strict; use warnings; @@ -12,13 +10,15 @@ 1; __END__ +=encoding latin1 + =head1 NAME Config::Find::Win2k - Win2k idiosyncrasies for Config::Find =head1 SYNOPSIS - # don't use Config::Find::Win2k3; + # don't use Config::Find::Win2k3 directly use Config::Find; =head1 ABSTRACT @@ -27,14 +27,8 @@ =head1 DESCRIPTION -Stub documentation for Config::Find::Win2003, created by h2xs. - - -=head2 EXPORT - -None by default. - - +Contains any idiosyncrasies found within Win2003, that do not apply to the +standard Win32 base. =head1 SEE ALSO @@ -42,11 +36,16 @@ =head1 AUTHOR -Salvador Fandiño, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/Win2k.pm libconfig-find-perl-0.31/lib/Config/Find/Win2k.pm --- libconfig-find-perl-0.26/lib/Config/Find/Win2k.pm 2005-12-11 16:46:35.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/Win2k.pm 2015-05-26 10:36:53.000000000 +0000 @@ -1,7 +1,5 @@ package Config::Find::Win2k; -our $VERSION = '0.01'; - use strict; use warnings; @@ -12,13 +10,15 @@ 1; __END__ +=encoding latin1 + =head1 NAME Config::Find::Win2k - Win2k idiosyncrasies for Config::Find =head1 SYNOPSIS - # don't use Config::Find::Win2k; + # don't use Config::Find::Win2k directly use Config::Find; =head1 ABSTRACT @@ -27,14 +27,8 @@ =head1 DESCRIPTION -Stub documentation for Config::Find::Win2k, created by h2xs. - - -=head2 EXPORT - -None by default. - - +Contains any idiosyncrasies found within Win2k, that do not apply to the +standard Win32 base. =head1 SEE ALSO @@ -42,11 +36,16 @@ =head1 AUTHOR -Salvador Fandiño, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/Win7.pm libconfig-find-perl-0.31/lib/Config/Find/Win7.pm --- libconfig-find-perl-0.26/lib/Config/Find/Win7.pm 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/Win7.pm 2015-05-26 10:36:50.000000000 +0000 @@ -0,0 +1,53 @@ +package Config::Find::Win7; + +use strict; +use warnings; + +use Config::Find::WinAny + +our @ISA = qw(Config::Find::WinAny); + +1; +__END__ + +=encoding latin1 + +=head1 NAME + +Config::Find::Win7 - Win7 idiosyncrasies for Config::Find + +=head1 SYNOPSIS + + # don't use Config::Find::Win7 directly + use Config::Find; + +=head1 ABSTRACT + +Implements Win7 specific features for Config::Find + +=head1 DESCRIPTION + +Contains any idiosyncrasies found within Win7, that do not apply to the +standard Win32 base. + +=head1 SEE ALSO + +L, L, L + +=head1 AUTHOR + +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) + +=head1 COPYRIGHT AND LICENSE + +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff -Nru libconfig-find-perl-0.26/lib/Config/Find/Win95.pm libconfig-find-perl-0.31/lib/Config/Find/Win95.pm --- libconfig-find-perl-0.26/lib/Config/Find/Win95.pm 2005-12-11 16:46:35.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/Win95.pm 2015-05-26 10:36:48.000000000 +0000 @@ -1,7 +1,5 @@ package Config::Find::Win95; -our $VERSION = '0.01'; - use strict; use warnings; @@ -12,13 +10,15 @@ 1; __END__ +=encoding latin1 + =head1 NAME Config::Find::Win95 - Win95 idiosyncrasies for Config::Find =head1 SYNOPSIS - # don't use Config::Find::Win95; + # don't use Config::Find::Win95 directly use Config::Find; =head1 ABSTRACT @@ -27,14 +27,8 @@ =head1 DESCRIPTION -Stub documentation for Config::Find::Win95, created by h2xs. - - -=head2 EXPORT - -None by default. - - +Contains any idiosyncrasies found within Win95, that do not apply to the +standard Win32 base. =head1 SEE ALSO @@ -42,11 +36,16 @@ =head1 AUTHOR -Salvador Fandiño, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/Win98.pm libconfig-find-perl-0.31/lib/Config/Find/Win98.pm --- libconfig-find-perl-0.26/lib/Config/Find/Win98.pm 2005-12-11 16:46:35.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/Win98.pm 2015-05-26 10:36:46.000000000 +0000 @@ -1,7 +1,5 @@ package Config::Find::Win98; -our $VERSION = '0.01'; - use strict; use warnings; @@ -10,15 +8,18 @@ our @ISA = qw(Config::Find::WinAny); 1; + __END__ +=encoding latin1 + =head1 NAME Config::Find::Win98 - Win98 idiosyncrasies for Config::Find =head1 SYNOPSIS - # don't use Config::Find::Win98; + # don't use Config::Find::Win98 directly use Config::Find; =head1 ABSTRACT @@ -27,14 +28,8 @@ =head1 DESCRIPTION -Stub documentation for Config::Find::Win98, created by h2xs. - - -=head2 EXPORT - -None by default. - - +Contains any idiosyncrasies found within Win98, that do not apply to the +standard Win32 base. =head1 SEE ALSO @@ -42,11 +37,16 @@ =head1 AUTHOR -Salvador Fandiño, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/WinAny.pm libconfig-find-perl-0.31/lib/Config/Find/WinAny.pm --- libconfig-find-perl-0.26/lib/Config/Find/WinAny.pm 2005-12-11 16:46:35.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/WinAny.pm 2015-05-26 10:36:45.000000000 +0000 @@ -1,16 +1,14 @@ package Config::Find::WinAny; -our $VERSION = '0.18'; - use strict; use warnings; use Carp; - use Config::Find::Any; -use Win32 qw(CSIDL_LOCAL_APPDATA - CSIDL_APPDATA - CSIDL_DESKTOPDIRECTORY); +use Win32 qw( + CSIDL_LOCAL_APPDATA + CSIDL_APPDATA + CSIDL_DESKTOPDIRECTORY); our @ISA = qw(Config::Find::Any); @@ -18,12 +16,10 @@ my ($class, $name)=@_; $name=$class->guess_script_name - unless defined $name; + unless defined $name; my $ename = uc($name).'_HOME'; - if (exists $ENV{$ename}) { - return $ENV{$ename} - } + return $ENV{$ename} if (exists $ENV{$ename}); $class->guess_script_dir; } @@ -33,30 +29,26 @@ my $windesktop=Win32::GetFolderPath(CSIDL_DESKTOPDIRECTORY); if (defined $windesktop and $windesktop ne '') { - undef $winlocalappdir if (defined($winlocalappdir) and index($winlocalappdir, $windesktop) == 0); - undef $winappdir if (defined($winappdir) and index($winappdir, $windesktop) == 0); + undef $winlocalappdir if (defined($winlocalappdir) and index($winlocalappdir, $windesktop) == 0); + undef $winappdir if (defined($winappdir) and index($winappdir, $windesktop) == 0); } sub app_user_dir { my ($class, $name)=@_; return ( (defined $winlocalappdir) && ($winlocalappdir ne "") ? $winlocalappdir : - (defined $winappdir) && ($winappdir ne "") ? $winappdir : - File::Spec->catdir($class->app_dir($name), - 'Users', - $class->my_getlogin)); + (defined $winappdir) && ($winappdir ne "") ? $winappdir : + File::Spec->catdir($class->app_dir($name), + 'Users', + $class->my_getlogin)); } sub system_temp { my $class=shift; - return $ENV{TEMP} - if defined $ENV{TEMP}; + return $ENV{TEMP} if defined $ENV{TEMP}; + return $ENV{TMP} if defined $ENV{TMP}; - return $ENV{TMP} - if defined $ENV{TMP}; - - return File::Spec->catfile($ENV{windir}, 'Temp') - if defined $ENV{windir}; + return File::Spec->catfile($ENV{windir}, 'Temp') if defined $ENV{windir}; return 'C:\Temp'; } @@ -64,35 +56,33 @@ sub _var_dir { my ($class, $name, $more_name, $scope)=@_; if ($scope eq 'user') { - File::Spec->catdir($class->app_user_dir($name), $name, 'Data', $more_name) - } - else { - File::Spec->catdir($class->app_dir($name), 'Data', $more_name); + File::Spec->catdir($class->app_user_dir($name), $name, 'Data', $more_name) + } else { + File::Spec->catdir($class->app_dir($name), 'Data', $more_name); } } sub _bin_dir { my ($class, $name, $more_name, $scope)=@_; if ($scope eq 'app') { - $class->app_dir($name); - } - else { - die "unimplemented option scope => $scope"; + $class->app_dir($name); + } else { + die "unimplemented option scope => $scope"; } } sub look_for_helper { - my ($class, $dir, $helper)=@_; my @ext=('', ( defined $ENV{PATHEXT} - ? (split /;/, $ENV{PATHEXT}) - : qw(.COM .EXE .BAT .CMD))); + ? (split /;/, $ENV{PATHEXT}) + : qw(.COM .EXE .BAT .CMD))); for my $ext (@ext) { - my $path=File::Spec->catfile($dir, $helper.$ext); - -e $path and -x $path and return $path; + my $path=File::Spec->catfile($dir, $helper.$ext); + -e $path and -x $path and return $path; } + croak "helper '$helper' not found"; } @@ -100,64 +90,61 @@ my ($class, $name, $write, $global)=@_; my $fn; my $fnwe=$class->add_extension($name, 'cfg'); + if ($write) { - if ($global) { - return File::Spec->catfile($class->app_dir($name), $fnwe) - } - else { - # my $login=getlogin(); - return File::Spec->catfile($class->app_user_dir($name), - $fnwe ); - } - } - else { - unless ($global) { - $fn=File::Spec->catfile($class->app_user_dir, $fnwe ); - return $fn if -f $fn; - } - $fn=File::Spec->catfile($class->app_dir($name), $fnwe); - return $fn if -f $fn; + return File::Spec->catfile($class->app_dir($name), $fnwe) if ($global); + # my $login=getlogin(); + return File::Spec->catfile($class->app_user_dir($name), $fnwe ); + + } else { + unless ($global) { + $fn=File::Spec->catfile($class->app_user_dir, $fnwe ); + return $fn if -f $fn; + } + + $fn=File::Spec->catfile($class->app_dir($name), $fnwe); + return $fn if -f $fn; } - return undef; + + return; } sub look_for_dir_file { my ($class, $dir, $name, $write, $global)=@_; my $fn; my $fnwe=$class->add_extension($name, 'cfg'); + if ($write) { - if ($global) { - return File::Spec->catfile($class->app_dir($dir), $dir, $fnwe) - } - else { - # my $login=getlogin(); - return File::Spec->catfile($class->app_user_dir($dir), - $dir, $fnwe ); - } - } - else { - unless ($global) { - $fn=File::Spec->catfile($class->app_user_dir($name), - $dir, $fnwe ); - return $fn if -f $fn; - } - $fn=File::Spec->catfile($class->app_dir($name), - $fnwe); - return $fn if -f $fn; + return File::Spec->catfile($class->app_dir($dir), $dir, $fnwe) if ($global); + + # my $login=getlogin(); + return File::Spec->catfile($class->app_user_dir($dir), $dir, $fnwe ); + + } else { + unless ($global) { + $fn=File::Spec->catfile($class->app_user_dir($name), $dir, $fnwe ); + return $fn if -f $fn; + } + $fn=File::Spec->catfile($class->app_dir($name), $fnwe); + return $fn if -f $fn; } - return undef; + + return; } 1; + __END__ +=encoding latin1 + =head1 NAME Config::Find::WinAny - Behaviours common to any Win32 OS for Config::Find =head1 SYNOPSIS - # don't use Config::Find::WinAny; + # don't use Config::Find::WinAny directly use Config::Find; =head1 ABSTRACT @@ -185,7 +172,7 @@ 2 $ENV{${name}_HOME}/$name.cfg [global] -When the "several configuration files in one directory" aproach is +When the "several configuration files in one directory" approach is used, the order is something different... 1 ${LOCAL_APPDATA}/$dir/$name.cfg [user] @@ -200,29 +187,31 @@ configuration data under ${LOCAL_APPDATA} as returned by C (if this call fails, the old approach is used). Also, global configuration files were stored -under a new directory placed in the same dir as the script but this is -unnecesary because windows apps already go in their own directory. +under a new directory placed in the same directory as the script but +this is unnecessary because windows apps already go in their own +directory. It seems that, sometimes, ${LOCAL_APPDATA} points to the user desktop -and placing configuration files there would be obviusly wrong. As a +and placing configuration files there would be obviously wrong. As a work around, the module will ignore ${LOCAL_APPDATA} or ${APPDATA} if they point to any place below the desktop path. -=head2 EXPORT - -None by default. - =head1 SEE ALSO L, L =head1 AUTHOR -Salvador Fandiño, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/WinCE.pm libconfig-find-perl-0.31/lib/Config/Find/WinCE.pm --- libconfig-find-perl-0.26/lib/Config/Find/WinCE.pm 2005-12-11 16:46:35.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/WinCE.pm 2015-05-26 10:36:43.000000000 +0000 @@ -1,7 +1,5 @@ package Config::Find::WinCE; -our $VERSION = '0.01'; - use strict; use warnings; @@ -10,15 +8,18 @@ our @ISA = qw(Config::Find::WinAny); 1; + __END__ +=encoding latin1 + =head1 NAME Config::Find::WinCE - WinCE idiosyncrasies for Config::Find =head1 SYNOPSIS - # don't use Config::Find::WinCE; + # don't use Config::Find::WinCE directly use Config::Find; =head1 ABSTRACT @@ -27,14 +28,8 @@ =head1 DESCRIPTION -Stub documentation for Config::Find::WinCE, created by h2xs. - - -=head2 EXPORT - -None by default. - - +Contains any idiosyncrasies found within WinCE, that do not apply to the +standard Win32 base. =head1 SEE ALSO @@ -42,11 +37,16 @@ =head1 AUTHOR -Salvador Fandiño, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/WinME.pm libconfig-find-perl-0.31/lib/Config/Find/WinME.pm --- libconfig-find-perl-0.26/lib/Config/Find/WinME.pm 2005-12-11 16:46:35.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/WinME.pm 2015-05-26 10:36:42.000000000 +0000 @@ -1,7 +1,5 @@ package Config::Find::WinME; -our $VERSION = '0.01'; - use strict; use warnings; @@ -10,15 +8,18 @@ our @ISA = qw(Config::Find::WinAny); 1; + __END__ +=encoding latin1 + =head1 NAME Config::Find::WinME - WinME idiosyncrasies for Config::Find =head1 SYNOPSIS - # don't use Config::Find::WinME; + # don't use Config::Find::WinME directly use Config::Find; =head1 ABSTRACT @@ -27,14 +28,8 @@ =head1 DESCRIPTION -Stub documentation for Config::Find::WinME, created by h2xs. - - -=head2 EXPORT - -None by default. - - +Contains any idiosyncrasies found within WinME, that do not apply to the +standard Win32 base. =head1 SEE ALSO @@ -42,11 +37,16 @@ =head1 AUTHOR -Salvador Fandiño, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/WinNT.pm libconfig-find-perl-0.31/lib/Config/Find/WinNT.pm --- libconfig-find-perl-0.26/lib/Config/Find/WinNT.pm 2005-12-11 16:46:35.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/WinNT.pm 2015-05-26 10:36:40.000000000 +0000 @@ -1,7 +1,5 @@ package Config::Find::WinNT; -our $VERSION = '0.01'; - use strict; use warnings; @@ -10,15 +8,18 @@ our @ISA = qw(Config::Find::WinAny); 1; + __END__ +=encoding latin1 + =head1 NAME Config::Find::WinNT - WinNT idiosyncrasies for Config::Find =head1 SYNOPSIS - # don't use Config::Find::WinNT; + # don't use Config::Find::WinNT directly use Config::Find; =head1 ABSTRACT @@ -27,14 +28,8 @@ =head1 DESCRIPTION -Stub documentation for Config::Find::WinNT, created by h2xs. - - -=head2 EXPORT - -None by default. - - +Contains any idiosyncrasies found within WinNT, that do not apply to the +standard Win32 base. =head1 SEE ALSO @@ -42,11 +37,16 @@ =head1 AUTHOR -Salvador Fandiño, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find/WinXP.pm libconfig-find-perl-0.31/lib/Config/Find/WinXP.pm --- libconfig-find-perl-0.26/lib/Config/Find/WinXP.pm 2005-12-11 16:46:35.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find/WinXP.pm 2015-05-26 10:36:39.000000000 +0000 @@ -1,7 +1,5 @@ package Config::Find::WinXP; -our $VERSION = '0.01'; - use strict; use warnings; @@ -10,15 +8,18 @@ our @ISA = qw(Config::Find::WinAny); 1; + __END__ +=encoding latin1 + =head1 NAME Config::Find::WinXP - WinXP idiosyncrasies for Config::Find =head1 SYNOPSIS - # don't use Config::Find::WinXP; + # don't use Config::Find::WinXP directly use Config::Find; =head1 ABSTRACT @@ -27,14 +28,8 @@ =head1 DESCRIPTION -Stub documentation for Config::Find::WinXP, created by h2xs. - - -=head2 EXPORT - -None by default. - - +Contains any idiosyncrasies found within WinXP, that do not apply to the +standard Win32 base. =head1 SEE ALSO @@ -42,11 +37,16 @@ =head1 AUTHOR -Salvador Fandiño, Esfandino@yahoo.comE +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) =head1 COPYRIGHT AND LICENSE -Copyright 2003 by Salvador Fandiño +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/lib/Config/Find.pm libconfig-find-perl-0.31/lib/Config/Find.pm --- libconfig-find-perl-0.26/lib/Config/Find.pm 2008-11-24 10:52:22.000000000 +0000 +++ libconfig-find-perl-0.31/lib/Config/Find.pm 2015-05-26 10:51:54.000000000 +0000 @@ -1,6 +1,6 @@ package Config::Find; -our $VERSION = '0.26'; +our $VERSION = '0.31'; use strict; use warnings; @@ -11,48 +11,45 @@ our @ISA; BEGIN { if ($^O=~/Win32/) { - require Win32; - my $OS=uc Win32::GetOSName(); - - if ($OS=~/^WIN95/) { - require Config::Find::Win95; - @ISA=qw(Config::Find::Win95); - } - elsif ($OS=~/^WIN98/) { - require Config::Find::Win98; - @ISA=qw(Config::Find::Win98); - } - elsif ($OS=~/^WINME/) { - require Config::Find::WinME; - @ISA=qw(Config::Find::WinME); - } - elsif ($OS=~/^WINNT/) { - require Config::Find::WinNT; - @ISA=qw(Config::Find::WinNT); - } - elsif ($OS=~/^WIN2000/) { - require Config::Find::Win2k; - @ISA=qw(Config::Find::Win2k); - } - elsif ($OS=~/^WIN2003/) { - require Config::Find::Win2k3; - @ISA=qw(Config::Find::Win2k3); - } - elsif ($OS=~/^WINXP/) { - require Config::Find::WinXP; - @ISA=qw(Config::Find::WinXP); - } - elsif ($OS=~/^WINCE/) { - require Config::Find::WinCE; - @ISA=qw(Config::Find::WinCE); - } - else { - croak "Unknow MSWin32 OS '$OS'"; - } - } - else { - require Config::Find::Unix; - @ISA=qw(Config::Find::Unix); + require Win32; + my $OS = uc Win32::GetOSName(); + + if ($OS=~/^WIN95/) { + require Config::Find::Win95; + @ISA=qw(Config::Find::Win95); + } elsif ($OS=~/^WIN98/) { + require Config::Find::Win98; + @ISA=qw(Config::Find::Win98); + } elsif ($OS=~/^WINME/) { + require Config::Find::WinME; + @ISA=qw(Config::Find::WinME); + } elsif ($OS=~/^WINNT/) { + require Config::Find::WinNT; + @ISA=qw(Config::Find::WinNT); + } elsif ($OS=~/^WIN2000/) { + require Config::Find::Win2k; + @ISA=qw(Config::Find::Win2k); + } elsif ($OS=~/^WIN2003/) { + require Config::Find::Win2k3; + @ISA=qw(Config::Find::Win2k3); + } elsif ($OS=~/^WINXP/) { + require Config::Find::WinXP; + @ISA=qw(Config::Find::WinXP); + } elsif ($OS=~/^WINCE/) { + require Config::Find::WinCE; + @ISA=qw(Config::Find::WinCE); + } elsif ($OS=~/^WIN7/) { + require Config::Find::Win7; + @ISA=qw(Config::Find::Win7); + } else { + # default to WinAny, and separate exceptions + require Config::Find::WinAny; + @ISA=qw(Config::Find::WinAny); + #croak "Unknown MSWin32 OS '$OS'"; + } + } else { + require Config::Find::Unix; + @ISA=qw(Config::Find::Unix); } } @@ -60,7 +57,7 @@ my $class=shift; my ($write, $global, $fn, @names)=$class->parse_opts(@_); if (defined $fn) { - return ($write or -f $fn) ? $fn : undef; + return ($write or -f $fn) ? $fn : undef; } $class->_find($write, $global, @names); } @@ -75,8 +72,7 @@ sub install { my $class=shift; my $orig=shift; - my ($write, $global, $fn, @names)=$class->parse_opts( mode => 'w', - @_); + my ($write, $global, $fn, @names)=$class->parse_opts( mode => 'w', @_); defined($fn) or $fn=$class->_find($write, $global, @names); $class->_install($orig, $write, $global, $fn); } @@ -86,46 +82,45 @@ my $fn=$opts{file}; my @names; if (exists $opts{name}) { - @names=$opts{name}; - } - elsif (exists $opts{names}) { - UNIVERSAL::isa($opts{names}, 'ARRAY') - or croak "invalid argument for 'names', expecting an array ref"; - @names=@{$opts{names}} - } - else { - @names=$class->guess_script_name(); + @names=$opts{name}; + } elsif (exists $opts{names}) { + UNIVERSAL::isa($opts{names}, 'ARRAY') + or croak "invalid argument for 'names', expecting an array ref"; + @names=@{$opts{names}} + } else { + @names=$class->guess_script_name(); } + my $write; if (exists $opts{mode}) { - if ($opts{mode}=~/^r(ead)?$/i) { - # yes, do nothing! - } - elsif ($opts{mode}=~/w(rite)?$/i) { - $write=1; - } - else { - croak "invalid option mode => '$opts{mode}'"; - } + if ($opts{mode}=~/^r(ead)?$/i) { + # yes, do nothing! + } elsif ($opts{mode}=~/w(rite)?$/i) { + $write=1; + } else { + croak "invalid option mode => '$opts{mode}'"; + } } + my $global; if (exists $opts{scope}) { - if ($opts{scope}=~/^u(ser)?$/i) { - # yes, do nothing! - } - elsif ($opts{scope}=~/g(lobal)?$/i) { - $global=1; - } - else { - croak "invalid option scope => '$opts{scope}'"; - } + if ($opts{scope}=~/^u(ser)?$/i) { + # yes, do nothing! + } elsif ($opts{scope}=~/g(lobal)?$/i) { + $global=1; + } else { + croak "invalid option scope => '$opts{scope}'"; + } } return ($write, $global, $fn, @names) } 1; + __END__ +=encoding latin1 + =head1 NAME Config::Find - Find configuration files in the native OS fashion @@ -157,13 +152,13 @@ =head1 ABSTRACT -Config::Find searchs for configuration files using OS dependant +Config::Find searches for configuration files using OS dependant heuristics. =head1 DESCRIPTION Every OS has different rules for configuration files placement, this -module allows to easily find and create your app configuration files +module allows one to easily find and create your app configuration files following those rules. Config::Find references configuration files by the application name or @@ -197,7 +192,7 @@ explicit position of the configuration file. If undef is passed this entry is ignored and the search for the -configuration file continues with the apropiate OS rules. This allows +configuration file continues with the appropriate OS rules. This allows for: use Config::Find; @@ -223,7 +218,7 @@ =item mode => C or C -In C mode already existant file names are returned, in C +In C mode already existent file names are returned, in C mode the file names point to where the configuration file has to be stored. @@ -243,7 +238,7 @@ =item $fh=Config::Find-Eopen(%opts) returns a open file handle for the configuration file. In write mode, -the file and any nonexistant parent directories are created. +the file and any nonexistent parent directories are created. =item $fn=Config::Find-Einstall($original, %opts) @@ -251,17 +246,12 @@ =back -=head2 EXPORT - -None, this module has an OO interface. - =head1 BUGS -Some Win32 OSs are not completely implemented and default to inferior -modes, but hey, this is a work in progress!!! +Some Win32 operating systems are not completely implemented and +default to inferior modes, but hey, this is a work in progress!!! -Contributions, bug reports, feedback and any kind of comments are -welcome. +Contributions, bug reports, feedback and any kind of comments are welcome. =head1 SEE ALSO @@ -273,10 +263,18 @@ L give me the idea for this module. +=head1 AUTHOR + +Salvador FandiEo GarcEa, Esfandino@yahoo.comE + +=head1 CONTRIBUTORS + +Barbie, Ebarbie@missbarbell.co.ukE (some bug fixes and documentation) + =head1 COPYRIGHT AND LICENSE -Copyright 2003-2008 by Salvador FandiEo GarcEa -(sfandino@yahoo.com) +Copyright 2003-2015 by Salvador FandiEo GarcEa (sfandino@yahoo.com) +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/Makefile.PL libconfig-find-perl-0.31/Makefile.PL --- libconfig-find-perl-0.26/Makefile.PL 2008-11-20 14:58:17.000000000 +0000 +++ libconfig-find-perl-0.31/Makefile.PL 2015-05-26 10:16:05.000000000 +0000 @@ -1,11 +1,19 @@ +#!/usr/bin/perl + +use strict; +use warnings; use 5.006; use ExtUtils::MakeMaker; -WriteMakefile( NAME => 'Config::Find', +WriteMakefile( AUTHOR => 'Salvador Fandino ', + NAME => 'Config::Find', VERSION_FROM => 'lib/Config/Find.pm', - PREREQ_PM => {'File::Which' => 0, - 'File::Spec' => 0, - 'File::HomeDir' => 0 }, - AUTHOR => 'Salvador Fandino ' ); - + ABSTRACT => 'Find configuration files in the native OS fashion', + PREREQ_PM => {# prereqs + 'File::Which' => '0', + 'File::Spec' => '0', + 'File::HomeDir' => '0', + # build/test prereqs + 'Test::More' => '0.70', + 'IO::File' => '0' } ); diff -Nru libconfig-find-perl-0.26/MANIFEST libconfig-find-perl-0.31/MANIFEST --- libconfig-find-perl-0.26/MANIFEST 2005-12-11 16:46:36.000000000 +0000 +++ libconfig-find-perl-0.31/MANIFEST 2015-05-26 11:43:32.000000000 +0000 @@ -1,10 +1,11 @@ Changes -lib/Config/Find/Any.pm lib/Config/Find.pm +lib/Config/Find/Any.pm lib/Config/Find/Unix.pm lib/Config/Find/Where.pm lib/Config/Find/Win2k.pm lib/Config/Find/Win2k3.pm +lib/Config/Find/Win7.pm lib/Config/Find/Win95.pm lib/Config/Find/Win98.pm lib/Config/Find/WinAny.pm @@ -15,7 +16,18 @@ Makefile.PL MANIFEST README -t/1.t -t/2_where.t -t/3_pods.t -META.yml Module meta-data (added by MakeMaker) +t/01load.t +t/10find.t +t/90podtest.t +t/91podcover.t +t/94metatest.t +t/95changedate.t +t/96metatest.t +t/data/.test1 +t/data/.test2 +t/data/.test3 +t/data/test1.cfg +t/data/test2.cfg +t/data/test3.cfg +META.yml Module YAML meta-data (added by MakeMaker) +META.json Module JSON meta-data (added by MakeMaker) diff -Nru libconfig-find-perl-0.26/META.json libconfig-find-perl-0.31/META.json --- libconfig-find-perl-0.26/META.json 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/META.json 2015-05-26 11:43:32.000000000 +0000 @@ -0,0 +1,45 @@ +{ + "abstract" : "Find configuration files in the native OS fashion", + "author" : [ + "Salvador Fandino " + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001", + "license" : [ + "unknown" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Config-Find", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "prereqs" : { + "build" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "runtime" : { + "requires" : { + "File::HomeDir" : "0", + "File::Spec" : "0", + "File::Which" : "0", + "IO::File" : "0", + "Test::More" : "0.70" + } + } + }, + "release_status" : "stable", + "version" : "0.31" +} diff -Nru libconfig-find-perl-0.26/META.yml libconfig-find-perl-0.31/META.yml --- libconfig-find-perl-0.26/META.yml 2008-11-24 10:53:38.000000000 +0000 +++ libconfig-find-perl-0.31/META.yml 2015-05-26 11:43:32.000000000 +0000 @@ -1,16 +1,26 @@ ---- #YAML:1.0 -name: Config-Find -version: 0.26 -abstract: ~ -license: ~ -author: - - Salvador Fandino -generated_by: ExtUtils::MakeMaker version 6.42 -distribution_type: module -requires: - File::HomeDir: 0 - File::Spec: 0 - File::Which: 0 +--- +abstract: 'Find configuration files in the native OS fashion' +author: + - 'Salvador Fandino ' +build_requires: + ExtUtils::MakeMaker: '0' +configure_requires: + ExtUtils::MakeMaker: '0' +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001' +license: unknown meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.3.html - version: 1.3 + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: '1.4' +name: Config-Find +no_index: + directory: + - t + - inc +requires: + File::HomeDir: '0' + File::Spec: '0' + File::Which: '0' + IO::File: '0' + Test::More: '0.70' +version: '0.31' diff -Nru libconfig-find-perl-0.26/README libconfig-find-perl-0.31/README --- libconfig-find-perl-0.26/README 2005-12-11 16:46:36.000000000 +0000 +++ libconfig-find-perl-0.31/README 2015-05-25 07:45:06.000000000 +0000 @@ -1,5 +1,5 @@ -Config/Find version -=================== +Config-Find +=========== Config::Find implements a set of heuristics to find the configuration files for your applications in an OS dependant @@ -29,7 +29,8 @@ COPYRIGHT AND LICENCE -Copyright (C) 2003, 2004 Salvador Fandiño García +Copyright (C) 2003-2015 Salvador Fandiño García +Copyright 2015 by Barbie (barbie@missbarbell.co.uk) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -Nru libconfig-find-perl-0.26/t/01load.t libconfig-find-perl-0.31/t/01load.t --- libconfig-find-perl-0.26/t/01load.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/t/01load.t 2015-05-25 07:37:09.000000000 +0000 @@ -0,0 +1,23 @@ +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl 1.t' + +######################### + +use Test::More tests => 3; + +my $OS = '-'; + +BEGIN { + use_ok('Config::Find'); + use_ok('Config::Find::Any'); + use_ok('Config::Find::Where'); + + if ($^O=~/Win32/) { + require Win32; + $OS = uc Win32::GetOSName(); + } +}; + +diag( "Testing Config::Find $Config::Find::VERSION, Perl $], $^X, OS: $^O ($OS)" ); + +######################### diff -Nru libconfig-find-perl-0.26/t/10find.t libconfig-find-perl-0.31/t/10find.t --- libconfig-find-perl-0.26/t/10find.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/t/10find.t 2015-05-25 07:45:06.000000000 +0000 @@ -0,0 +1,45 @@ +#!/usr/bin/perl -w +use strict; + +use Config::Find; +use File::Path; +use Test::More tests => 9; + +$ENV{HOME} = 't/data'; +if ($^O eq 'MSWin32') { + no warnings qw(redefine once); + *Config::Find::WinAny::app_user_dir = sub { + return 't/data'; + } +} +my $test1_name = $^O eq 'MSWin32' ? 't\\data\\test1.cfg' : 't/data/.test1'; +my $test2_name = $^O eq 'MSWin32' ? 't\\data\\test2.cfg' : 't/data/.test2'; +my $test3_name = $^O eq 'MSWin32' ? 't\\data\\test3.cfg' : 't/data/.test3'; + +my $fn = Config::Find->find( name => 'test1' ); +is($fn,$test1_name) or do { + $fn = Config::Find->find( names => ['test1'], mode => 'write', scope => 'global' ); + diag ("was searching for $fn"); +}; +$fn = Config::Find->find( names => ['test2','test1'] ); +is($fn,$test2_name); + +eval { $fn = Config::Find->find( names => ['does','not','exist'] ) }; +is($fn,undef); + +eval { $fn = Config::Find->find( names => 'string' ) }; +like($@,qr/expecting an array ref/); +eval { $fn = Config::Find->find( names => ['string'], mode => 'append' ) }; +like($@,qr/invalid option mode/); +eval { $fn = Config::Find->find( names => ['string'], scope => 'peri' ) }; +like($@,qr/invalid option scope/); + +eval { $fn = Config::Find->find( names => ['test1','test2'], mode => 'read' ) }; +is($fn,$test1_name); +eval { $fn = Config::Find->find( names => ['test3'], mode => 'write' ) }; +is($fn,$test3_name); + +mkdir('conf'); +eval { $fn = Config::Find->find( names => ['test3'], mode => 'write', scope => 'global' ) }; +like($fn,($^O eq 'MSWin32' ? qr!t\\test3\.cfg$! : qr!/conf/test3\.conf$!)); +rmdir('conf'); diff -Nru libconfig-find-perl-0.26/t/1.t libconfig-find-perl-0.31/t/1.t --- libconfig-find-perl-0.26/t/1.t 2005-12-11 16:46:34.000000000 +0000 +++ libconfig-find-perl-0.31/t/1.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl 1.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test::More tests => 1; -BEGIN { use_ok('Config::Find') }; - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. - diff -Nru libconfig-find-perl-0.26/t/2_where.t libconfig-find-perl-0.31/t/2_where.t --- libconfig-find-perl-0.26/t/2_where.t 2005-12-11 16:46:34.000000000 +0000 +++ libconfig-find-perl-0.31/t/2_where.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl 1.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test::More tests => 1; -BEGIN { use_ok('Config::Find::Where') }; - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. - diff -Nru libconfig-find-perl-0.26/t/3_pods.t libconfig-find-perl-0.31/t/3_pods.t --- libconfig-find-perl-0.26/t/3_pods.t 2005-12-11 16:46:34.000000000 +0000 +++ libconfig-find-perl-0.31/t/3_pods.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Test::More; -eval "use Test::Pod 1.00"; -plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; - -all_pod_files_ok( all_pod_files( qw(blib) ) ); diff -Nru libconfig-find-perl-0.26/t/90podtest.t libconfig-find-perl-0.31/t/90podtest.t --- libconfig-find-perl-0.26/t/90podtest.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/t/90podtest.t 2015-05-25 07:37:09.000000000 +0000 @@ -0,0 +1,12 @@ +#!/usr/bin/perl -w +use strict; + +use Test::More; + +# Skip if doing a regular install +plan skip_all => "Author tests not required for installation" + unless ( $ENV{AUTOMATED_TESTING} ); + +eval "use Test::Pod 1.00"; +plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; +all_pod_files_ok(); diff -Nru libconfig-find-perl-0.26/t/91podcover.t libconfig-find-perl-0.31/t/91podcover.t --- libconfig-find-perl-0.26/t/91podcover.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/t/91podcover.t 2015-05-25 07:37:09.000000000 +0000 @@ -0,0 +1,17 @@ +#!/usr/bin/perl -w +use strict; + +use Test::More; + +# Skip if doing a regular install +plan skip_all => "Author tests not required for installation" + unless ( $ENV{AUTOMATED_TESTING} ); + +eval "use Test::Pod::Coverage 0.08"; +plan skip_all => "Test::Pod::Coverage 0.08 required for testing POD coverage" if $@; + +pod_coverage_ok('Config::Find', { also_private => [ qr/^parse_opts$/ ] } ); +pod_coverage_ok('Config::Find::Any'); +pod_coverage_ok('Config::Find::Where', { also_private => [ qr/^(create_dir_if|parse_opts)$/ ] } ); + +done_testing(); diff -Nru libconfig-find-perl-0.26/t/94metatest.t libconfig-find-perl-0.31/t/94metatest.t --- libconfig-find-perl-0.26/t/94metatest.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/t/94metatest.t 2015-05-25 07:37:09.000000000 +0000 @@ -0,0 +1,38 @@ +#!/usr/bin/perl -w +use strict; + +use Test::More; + +# Skip if doing a regular install +plan skip_all => "Author tests not required for installation" + unless ( $ENV{AUTOMATED_TESTING} ); + +eval "use Test::CPAN::Meta"; +plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@; + +plan 'no_plan'; + +my $meta = meta_spec_ok(undef,undef,@_); + +use Config::Find; +my $version = $Config::Find::VERSION; + +is($meta->{version},$version, + 'META.yml distribution version matches'); + +if($meta->{provides}) { + for my $mod (keys %{$meta->{provides}}) { + is($meta->{provides}{$mod}{version},$version, + "META.yml entry [$mod] version matches"); + + next if($mod =~ /Unix|Win/); + + eval "require $mod"; + my $VERSION = '$' . $mod . '::VERSION'; + my $v = eval "$VERSION"; + is($meta->{provides}{$mod}{version},$v, + "META.yml entry [$mod] version matches module version"); + + isnt($meta->{provides}{$mod}{version},0); + } +} diff -Nru libconfig-find-perl-0.26/t/95changedate.t libconfig-find-perl-0.31/t/95changedate.t --- libconfig-find-perl-0.26/t/95changedate.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/t/95changedate.t 2015-05-25 07:37:09.000000000 +0000 @@ -0,0 +1,40 @@ +#!/usr/bin/perl -w +use strict; + +use Test::More; +use IO::File; + +# Skip if doing a regular install +plan skip_all => "Author tests not required for installation" + unless ( $ENV{AUTOMATED_TESTING} ); + +my $fh = IO::File->new('Changes','r') or plan skip_all => "Cannot open Changes file"; + +plan 'no_plan'; + +use Config::Find; +my $version = $Config::Find::VERSION; + +my $latest = 0; +while(<$fh>) { + next unless(m!^\d!); + $latest = 1 if(m!^$version!); + + # 2012-08-26T01:02 or 2012-08-26T01:02:03 or 2012-08-26T01:02:03.04 or 2012-08-26T01:02+01:00 + + like($_, qr!^ + \d[\d._]+\s+ # version + ( \d{4}-\d{2}-\d{2} # 2012-08-26 - YYYY-MM-DD + ( T\d{2}:\d{2} # T01:02 - Thh:mm + ( :\d{2} # :02 - :ss + ( \.\d+ # .2 - .ss (microseconds) + )? + )? + ( (Z|[-+]\d+:\d+) # +01:00 - timezone + )? + )? + ) + \s*$!x,'... version has a date'); +} + +is($latest,1,'... latest version not listed'); diff -Nru libconfig-find-perl-0.26/t/96metatest.t libconfig-find-perl-0.31/t/96metatest.t --- libconfig-find-perl-0.26/t/96metatest.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-find-perl-0.31/t/96metatest.t 2015-05-25 07:37:09.000000000 +0000 @@ -0,0 +1,38 @@ +#!/usr/bin/perl -w +use strict; + +use Test::More; + +# Skip if doing a regular install +plan skip_all => "Author tests not required for installation" + unless ( $ENV{AUTOMATED_TESTING} ); + +eval "use Test::CPAN::Meta::JSON"; +plan skip_all => "Test::CPAN::Meta::JSON required for testing META.json files" if $@; + +plan 'no_plan'; + +my $meta = meta_spec_ok(undef,undef,@_); + +use Config::Find; +my $version = $Config::Find::VERSION; + +is($meta->{version},$version, + 'META.json distribution version matches'); + +if($meta->{provides}) { + for my $mod (keys %{$meta->{provides}}) { + is($meta->{provides}{$mod}{version},$version, + "META.json entry [$mod] version matches distribution version"); + + next if($mod =~ /Unix|Win/); + + eval "require $mod"; + my $VERSION = '$' . $mod . '::VERSION'; + my $v = eval "$VERSION"; + is($meta->{provides}{$mod}{version},$v, + "META.json entry [$mod] version matches module version"); + + isnt($meta->{provides}{$mod}{version},0); + } +}