r21247 - in /branches/upstream/libfile-basedir-perl: ./ current/ current/lib/ current/lib/File/ current/t/
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Sun Jun 15 13:49:35 UTC 2008
Author: gregoa
Date: Sun Jun 15 13:49:35 2008
New Revision: 21247
URL: http://svn.debian.org/wsvn/?sc=1&rev=21247
Log:
[svn-inject] Installing original source of libfile-basedir-perl
Added:
branches/upstream/libfile-basedir-perl/
branches/upstream/libfile-basedir-perl/current/
branches/upstream/libfile-basedir-perl/current/Build.PL
branches/upstream/libfile-basedir-perl/current/Changes
branches/upstream/libfile-basedir-perl/current/MANIFEST
branches/upstream/libfile-basedir-perl/current/META.yml
branches/upstream/libfile-basedir-perl/current/Makefile.PL
branches/upstream/libfile-basedir-perl/current/README
branches/upstream/libfile-basedir-perl/current/configure (with props)
branches/upstream/libfile-basedir-perl/current/lib/
branches/upstream/libfile-basedir-perl/current/lib/File/
branches/upstream/libfile-basedir-perl/current/lib/File/BaseDir.pm
branches/upstream/libfile-basedir-perl/current/t/
branches/upstream/libfile-basedir-perl/current/t/01_vars.t
branches/upstream/libfile-basedir-perl/current/t/02_lookup.t
branches/upstream/libfile-basedir-perl/current/t/03_OO.t
branches/upstream/libfile-basedir-perl/current/t/04_pod_ok.t
branches/upstream/libfile-basedir-perl/current/t/05_pod_cover.t
Added: branches/upstream/libfile-basedir-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/Build.PL?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/Build.PL (added)
+++ branches/upstream/libfile-basedir-perl/current/Build.PL Sun Jun 15 13:49:35 2008
@@ -1,0 +1,24 @@
+#!/usr/bin/perl
+
+use Module::Build;
+
+my $build = Module::Build->new(
+ dist_name => 'File-BaseDir',
+ dist_version_from => 'lib/File/BaseDir.pm',
+ dist_author => 'Jaap Karssenberg <pardus at cpan.org>',
+ license => 'perl',
+ requires => {
+ 'Carp' => 0,
+ 'Exporter' => 0,
+ 'File::Spec' => 0,
+ },
+ build_requires => {
+ 'Module::Build' => '0.24',
+ 'Test::More' => 0,
+ },
+ create_makefile_pl => 'passthrough',
+ #dynamic_config => 1,
+);
+
+$build->create_build_script;
+
Added: branches/upstream/libfile-basedir-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/Changes?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/Changes (added)
+++ branches/upstream/libfile-basedir-perl/current/Changes Sun Jun 15 13:49:35 2008
@@ -1,0 +1,21 @@
+Revision history for Perl extension File::BaseDir.
+
+0.03 Wed Oct 24 2007
+ - Added lookup methods for files and dirs:
+ data_home, data_files, data_dirs,
+ config_home, config_files, config_dirs & cache_home;
+ suggested by Matisse Enzer
+ - Deprecated xdg_data_files and xdg_config_files;
+ suggested by Michael Schwern
+ - Added a bit of Win32 support
+ - Extended tests to full coverage
+
+0.02 Thu Sep 4 2003
+ - forgot to remove h2xs default "use 5.008" tag :(
+ emergency release it is ...
+
+0.01 Wed Sep 3 18:33:59 2003
+ - original version; created by h2xs 1.22 with options
+ -AX -n File::BaseDir
+ - Added methods for all environment variables defined by the spec
+
Added: branches/upstream/libfile-basedir-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/MANIFEST?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/MANIFEST (added)
+++ branches/upstream/libfile-basedir-perl/current/MANIFEST Sun Jun 15 13:49:35 2008
@@ -1,0 +1,13 @@
+Build.PL
+Changes
+configure
+lib/File/BaseDir.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/01_vars.t
+t/02_lookup.t
+t/03_OO.t
+t/04_pod_ok.t
+t/05_pod_cover.t
Added: branches/upstream/libfile-basedir-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/META.yml?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/META.yml (added)
+++ branches/upstream/libfile-basedir-perl/current/META.yml Sun Jun 15 13:49:35 2008
@@ -1,0 +1,24 @@
+---
+name: File-BaseDir
+version: 0.03
+author:
+ - 'Jaap Karssenberg <pardus at cpan.org>'
+abstract: Use the Freedesktop.org base directory specification
+license: perl
+resources:
+ license: http://dev.perl.org/licenses/
+requires:
+ Carp: 0
+ Exporter: 0
+ File::Spec: 0
+build_requires:
+ Module::Build: 0.24
+ Test::More: 0
+provides:
+ File::BaseDir:
+ file: lib/File/BaseDir.pm
+ version: 0.03
+generated_by: Module::Build version 0.2806
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Added: branches/upstream/libfile-basedir-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/Makefile.PL?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/Makefile.PL (added)
+++ branches/upstream/libfile-basedir-perl/current/Makefile.PL Sun Jun 15 13:49:35 2008
@@ -1,0 +1,31 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+
+ unless (eval "use Module::Build::Compat 0.02; 1" ) {
+ print "This module requires Module::Build to install itself.\n";
+
+ require ExtUtils::MakeMaker;
+ my $yn = ExtUtils::MakeMaker::prompt
+ (' Install Module::Build now from CPAN?', 'y');
+
+ unless ($yn =~ /^y/i) {
+ die " *** Cannot install without Module::Build. Exiting ...\n";
+ }
+
+ require Cwd;
+ require File::Spec;
+ require CPAN;
+
+ # Save this 'cause CPAN will chdir all over the place.
+ my $cwd = Cwd::cwd();
+
+ CPAN::Shell->install('Module::Build::Compat');
+ CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
+ or die "Couldn't install Module::Build, giving up.\n";
+
+ chdir $cwd or die "Cannot chdir() back to $cwd: $!";
+ }
+ eval "use Module::Build::Compat 0.02; 1" or die $@;
+
+ Module::Build::Compat->run_build_pl(args => \@ARGV);
+ require Module::Build;
+ Module::Build::Compat->write_makefile(build_class => 'Module::Build');
Added: branches/upstream/libfile-basedir-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/README?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/README (added)
+++ branches/upstream/libfile-basedir-perl/current/README Sun Jun 15 13:49:35 2008
@@ -1,0 +1,32 @@
+File-BaseDir
+============
+
+This module can be used to find directories and files as specified
+by the Freedekstop.org Base Directory Specification.
+
+INSTALLATION
+
+To install this module type the following:
+
+ perl Build.PL
+ ./Build
+ ./Build test
+ ./Build install
+
+DEPENDENCIES
+
+This module requires these other modules which can be obtained from
+the CPAN <http://cpan.org> if they are not allready installed on
+your system :
+
+ Module::Build
+ Carp
+ Exporter
+ File::Spec
+
+COPYRIGHT AND LICENCE
+
+Copyright (c) 2003, 2007 Jaap G Karssenberg. All rights reserved.
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
Added: branches/upstream/libfile-basedir-perl/current/configure
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/configure?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/configure (added)
+++ branches/upstream/libfile-basedir-perl/current/configure Sun Jun 15 13:49:35 2008
@@ -1,0 +1,2 @@
+#!/bin/sh
+exec perl ./Makefile.PL "$@"
Propchange: branches/upstream/libfile-basedir-perl/current/configure
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libfile-basedir-perl/current/lib/File/BaseDir.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/lib/File/BaseDir.pm?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/lib/File/BaseDir.pm (added)
+++ branches/upstream/libfile-basedir-perl/current/lib/File/BaseDir.pm Sun Jun 15 13:49:35 2008
@@ -1,0 +1,296 @@
+package File::BaseDir;
+
+use strict;
+use Carp;
+require File::Spec;
+require Exporter;
+
+our $VERSION = 0.03;
+
+our @ISA = qw(Exporter);
+our %EXPORT_TAGS = (
+ vars => [ qw(
+ xdg_data_home xdg_data_dirs
+ xdg_config_home xdg_config_dirs
+ xdg_cache_home
+ ) ],
+ lookup => [ qw(
+ data_home data_dirs data_files
+ config_home config_dirs config_files
+ cache_home
+ ) ],
+);
+our @EXPORT_OK = (
+ qw(xdg_data_files xdg_config_files),
+ map @$_, values %EXPORT_TAGS
+);
+
+# Set root and home directories
+my $rootdir = File::Spec->rootdir();
+if ($^O eq 'MSWin32') {
+ $rootdir = 'C:\\'; # File::Spec default depends on CWD
+ $ENV{HOME} ||= $ENV{USERPROFILE} || $ENV{HOMEDRIVE}.$ENV{HOMEPATH};
+ # logic from File::HomeDir::Windows
+}
+my $home = $ENV{HOME};
+unless ($home) {
+ warn "WARNING: HOME is not set, using root: $rootdir\n";
+ $home = $rootdir;
+}
+
+# Set defaults
+our $xdg_data_home = File::Spec->catdir($home, qw/.local share/);
+our @xdg_data_dirs = (
+ File::Spec->catdir($rootdir, qw/usr local share/),
+ File::Spec->catdir($rootdir, qw/usr share/),
+);
+our $xdg_config_home = File::Spec->catdir($home, '.config');
+our @xdg_config_dirs = ( File::Spec->catdir($rootdir, qw/etc xdg/) );
+our $xdg_cache_home = File::Spec->catdir($home, '.cache');
+
+# OO method
+sub new { bless \$VERSION, shift } # what else is there to bless ?
+
+# Variable methods
+sub xdg_data_home { $ENV{XDG_DATA_HOME} || $xdg_data_home }
+
+sub xdg_data_dirs {
+ ( $ENV{XDG_DATA_DIRS}
+ ? _adapt($ENV{XDG_DATA_DIRS})
+ : @xdg_data_dirs
+ )
+}
+
+sub xdg_config_home {$ENV{XDG_CONFIG_HOME} || $xdg_config_home }
+
+sub xdg_config_dirs {
+ ( $ENV{XDG_CONFIG_DIRS}
+ ? _adapt($ENV{XDG_CONFIG_DIRS})
+ : @xdg_config_dirs
+ )
+}
+
+sub xdg_cache_home { $ENV{XDG_CACHE_HOME} || $xdg_cache_home }
+
+sub _adapt {
+ map { File::Spec->catdir( split('/', $_) ) } split /[:;]/, shift;
+ # ':' defined in the spec, but ';' is standard on win32
+}
+
+# Lookup methods
+sub data_home { _catfile(xdg_data_home, @_) }
+
+sub data_dirs { _find_files(\&_dir, \@_, xdg_data_home, xdg_data_dirs) }
+
+sub data_files { _find_files(\&_file, \@_, xdg_data_home, xdg_data_dirs) }
+
+sub xdg_data_files { my @dirs = data_files(@_); return @dirs }
+
+sub config_home { _catfile(xdg_config_home, @_) }
+
+sub config_dirs { _find_files(\&_dir, \@_, xdg_config_home, xdg_config_dirs) }
+
+sub config_files { _find_files(\&_file, \@_, xdg_config_home, xdg_config_dirs) }
+
+sub xdg_config_files { my @dirs = config_files(@_); return @dirs }
+
+sub cache_home { _catfile(xdg_cache_home, @_) }
+
+sub _catfile {
+ my $dir = shift;
+ shift if ref $_[0] or $_[0] =~ /::/; # OO call
+ return File::Spec->catfile($dir, @_);
+}
+
+sub _find_files {
+ my $type = shift;
+ my $file = shift;
+ shift @$file if ref $$file[0] or $$file[0] =~ /::/; # OO call
+ #warn "Looking for: @$file\n in: @_\n";
+ if (wantarray) {
+ return grep { &$type( $_ ) && -r $_ }
+ map { File::Spec->catfile($_, @$file) } @_;
+ }
+ else { # prevent unnessecary stats by returning early
+ for (@_) {
+ my $path = File::Spec->catfile($_, @$file);
+ return $path if &$type($path) && -r $path;
+ }
+ }
+ return ();
+}
+
+sub _dir { -d $_[0] }
+
+sub _file { -f $_[0] }
+
+1;
+
+__END__
+
+=head1 NAME
+
+File::BaseDir - Use the Freedesktop.org base directory specification
+
+=head1 SYNOPSIS
+
+ use File::BaseDir qw/xdg_data_files/;
+ for ( xdg_data_files('mime/globs') ) {
+ # do something
+ }
+
+=head1 DESCRIPTION
+
+This module can be used to find directories and files as specified
+by the Freedesktop.org Base Directory Specification. This specifications
+gives a mechanism to locate directories for configuration, application data
+and cache data. It is suggested that desktop applications for e.g. the
+Gnome, KDE or Xfce platforms follow this layout. However, the same layout can
+just as well be used for non-GUI applications.
+
+This module forked from L<File::MimeInfo>.
+
+This module follows version 0.6 of BaseDir specification.
+
+=head1 EXPORT
+
+None by default, but all methods can be exported on demand.
+Also the groups ":lookup" and ":vars" are defined. The ":vars" group
+contains all routines with a "xdg_" prefix; the ":lookup" group
+contains the routines to locate files and directories.
+
+=head1 METHODS
+
+=over 4
+
+=item C<new()>
+
+Simple constructor to allow Object Oriented use of this module.
+
+=back
+
+=head2 Lookup
+
+The following methods are used to lookup files and folders in one of the
+search paths.
+
+=over 4
+
+=item C<data_home(@PATH)>
+
+Takes a list of file path elements and returns a new path by appending
+them to the data home directory. The new path does not need to exist.
+Use this when writing user specific application data.
+
+Example:
+
+ # data_home is: /home/USER/.local/share
+ $path = $bd->data_home('Foo', 'Bar', 'Baz');
+ # returns: /home/USER/.local/share/Foo/Bar/Baz
+
+=item C<data_dirs(@PATH)>
+
+Looks for directories specified by C<@PATH> in the data home and
+other data directories. Returns (possibly empty) list of readable
+directories. In scalar context only the first directory found is
+returned. Use this to lookup application data.
+
+=item C<data_files(@PATH)>
+
+Looks for files specified by C<@PATH> in the data home and other data
+directories. Only returns files that are readable. In scalar context only
+the first file found is returned. Use this to lookup application data.
+
+=item C<config_home(@PATH)>
+
+Takes a list of path elements and appends them to the config home
+directory returning a new path. The new path does not need to exist.
+Use this when writing user specific configuration.
+
+=item C<config_dirs(@PATH)>
+
+Looks for directories specified by C<@PATH> in the config home and
+other config directories. Returns (possibly empty) list of readable
+directories. In scalar context only the first directory found is
+returned. Use this to lookup configuration.
+
+=item C<config_files(@PATH)>
+
+Looks for files specified by C<@PATH> in the config home and other
+config directories. Returns a (possibly empty) list of files that
+are readable. In scalar context only the first file found is returned.
+Use this to lookup configuration.
+
+=item C<cache_home(@PATH)>
+
+Takes a list of path elements and appends them to the cache home
+directory returning a new path. The new path does not need to exist.
+
+=back
+
+=head2 Variables
+
+The following methods only returns the value of one of the XDG variables.
+
+=over 4
+
+=item C<xdg_data_home>
+
+Returns either C<$ENV{XDG_DATA_HOME}> or it's default value.
+Default is F<$HOME/.local/share>.
+
+=item C<xdg_data_dirs>
+
+Returns either C<$ENV{XDG_DATA_DIRS}> or it's default value as list.
+Default is F</usr/local/share>, F</usr/share>.
+
+=item C<xdg_config_home>
+
+Returns either C<$ENV{XDG_CONFIG_HOME}> or it's default value.
+Default is F<$HOME/.config>.
+
+=item C<xdg_config_dirs>
+
+Returns either C<$ENV{XDG_CONFIG_DIRS}> or it's default value as list.
+Default is F</etc/xdg>.
+
+=item C<xdg_cache_home>
+
+Returns either C<$ENV{XDG_CACHE_HOME}> or it's default value.
+Default is F<$HOME/.cache>.
+
+=back
+
+=head1 NON-UNIX PLATFORMS
+
+The use of L<File::Spec> ensures that all paths are returned in the apropriate
+form for the current platform. On Windows this module will try to set C<$HOME>
+to a sensible value if it is not defined yet. On other platforms one can use
+e.g. L<File::HomeDir> to set $HOME before loading File::BaseDir.
+
+Please note that the specification is targeting Unix platforms only and
+will only have limited relevance on other platforms. Any platform dependend
+behavior in this module should be considerd an extension of the spec.
+
+=head1 BACKWARDS COMPATIBILITY
+
+The methods C<xdg_data_files()> and C<xdg_config_files()> are exported for
+backwards compatibilty with version 0.02. They are identical to C<data_files()>
+and C<config_files()> respectively but without the C<wantarray> behavior.
+
+=head1 BUGS
+
+Please mail the author if you encounter any bugs.
+
+=head1 AUTHOR
+
+Jaap Karssenberg || Pardus [Larus] E<lt>pardus at cpan.orgE<gt>
+
+Copyright (c) 2003, 2007 Jaap G Karssenberg. All rights reserved.
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<http://www.freedesktop.org/wiki/Specifications/basedir-spec>
+
Added: branches/upstream/libfile-basedir-perl/current/t/01_vars.t
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/t/01_vars.t?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/t/01_vars.t (added)
+++ branches/upstream/libfile-basedir-perl/current/t/01_vars.t Sun Jun 15 13:49:35 2008
@@ -1,0 +1,45 @@
+use strict;
+use Test::More tests => 12;
+
+use_ok('File::BaseDir', qw/:vars/);
+
+my $rootdir = ($^O eq 'MSWin32') ? 'c:\\' : File::Spec->rootdir();
+ok(length($ENV{HOME}), 'HOME defined');
+
+$ENV{XDG_CONFIG_HOME} = '';
+ok( xdg_config_home() eq File::Spec->catdir($ENV{HOME}, qw/.config/),
+ 'xdg_config_home default');
+$ENV{XDG_CONFIG_HOME} = 'test123';
+ok( xdg_config_home() eq 'test123', 'xdg_data_home set');
+
+$ENV{XDG_CONFIG_DIRS} = '';
+is_deeply( [xdg_config_dirs()],
+ [ File::Spec->catdir($rootdir, qw/etc xdg/) ],
+ 'xdg_config_dirs default');
+$ENV{XDG_CONFIG_DIRS} = './t:foo:bar';
+is_deeply( [xdg_config_dirs()],
+ [File::Spec->catdir('.', 't'), 'foo', 'bar'],
+ 'xdg_data_dirs set');
+
+$ENV{XDG_DATA_HOME} = '';
+ok( xdg_data_home() eq File::Spec->catdir($ENV{HOME}, qw/.local share/),
+ 'xdg_data_home default');
+$ENV{XDG_DATA_HOME} = 'test123';
+ok( xdg_data_home() eq 'test123', 'xdg_data_home set');
+
+$ENV{XDG_DATA_DIRS} = '';
+is_deeply( [xdg_data_dirs()],
+ [ File::Spec->catdir($rootdir, qw/usr local share/),
+ File::Spec->catdir($rootdir, qw/usr share/) ],
+ 'xdg_data_dirs default');
+$ENV{XDG_DATA_DIRS} = './t:foo:bar';
+is_deeply( [xdg_data_dirs()],
+ [File::Spec->catdir('.', 't'), 'foo', 'bar'],
+ 'xdg_data_dirs set');
+
+$ENV{XDG_CACHE_HOME} = '';
+ok( xdg_cache_home() eq File::Spec->catdir($ENV{HOME}, qw/.cache/),
+ 'xdg_cache_home default');
+$ENV{XDG_CACHE_HOME} = 'test123';
+ok( xdg_cache_home() eq 'test123', 'xdg_cache_home set');
+
Added: branches/upstream/libfile-basedir-perl/current/t/02_lookup.t
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/t/02_lookup.t?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/t/02_lookup.t (added)
+++ branches/upstream/libfile-basedir-perl/current/t/02_lookup.t Sun Jun 15 13:49:35 2008
@@ -1,0 +1,68 @@
+use strict;
+use Test::More tests => 17;
+use File::Spec;
+
+use_ok('File::BaseDir', qw/:lookup xdg_data_files xdg_config_files/);
+
+# Initalize test data:
+
+# t/
+# `-- data/ $dir[1]
+# |-- dir/ $dir[2]
+# | `-- test $file[1]
+# `-- test $file[0]
+
+my @dir = ('t', map File::Spec->catdir(@$_),
+ [qw/t data/], [qw/t data dir/] );
+my @file = (map File::Spec->catfile(@$_),
+ [qw/t data test/], [qw/t data dir test/] );
+mkdir $dir[1] or die $! unless -d $dir[1];
+mkdir $dir[2] or die $! unless -d $dir[2];
+open TEST, ">$file[0]" or die $!;
+print TEST "test 1 2 3\n";
+close TEST;
+eval { chmod 0644, $file[0] }; # reset previous run
+open TEST, ">$file[1]" or die $!;
+print TEST "test 1 2 3\n";
+close TEST;
+
+$ENV{XDG_CONFIG_HOME} = 'foo';
+$ENV{XDG_CONFIG_DIRS} = 'bar';
+$ENV{XDG_DATA_HOME} = '.';
+$ENV{XDG_DATA_DIRS} = join ':', @dir;
+
+is(data_home(qw/t data test/), $file[0], 'data_home');
+is(data_files(qw/data test/), $file[0], 'data_files');
+is_deeply([data_files(qw/test/)], \@file, 'data_files - list');
+is(data_dirs(qw/data dir/), $dir[2], 'data_dirs');
+is_deeply([data_dirs(qw/data dir/)], [$dir[2]], 'data_dirs - list');
+
+ok(!data_files(qw/data dir/), 'data_files does not match dir');
+ok(!data_dirs(qw/data test/), 'data_dirs does not match file');
+
+is_deeply([xdg_data_files(qw/test/)], \@file,
+ 'xdg_data_files - for backward compatibility');
+
+$ENV{XDG_CONFIG_HOME} = '.';
+$ENV{XDG_CONFIG_DIRS} = join ':', @dir;
+$ENV{XDG_DATA_HOME} = 'foo';
+$ENV{XDG_DATA_DIRS} = 'bar';
+
+is(config_home(qw/t data test/), $file[0], 'config_home');
+is(config_files(qw/data test/), $file[0], 'config_files');
+is_deeply([config_files(qw/test/)], \@file, 'config_files - list');
+is(config_dirs(qw/data dir/), $dir[2], 'config_dirs');
+is_deeply([config_dirs(qw/data dir/)], [$dir[2]], 'config_dirs - list');
+
+is_deeply([xdg_config_files(qw/test/)], \@file,
+ 'xdg_config_files - for backward compatibility');
+
+SKIP: {
+ eval { chmod 0200, $file[0] }; # make non-readable
+ skip "chmod not supported", 1 if -r $file[0];
+ is(config_files(qw/test/), $file[1], 'config_files checks for read');
+}
+
+$ENV{XDG_CACHE_HOME} = 't/data';
+ok(cache_home('test') eq $file[0], 'data_cache');
+
Added: branches/upstream/libfile-basedir-perl/current/t/03_OO.t
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/t/03_OO.t?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/t/03_OO.t (added)
+++ branches/upstream/libfile-basedir-perl/current/t/03_OO.t Sun Jun 15 13:49:35 2008
@@ -1,0 +1,26 @@
+use strict;
+use Test::More tests => 6;
+use File::BaseDir;
+
+my $rootdir = ($^O eq 'MSWin32') ? 'c:\\' : File::Spec->rootdir();
+
+my $conf = File::BaseDir->new;
+
+is(ref($conf), 'File::BaseDir', 'OO constructor works');
+
+$ENV{XDG_DATA_DIRS} = '';
+is_deeply( [$conf->xdg_data_dirs()],
+ [ File::Spec->catdir($rootdir, qw/usr local share/),
+ File::Spec->catdir($rootdir, qw/usr share/) ],
+ 'xdg_data_dirs default - OO');
+
+$ENV{XDG_DATA_HOME} = 't';
+is($conf->data_dirs('data'), File::Spec->catdir(qw/t data/),
+ 'data_dirs - OO');
+is(File::BaseDir->data_dirs('data'), File::Spec->catdir(qw/t data/),
+ 'data_dirs - Module');
+
+is($conf->data_home('data', 'test'), File::Spec->catfile(qw/t data test/),
+ 'data_home - OO');
+is(File::BaseDir->data_home('data', 'test'), File::Spec->catfile(qw/t data test/),
+ 'data_home - Module');
Added: branches/upstream/libfile-basedir-perl/current/t/04_pod_ok.t
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/t/04_pod_ok.t?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/t/04_pod_ok.t (added)
+++ branches/upstream/libfile-basedir-perl/current/t/04_pod_ok.t Sun Jun 15 13:49:35 2008
@@ -1,0 +1,4 @@
+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( Test::Pod::all_pod_files(qw/bin lib/) );
Added: branches/upstream/libfile-basedir-perl/current/t/05_pod_cover.t
URL: http://svn.debian.org/wsvn/branches/upstream/libfile-basedir-perl/current/t/05_pod_cover.t?rev=21247&op=file
==============================================================================
--- branches/upstream/libfile-basedir-perl/current/t/05_pod_cover.t (added)
+++ branches/upstream/libfile-basedir-perl/current/t/05_pod_cover.t Sun Jun 15 13:49:35 2008
@@ -1,0 +1,9 @@
+use Test::More;
+
+use File::BaseDir qw/xdg_data_dirs/;
+$ENV{XDG_DATA_DIRS} = join ':', 'share', xdg_data_dirs;
+
+eval "use Test::Pod::Coverage 1.00";
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+all_pod_coverage_ok(
+ { also_private => [ qr/^_/, qr/^xdg_.*_files$/ ] } );
More information about the Pkg-perl-cvs-commits
mailing list