r53571 - in /trunk/libfile-fu-perl: ./ debian/ lib/File/ lib/File/Fu/ lib/File/Fu/Dir/ lib/File/Fu/File/ t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Wed Mar 3 17:21:43 UTC 2010
Author: jawnsy-guest
Date: Wed Mar 3 17:21:35 2010
New Revision: 53571
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53571
Log:
* New upstream release
* Standards-Version 3.8.4 (no changes)
* Rewrite control description
Added:
trunk/libfile-fu-perl/t/findknob.t
- copied unchanged from r53570, branches/upstream/libfile-fu-perl/current/t/findknob.t
trunk/libfile-fu-perl/t/slice.t
- copied unchanged from r53570, branches/upstream/libfile-fu-perl/current/t/slice.t
Modified:
trunk/libfile-fu-perl/Changes
trunk/libfile-fu-perl/MANIFEST
trunk/libfile-fu-perl/MANIFEST.SKIP
trunk/libfile-fu-perl/META.yml
trunk/libfile-fu-perl/debian/changelog
trunk/libfile-fu-perl/debian/control
trunk/libfile-fu-perl/debian/copyright
trunk/libfile-fu-perl/lib/File/Fu.pm
trunk/libfile-fu-perl/lib/File/Fu/Base.pm
trunk/libfile-fu-perl/lib/File/Fu/Dir.pm
trunk/libfile-fu-perl/lib/File/Fu/Dir/Temp.pm
trunk/libfile-fu-perl/lib/File/Fu/File.pm
trunk/libfile-fu-perl/lib/File/Fu/File/Temp.pm
trunk/libfile-fu-perl/todo
Modified: trunk/libfile-fu-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/Changes?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/Changes (original)
+++ trunk/libfile-fu-perl/Changes Wed Mar 3 17:21:35 2010
@@ -1,4 +1,14 @@
Revision history for File-Fu
+
+v0.0.7 2010-02-27
+
+ * much better documentation for File::Fu::Dir::find()
+
+ * added rename() for Dir objects
+
+ * allow Dir parts() and slice() to have negative indices
+
+ * improvements to temp_dir
v0.0.6 2009-01-31
Modified: trunk/libfile-fu-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/MANIFEST?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/MANIFEST (original)
+++ trunk/libfile-fu-perl/MANIFEST Wed Mar 3 17:21:35 2010
@@ -6,7 +6,7 @@
lib/File/Fu/Dir/Temp.pm
lib/File/Fu/File.pm
lib/File/Fu/File/Temp.pm
-MANIFEST This list of files
+MANIFEST
MANIFEST.SKIP
META.yml
README
@@ -17,8 +17,10 @@
t/end_bits.t
t/errors.t
t/finder.t
+t/findknob.t
t/global.t
t/links.t
+t/slice.t
t/slurp.t
t/temp.t
todo
Modified: trunk/libfile-fu-perl/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/MANIFEST.SKIP?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/MANIFEST.SKIP (original)
+++ trunk/libfile-fu-perl/MANIFEST.SKIP Wed Mar 3 17:21:35 2010
@@ -35,3 +35,4 @@
\bcover_db\b
TODO
+^MYMETA.yml$
Modified: trunk/libfile-fu-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/META.yml?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/META.yml (original)
+++ trunk/libfile-fu-perl/META.yml Wed Mar 3 17:21:35 2010
@@ -1,6 +1,6 @@
---
name: File-Fu
-version: v0.0.6
+version: v0.0.7
author:
- 'Eric Wilhelm @ <ewilhelm at cpan dot org>'
abstract: file and directory objects
@@ -10,38 +10,40 @@
homepage: http://scratchcomputing.com/
license: http://dev.perl.org/licenses/
repository: http://svn.scratchcomputing.com/File-Fu/trunk
+build_requires:
+ Module::Build: 0.26
+ Test::More: 0
requires:
Class::Accessor::Classy: v0.9.0
File::Spec: 0
File::Which: 0.05
IO::File: 0
-build_requires:
- Module::Build: 0.26
- Test::More: 0
+configure_requires:
+ Module::Build: 0.35
provides:
File::Fu:
file: lib/File/Fu.pm
- version: v0.0.6
+ version: v0.0.7
File::Fu::Base:
file: lib/File/Fu/Base.pm
- version: v0.0.6
+ version: v0.0.7
File::Fu::Dir:
file: lib/File/Fu/Dir.pm
- version: v0.0.6
+ version: v0.0.7
File::Fu::Dir::FindKnob:
file: lib/File/Fu/Dir.pm
File::Fu::Dir::Temp:
file: lib/File/Fu/Dir/Temp.pm
- version: v0.0.6
+ version: v0.0.7
File::Fu::Dir::Token:
file: lib/File/Fu/Dir.pm
File::Fu::File:
file: lib/File/Fu/File.pm
- version: v0.0.6
+ version: v0.0.7
File::Fu::File::Temp:
file: lib/File/Fu/File/Temp.pm
- version: v0.0.6
-generated_by: Module::Build version 0.3103
+ version: v0.0.7
+generated_by: Module::Build version 0.350201
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.2.html
- version: 1.2
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: trunk/libfile-fu-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/debian/changelog?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/debian/changelog (original)
+++ trunk/libfile-fu-perl/debian/changelog Wed Mar 3 17:21:35 2010
@@ -1,4 +1,9 @@
-libfile-fu-perl (0.0.6-2) UNRELEASED; urgency=low
+libfile-fu-perl (0.0.7-1) UNRELEASED; urgency=low
+
+ [ Jonathan Yu ]
+ * New upstream release
+ * Standards-Version 3.8.4 (no changes)
+ * Rewrite control description
[ Salvatore Bonaccorso ]
* debian/control: Changed: Replace versioned (build-)dependency on
@@ -12,7 +17,7 @@
* debian/control: Changed: (build-)depend on perl instead of perl-
modules.
- -- Ryan Niebur <ryanryan52 at gmail.com> Tue, 01 Sep 2009 21:18:52 -0700
+ -- Jonathan Yu <jawnsy at cpan.org> Wed, 03 Mar 2010 12:35:47 -0500
libfile-fu-perl (0.0.6-1) unstable; urgency=low
Modified: trunk/libfile-fu-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/debian/control?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/debian/control (original)
+++ trunk/libfile-fu-perl/debian/control Wed Mar 3 17:21:35 2010
@@ -3,10 +3,10 @@
Priority: optional
Build-Depends: debhelper (>= 7), perl (>= 5.10) | libmodule-build-perl
Build-Depends-Indep: perl, libfile-which-perl (>= 0.05),
- libclass-accessor-classy-perl (>= 0.9.0)
+ libclass-accessor-classy-perl (>= 0.9)
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Jonathan Yu <jawnsy at cpan.org>
-Standards-Version: 3.8.2
+Standards-Version: 3.8.4
Homepage: http://search.cpan.org/dist/File-Fu/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libfile-fu-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libfile-fu-perl/
@@ -14,12 +14,12 @@
Package: libfile-fu-perl
Architecture: all
Depends: ${perl:Depends}, ${misc:Depends}, libfile-which-perl (>= 0.05),
- libclass-accessor-classy-perl (>= 0.9.0)
-Description: Perl module for file and directory manipulation as objects
- File::Fu provides the toplevel interface to directory and file objects, with
- operator overloading which allows precise path composition and support for
- most built-in methods. It also provides a way to create temporary directories
- and files, finding files, and more.
+ libclass-accessor-classy-perl (>= 0.9)
+Description: module for manipulating files and directories as objects
+ File::Fu is a Perl module that provides an method of manipulating directories
+ and files as objects, making use of operator overloading to allow for precise
+ composition fo paths and support for many built-in methods. It also provides
+ a way to create temporary directories and files.
.
The interface and style provided by this module are quite different than Perl
built-in functions or File::Spec. The syntax is concise and errors are checked
Modified: trunk/libfile-fu-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/debian/copyright?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/debian/copyright (original)
+++ trunk/libfile-fu-perl/debian/copyright Wed Mar 3 17:21:35 2010
@@ -1,28 +1,29 @@
-Format-Specification:
- http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
-Upstream-Maintainer: Eric Wilhelm <ewilhelm at cpan.org>
-Upstream-Source: http://search.cpan.org/dist/File-Fu/
-Upstream-Name: File-Fu
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=59
+Maintainer: Eric Wilhelm <ewilhelm at cpan.org>
+Source: http://search.cpan.org/dist/File-Fu/
+Name: File-Fu
Files: *
Copyright: 2008, Eric Wilhelm <ewilhelm at cpan.org>
-License-Alias: Perl
-License: Artistic | GPL-1+
+License: Artistic or GPL-1+
Files: debian/*
-Copyright: 2009, Jonathan Yu <jawnsy at cpan.org>
-License: Artistic | GPL-1+
+Copyright: 2009-2010, Jonathan Yu <jawnsy at cpan.org>
+License: Artistic or GPL-1+
License: Artistic
- This program is free software; you can redistribute it and/or modify
- it under the terms of the Artistic License, which comes with Perl.
- On Debian GNU/Linux systems, the complete text of the Artistic License
- can be found in `/usr/share/common-licenses/Artistic'
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+ .
+ On Debian GNU/Linux systems, the complete text of the Artistic License
+ can be found in `/usr/share/common-licenses/Artistic'
License: GPL-1+
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
- On Debian GNU/Linux systems, the complete text of the GNU General
- Public License can be found in `/usr/share/common-licenses/GPL'
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+ .
+ On Debian GNU/Linux systems, the complete text of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL'
+
Modified: trunk/libfile-fu-perl/lib/File/Fu.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/lib/File/Fu.pm?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/lib/File/Fu.pm (original)
+++ trunk/libfile-fu-perl/lib/File/Fu.pm Wed Mar 3 17:21:35 2010
@@ -1,5 +1,5 @@
package File::Fu;
-$VERSION = v0.0.6;
+$VERSION = v0.0.7;
use warnings;
use strict;
Modified: trunk/libfile-fu-perl/lib/File/Fu/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/lib/File/Fu/Base.pm?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/lib/File/Fu/Base.pm (original)
+++ trunk/libfile-fu-perl/lib/File/Fu/Base.pm Wed Mar 3 17:21:35 2010
@@ -1,5 +1,5 @@
package File::Fu::Base;
-$VERSION = v0.0.6;
+$VERSION = v0.0.7;
use warnings;
use strict;
@@ -230,6 +230,25 @@
} # end subroutine chmod definition
########################################################################
+=head2 rename
+
+Calls the builtin rename() on the $path and returns a new object with
+that name.
+
+ $path = $path->rename($newname);
+
+=cut
+
+sub rename :method {
+ my $self = shift;
+ my ($name) = @_;
+
+ rename($self, $name) or
+ croak("cannot rename '$self' to '$name' $!");
+ return($self->new($name));
+} # end subroutine rename definition
+########################################################################
+
=head1 Stat Object
The stat() and lstat() methods both return a File::stat object.
Modified: trunk/libfile-fu-perl/lib/File/Fu/Dir.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/lib/File/Fu/Dir.pm?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/lib/File/Fu/Dir.pm (original)
+++ trunk/libfile-fu-perl/lib/File/Fu/Dir.pm Wed Mar 3 17:21:35 2010
@@ -1,5 +1,5 @@
package File::Fu::Dir;
-$VERSION = v0.0.6;
+$VERSION = v0.0.7;
use warnings;
use strict;
@@ -166,7 +166,7 @@
The trailing slash causes trouble when trying to address a symlink to a
directory via a dir object. Thus, C<-l $dir> doesn't work, but
-C<$dir->l> does.
+C<$dir-E<gt>l> does the same thing as C<-l $dir-E<gt>bare>.
=cut
@@ -287,11 +287,13 @@
my @parts = $dir->parts(0..2);
The returned parts will be contiguous, but the request can be a
-two-element list (and can also end at -1.)
+two-element list (and can also start or end at negative indices.)
my @parts = $dir->parts(3, 7);
my @parts = $dir->parts(3, -1);
+
+ my @parts = $dir->parts(-5, -1);
=cut
@@ -300,8 +302,11 @@
my @want = @_;
@want or return(@{$self->{dirs}});
if(@want == 2) {
- if($want[1] < 0) {
- $want[1] = $#{$self->{dirs}};
+ foreach my $end (@want) {
+ $end = $#{$self->{dirs}} + 1 + $end if($end < 0);
+ }
+ if($want[0] > $want[1]) {
+ croak("first endpoint '$want[0]' is after last '$want[1]'");
}
@want = $want[0]..$want[1];
}
@@ -576,9 +581,39 @@
=head2 find
-Not the same as File::Find::find().
-
- my @files = $dir->find(sub {m/foo/});
+Recursively search a directory's contents for items where the supplied
+coderef (matcher) returns true. The matcher will be invoked with the
+topic (C<$_>) set to the current path (which is either a Dir or File
+object.) The return values will be File::Fu::File or File::Fu::Dir
+objects.
+
+If your matcher returns true, the topic will be added to the return
+values.
+
+ my @paths = $dir->find(sub {m/foo/});
+
+There is a knob for controlling recursion, which is the first argument
+to your matcher.
+
+ my @pm_files = $dir->find(sub {
+ return shift->prune
+ if($_->is_dir and $_->part(-1) =~ m/^\.svn$/);
+ $_->is_file and m/\.pm$/;
+ });
+
+=over
+
+=item Differences from File::Find::find()
+
+The invocant (C<$dir> aka '.') is not examined (because this is an
+object method, there is always only one starting path.)
+
+The topic is always absolute in the same sense as the invocant. That
+is, if C<$dir> is relative to your current directory, then so are the
+topics and return values. If C<$dir> is absolute, so are the topics and
+return values.
+
+=back
=cut
@@ -597,7 +632,9 @@
=head2 finder
-Returns an iterator for finding files.
+Returns an iterator for finding files. This iterator does everything
+that find() does, but returns one path at a time. Returns undef when
+exhausted and zero when it is just taking a break.
my $subref = $dir->finder(sub {$_->is_file and $_->file =~ m/foo/});
@@ -605,22 +642,17 @@
while(defined(my $path = $subref->())) {
$path or next; # 0 means 'not done yet'
- # do something with $path (is a file or dir object)
+ # do something with $path (a file or dir object)
}
-And there is a knob:
-
- my $finder = $dir->finder(sub {
- return shift->prune
- if($_->is_dir and $_->part(-1) =~ m/^\.svn$/);
- $_->is_file and m/\.pm$/;
- });
+The find() method is implemented in terms of finder() by simply using a
+while() loop and accumulating the return values.
=cut
sub finder {
my $self = shift;
- my ($matcher, @opt) = @_;
+ my ($matcher, @opt) = @_; # TODO support options e.g. loops
my %opt = (all => 1);
@@ -637,9 +669,8 @@
($self, $reader) = ($path, undef);
}
local $_ = $path;
- #warn " check $path\n";
my $ok = $matcher->(my $knob = File::Fu::Dir::FindKnob->new);
- if($knob->pruned) {
+ if($knob->pruned and not $path->l) { # XXX nofollow assumption
($self, $reader) = @{pop(@stack)};
}
if($ok) {
@@ -659,6 +690,24 @@
} # end subroutine finder definition
########################################################################
+=head2 The FindKnob object
+
+The FindKnob object allows you to control the next steps of find().
+Methods called on it will typically return a value which also makes
+sense as a return value of your matcher sub. Thus the idiom:
+
+ $dir->find(sub {return shift->prune if(condition); ...})
+
+=over
+
+=item prune
+
+Do not recurse into the topic directory. Returns false.
+
+=back
+
+=cut
+
BEGIN {
package File::Fu::Dir::FindKnob;
use Class::Accessor::Classy;
Modified: trunk/libfile-fu-perl/lib/File/Fu/Dir/Temp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/lib/File/Fu/Dir/Temp.pm?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/lib/File/Fu/Dir/Temp.pm (original)
+++ trunk/libfile-fu-perl/lib/File/Fu/Dir/Temp.pm Wed Mar 3 17:21:35 2010
@@ -1,5 +1,5 @@
package File::Fu::Dir::Temp;
-$VERSION = v0.0.6;
+$VERSION = v0.0.7;
use warnings;
use strict;
@@ -73,6 +73,20 @@
}} # end subroutine new definition
########################################################################
+=head2 chdir
+
+ my $dir = $dir->chdir;
+
+=cut
+
+sub chdir {
+ my $self = shift;
+
+ my $dir = $self->SUPER::chdir;
+ $dir->{temp_parent} = $self;
+ return($dir);
+} # chdir ##############################################################
+
=for nit head2 clone
Because clone doesn't call new :-/
$not_temp = $temp->clone;
@@ -85,6 +99,21 @@
bless($self, $self->dir_class);
} # end subroutine clone definition
########################################################################
+
+=head2 rename
+
+Same as the base rename(), but promotes the temp dir to a regular Dir
+object (prevents any cleanup actions.)
+
+ $temp = $temp->rename($dest);
+
+=cut
+
+sub rename {
+ my $self = shift->SUPER::rename(@_);
+ bless($self, $self->dir_class);
+ return($self);
+}
# TODO File::Fu->temp_dir->chdir causes immediate deletion?
@@ -115,7 +144,8 @@
sub DESTROY {
my $self = shift;
- # ? should this have: return unless($self->auto_delete);
+ # ? should this have:
+ return unless($self->auto_delete);
# forked case
return unless($$ == $self->{_proc});
Modified: trunk/libfile-fu-perl/lib/File/Fu/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/lib/File/Fu/File.pm?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/lib/File/Fu/File.pm (original)
+++ trunk/libfile-fu-perl/lib/File/Fu/File.pm Wed Mar 3 17:21:35 2010
@@ -1,5 +1,5 @@
package File::Fu::File;
-$VERSION = v0.0.6;
+$VERSION = v0.0.7;
use warnings;
use strict;
@@ -319,25 +319,6 @@
# TODO
# my $link = $file->dwimlink(absolute|relative|samedir => $linkname);
-
-=head2 rename
-
-Calls the builtin rename() on the $file and returns a new object with
-that name.
-
- $file = $file->rename($newname);
-
-=cut
-
-sub rename :method {
- my $self = shift;
- my ($name) = @_;
-
- rename($self, $name) or
- croak("cannot rename '$self' to '$name' $!");
- return($self->new($name));
-} # end subroutine rename definition
-########################################################################
=head2 unlink
Modified: trunk/libfile-fu-perl/lib/File/Fu/File/Temp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/lib/File/Fu/File/Temp.pm?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/lib/File/Fu/File/Temp.pm (original)
+++ trunk/libfile-fu-perl/lib/File/Fu/File/Temp.pm Wed Mar 3 17:21:35 2010
@@ -1,5 +1,5 @@
package File::Fu::File::Temp;
-$VERSION = v0.0.6;
+$VERSION = v0.0.7;
use warnings;
use strict;
Modified: trunk/libfile-fu-perl/todo
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libfile-fu-perl/todo?rev=53571&op=diff
==============================================================================
--- trunk/libfile-fu-perl/todo (original)
+++ trunk/libfile-fu-perl/todo Wed Mar 3 17:21:35 2010
@@ -11,9 +11,12 @@
$file->dirname->map([qw(wav flac)], 0);
($file &= λ{s/wav/flac/})->dirname &= λ{s/wav/flac/};
$file->map(λ{s/\.wav$/flac/})->dirname->map(λ{s/wav/flac/}, 0);
-o $dir + 'foo/bar' problem
+x $dir + 'foo/bar' problem
o freedesktop
o home
o mimeinfo
o basedir
o resolve() symlink chase-down
+
+o URI support?
+ - is that just a subclass with a volume-like thing?
More information about the Pkg-perl-cvs-commits
mailing list