r1693 - in packages: . libfile-path-expand-perl
libfile-path-expand-perl/branches
libfile-path-expand-perl/branches/upstream
libfile-path-expand-perl/branches/upstream/current
libfile-path-expand-perl/branches/upstream/current/lib
libfile-path-expand-perl/branches/upstream/current/lib/File
libfile-path-expand-perl/branches/upstream/current/lib/File/Path
libfile-path-expand-perl/branches/upstream/current/t
Niko Tyni
ntyni-guest at costa.debian.org
Mon Dec 19 22:38:47 UTC 2005
Author: ntyni-guest
Date: 2005-12-19 22:38:46 +0000 (Mon, 19 Dec 2005)
New Revision: 1693
Added:
packages/libfile-path-expand-perl/
packages/libfile-path-expand-perl/branches/
packages/libfile-path-expand-perl/branches/upstream/
packages/libfile-path-expand-perl/branches/upstream/current/
packages/libfile-path-expand-perl/branches/upstream/current/Build.PL
packages/libfile-path-expand-perl/branches/upstream/current/Changes
packages/libfile-path-expand-perl/branches/upstream/current/MANIFEST
packages/libfile-path-expand-perl/branches/upstream/current/META.yml
packages/libfile-path-expand-perl/branches/upstream/current/Makefile.PL
packages/libfile-path-expand-perl/branches/upstream/current/lib/
packages/libfile-path-expand-perl/branches/upstream/current/lib/File/
packages/libfile-path-expand-perl/branches/upstream/current/lib/File/Path/
packages/libfile-path-expand-perl/branches/upstream/current/lib/File/Path/Expand.pm
packages/libfile-path-expand-perl/branches/upstream/current/t/
packages/libfile-path-expand-perl/branches/upstream/current/t/File-Path-Expand.t
packages/libfile-path-expand-perl/tags/
Log:
[svn-inject] Installing original source of libfile-path-expand-perl
Added: packages/libfile-path-expand-perl/branches/upstream/current/Build.PL
===================================================================
--- packages/libfile-path-expand-perl/branches/upstream/current/Build.PL 2005-12-19 15:27:08 UTC (rev 1692)
+++ packages/libfile-path-expand-perl/branches/upstream/current/Build.PL 2005-12-19 22:38:46 UTC (rev 1693)
@@ -0,0 +1,13 @@
+#!perl -w
+use strict;
+use Module::Build;
+Module::Build
+ ->new( module_name => "File::Path::Expand",
+ license => 'perl',
+ requires => {
+ 'Test::More' => 0,
+ },
+ create_makefile_pl => 'traditional',
+ )
+ ->create_build_script;
+
Added: packages/libfile-path-expand-perl/branches/upstream/current/Changes
===================================================================
--- packages/libfile-path-expand-perl/branches/upstream/current/Changes 2005-12-19 15:27:08 UTC (rev 1692)
+++ packages/libfile-path-expand-perl/branches/upstream/current/Changes 2005-12-19 22:38:46 UTC (rev 1693)
@@ -0,0 +1,5 @@
+1.01 Sunday 11th May, 2003
+ Bugfix to the test suite - had miscounted the number of skipped tests
+
+1.0 Sunday 11th May, 2003
+ Initial release
Added: packages/libfile-path-expand-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libfile-path-expand-perl/branches/upstream/current/MANIFEST 2005-12-19 15:27:08 UTC (rev 1692)
+++ packages/libfile-path-expand-perl/branches/upstream/current/MANIFEST 2005-12-19 22:38:46 UTC (rev 1693)
@@ -0,0 +1,7 @@
+Build.PL
+Makefile.PL
+Changes
+MANIFEST
+META.yml
+lib/File/Path/Expand.pm
+t/File-Path-Expand.t
Added: packages/libfile-path-expand-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libfile-path-expand-perl/branches/upstream/current/META.yml 2005-12-19 15:27:08 UTC (rev 1692)
+++ packages/libfile-path-expand-perl/branches/upstream/current/META.yml 2005-12-19 22:38:46 UTC (rev 1693)
@@ -0,0 +1,15 @@
+--- #YAML:1.0
+name: File-Path-Expand
+version: 1.01
+license: perl
+distribution_type: module
+requires:
+ Test::More: 0
+recommends: {}
+build_requires: {}
+conflicts: {}
+provides:
+ File::Path::Expand:
+ file: lib/File/Path/Expand.pm
+ version: 1.01
+generated_by: Module::Build version 0.18
Added: packages/libfile-path-expand-perl/branches/upstream/current/Makefile.PL
===================================================================
--- packages/libfile-path-expand-perl/branches/upstream/current/Makefile.PL 2005-12-19 15:27:08 UTC (rev 1692)
+++ packages/libfile-path-expand-perl/branches/upstream/current/Makefile.PL 2005-12-19 22:38:46 UTC (rev 1693)
@@ -0,0 +1,10 @@
+ use ExtUtils::MakeMaker;
+ WriteMakefile
+ ('DISTNAME' => 'File-Path-Expand',
+ 'VERSION' => '1.01',
+ 'PL_FILES' => {},
+ 'PREREQ_PM' => {
+ 'Test::More' => '0',
+
+ },
+ );
Added: packages/libfile-path-expand-perl/branches/upstream/current/lib/File/Path/Expand.pm
===================================================================
--- packages/libfile-path-expand-perl/branches/upstream/current/lib/File/Path/Expand.pm 2005-12-19 15:27:08 UTC (rev 1692)
+++ packages/libfile-path-expand-perl/branches/upstream/current/lib/File/Path/Expand.pm 2005-12-19 22:38:46 UTC (rev 1693)
@@ -0,0 +1,55 @@
+use strict;
+package File::Path::Expand;
+use User::pwent;
+use Carp qw(croak);
+use Exporter;
+use base 'Exporter';
+use vars qw( $VERSION @EXPORT @EXPORT_OK );
+
+$VERSION = '1.01';
+ at EXPORT = qw( expand_filename );
+ at EXPORT_OK = qw( expand_filename home_of );
+
+sub expand_filename {
+ my $path = shift;
+ $path =~ s{^~/}{ $ENV{HOME} ? "$ENV{HOME}/" : home_of( $> )."/" }e;
+ $path =~ s{^~(.*?)/}{ home_of( $1 )."/" }e;
+ return $path;
+}
+
+sub home_of {
+ my $user = shift;
+ my $ent = getpw($user)
+ or croak "no such user '$user'";
+ return $ent->dir;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+File::Path::Expand - expand filenames
+
+=head1 SYNOPSIS
+
+ use File::Path::Expand;
+ print expand_filename("~richardc/foo"); # prints "/home/richardc/foo"
+
+=head1 DESCRIPTION
+
+File::Path::Expand expands user directories in filenames. For the
+simple case it's no more complex than s{^~/}{$HOME/}, but for other
+cases it consults C<getpwent> and does the right thing.
+
+=head1 AUTHOR
+
+Richard Clamp <richardc at unixbeard.net>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2003, Richard Clamp. All Rights Reserved. This module
+is free software. It may be used, redistributed and/or modified under
+the same terms as Perl itself.
+
+=cut
Added: packages/libfile-path-expand-perl/branches/upstream/current/t/File-Path-Expand.t
===================================================================
--- packages/libfile-path-expand-perl/branches/upstream/current/t/File-Path-Expand.t 2005-12-19 15:27:08 UTC (rev 1692)
+++ packages/libfile-path-expand-perl/branches/upstream/current/t/File-Path-Expand.t 2005-12-19 22:38:46 UTC (rev 1693)
@@ -0,0 +1,29 @@
+#!perl -w
+use strict;
+use Test::More tests => 5;
+use Sys::Hostname;
+BEGIN { use_ok('File::Path::Expand') };
+
+$ENV{HOME} = '/some/path';
+is( expand_filename('~/foo'), "/some/path/foo", 'uses $HOME' );
+
+SKIP: {
+ skip "only guaranteed on penfold", 3
+ unless hostname eq 'penfold.unixbeard.net';
+
+ SKIP: {
+ skip "have to be richardc too", 1
+ unless $> eq 1000;
+
+ $ENV{HOME} = '';
+ is( expand_filename("~/foo"), "/home/richardc/foo",
+ 'without $HOME ~/' );
+ }
+
+ is( expand_filename('~root/foo'), "/root/foo", 'root' );
+
+ eval { expand_filename('~frooby/') };
+ like( $@, qr{^no such user 'frooby'}, "failure" );
+}
+
+
More information about the Pkg-perl-cvs-commits
mailing list