[Moose-commits] r7306 - in File-Stat-Moose/trunk: . lib/File/Stat
t/tlib/File/Stat
dexter at code2.0beta.co.uk
dexter at code2.0beta.co.uk
Wed Jan 14 11:46:51 GMT 2009
Author: dexter
Date: 2009-01-14 03:46:51 -0800 (Wed, 14 Jan 2009)
New Revision: 7306
Modified:
File-Stat-Moose/trunk/
File-Stat-Moose/trunk/Changes
File-Stat-Moose/trunk/Incompatibilities
File-Stat-Moose/trunk/MANIFEST
File-Stat-Moose/trunk/MANIFEST.SKIP
File-Stat-Moose/trunk/lib/File/Stat/Moose.pm
File-Stat-Moose/trunk/t/tlib/File/Stat/MooseTest.pm
Log:
* Do not use file => ArrayRef[Str] syntax.
* Attribute "spec" is removed.
Property changes on: File-Stat-Moose/trunk
___________________________________________________________________
Name: svn:ignore
- *.bak
*.tmp
.includepath
.project
.settings
Build
Debian_CPANTS.txt
File-Stat-Moose-*
LICENSE
META.yml
Makefile.PL
README
_build
blib
cover_db
+ *.bak
*.deb
*.gz
*.ppd
*.tgz
*.tmp
.includepath
.project
.settings
Build
Debian_CPANTS.txt
File-Stat-Moose-*
LICENSE
META.yml
Makefile.PL
README
_build
blib
cover_db
Modified: File-Stat-Moose/trunk/Changes
===================================================================
--- File-Stat-Moose/trunk/Changes 2009-01-14 08:46:12 UTC (rev 7305)
+++ File-Stat-Moose/trunk/Changes 2009-01-14 11:46:51 UTC (rev 7306)
@@ -9,7 +9,6 @@
* Method "lstat" are deprecared.
* Attribute "file" is required.
* All attributes are "ro".
- * New attribute "spec" contains the class name of File::Spec class.
* Attributes "atime", "ctime" and "mtime" returns undef if stat was not
called.
* MooseX::Types::*:
Modified: File-Stat-Moose/trunk/Incompatibilities
===================================================================
--- File-Stat-Moose/trunk/Incompatibilities 2009-01-14 08:46:12 UTC (rev 7305)
+++ File-Stat-Moose/trunk/Incompatibilities 2009-01-14 11:46:51 UTC (rev 7306)
@@ -1,9 +1,8 @@
------------------------------------------------------------------------
0.04 -> 0.05
-* Method "lstat" are deprecared.
- Attribute "file" is required.
- All attributes are "ro".
+* Method "lstat" are deprecared. Attribute "file" is required. All attributes
+ are "ro".
Was:
Modified: File-Stat-Moose/trunk/MANIFEST
===================================================================
--- File-Stat-Moose/trunk/MANIFEST 2009-01-14 08:46:12 UTC (rev 7305)
+++ File-Stat-Moose/trunk/MANIFEST 2009-01-14 11:46:51 UTC (rev 7306)
@@ -6,6 +6,7 @@
lib/File/Stat/Moose.pm
lib/MooseX/Types/CacheFileHandle.pm
lib/MooseX/Types/OpenHandle.pm
+LICENSE
Makefile.PL
MANIFEST This list of files
MANIFEST.SKIP
@@ -29,4 +30,3 @@
xt/pod_syntax.t
xt/profile.pl
xt/trace.pl
-LICENSE
Modified: File-Stat-Moose/trunk/MANIFEST.SKIP
===================================================================
--- File-Stat-Moose/trunk/MANIFEST.SKIP 2009-01-14 08:46:12 UTC (rev 7305)
+++ File-Stat-Moose/trunk/MANIFEST.SKIP 2009-01-14 11:46:51 UTC (rev 7306)
@@ -48,6 +48,7 @@
\bDebian_CPANTS.txt$
# Avoid Eclipse files
+.includepath
.project
# Avoid distdir
Modified: File-Stat-Moose/trunk/lib/File/Stat/Moose.pm
===================================================================
--- File-Stat-Moose/trunk/lib/File/Stat/Moose.pm 2009-01-14 08:46:12 UTC (rev 7305)
+++ File-Stat-Moose/trunk/lib/File/Stat/Moose.pm 2009-01-14 11:46:51 UTC (rev 7306)
@@ -46,10 +46,7 @@
# atime, ctime, mtime attributes
use DateTime;
-# file => ArrayRef[Str] attribute
-use File::Spec;
-
use Exception::Base (
'+ignore_package' => [ __PACKAGE__, qr/^File::Spec(::|$)/, 'Sub::Exporter', qr/^Moose::/, qr/^Class::MOP::/ ],
);
@@ -96,7 +93,7 @@
# File which is checked with stat
has file => (
is => 'ro',
- isa => 'Str | ArrayRef[Str] | FileHandle | CacheFileHandle | OpenHandle',
+ isa => 'Str | FileHandle | CacheFileHandle | OpenHandle',
required => TRUE,
predicate => 'has_file',
);
@@ -115,13 +112,6 @@
default => FALSE,
);
-# File::Spec handler
-has spec => (
- is => 'rw',
- isa => 'ClassName',
- default => 'File::Spec',
-);
-
# Numeric informations about a file
has [ qw{ dev ino mode nlink uid gid rdev size blksize blocks } ] => (
is => 'ro',
@@ -177,13 +167,6 @@
assert_not_null($self->{file}) if ASSERT;
- my $file = $self->{file};
-
- # Convert array to string
- if (ref $file eq 'ARRAY') {
- $file = $self->spec->catfile(@$file);
- };
-
# Clear lazy attributes
delete @{$self}{ qw{ atime mtime ctime } };
@@ -192,13 +175,13 @@
if ($self->{follow}) {
@{$self}{ qw{ dev ino mode nlink uid gid rdev size _atime_epoch _mtime_epoch _ctime_epoch blksize blocks } }
= map { defined $_ && $_ eq '' ? undef : $_ }
- CORE::stat $file or Exception::IO->throw( message => 'Cannot stat' );
+ CORE::stat $self->{file} or Exception::IO->throw( message => 'Cannot stat' );
}
else {
no warnings 'io'; # lstat() on filehandle
@{$self}{ qw{ dev ino mode nlink uid gid rdev size _atime_epoch _mtime_epoch _ctime_epoch blksize blocks } }
= map { defined $_ && $_ eq '' ? undef : $_ }
- CORE::lstat $file or Exception::IO->throw( message => 'Cannot lstat' );
+ CORE::lstat $self->{file} or Exception::IO->throw( message => 'Cannot lstat' );
};
return $self;
@@ -252,10 +235,9 @@
[ File::Stat::Moose
----------------------------------------------------------------------------------------
- +file : Str|ArrayRef[Str]|FileHandle|CacheFileHandle|OpenHandle {ro, required}
+ +file : Str|FileHandle|CacheFileHandle|OpenHandle {ro, required}
+follow : Bool {ro}
+sloppy : Bool {ro}
- +spec : ClassName {ro}
+dev : Maybe[Int] {ro}
+ino : Maybe[Int] {ro}
+mode : Maybe[Int] {ro}
@@ -276,8 +258,8 @@
+update() : Self
+stat() : Self
<<deprecated>> +lstat() : Self
- <<utility>> +stat( file : Str|ArrayRef[Str]|FileHandle|CacheFileHandle|OpenHandle = $_ ) : Self|Array
- <<utility>> +lstat( file : Str|ArrayRef[Str]|FileHandle|CacheFileHandle|OpenHandle = $_ ) : Self|Array
+ <<utility>> +stat( file : Str|FileHandle|CacheFileHandle|OpenHandle = $_ ) : Self|Array
+ <<utility>> +lstat( file : Str|FileHandle|CacheFileHandle|OpenHandle = $_ ) : Self|Array
-_deref_array() : ArrayRef {overload="@{}"}
]
@@ -327,8 +309,8 @@
=item file : Str|FileHandle|CacheFileHandle|OpenHandle {ro, required}
-Contains the file for check. The attribute can hold file name or array
-reference of path components or file handler or IO object.
+Contains the file for check. The attribute can hold file name or file
+handler or IO object.
=item follow : Bool {ro}
@@ -342,11 +324,6 @@
I<sloppy> is set to true value, L<perlfunc/stat> speeds up by not performing
this operation.
-=item spec : ClassName {ro}
-
-Contains the name of L<File::Spec> class name which converts C<file> attribute
-from array reference to string.
-
=item dev : Maybe[Int] {ro}
ID of device containing file. If this value and following has no meaning on
@@ -459,7 +436,7 @@
=over
-=item stat( I<file> : Str|ArrayRef[Str]|FileHandle|CacheFileHandle|OpenHandle = $_ ) : Self|Array
+=item stat( I<file> : Str|FileHandle|CacheFileHandle|OpenHandle = $_ ) : Self|Array
Calls stat on given I<file>. If the I<file> is undefined, the C<$_> variable
is used instead.
@@ -472,13 +449,14 @@
@st = stat;
print "Size: $st[7]\n";
-If it is called with scalar context, it returns the C<File::Stat::Moose> object.
+If it is called with scalar context, it returns the C<File::Stat::Moose>
+object.
use File::Stat::Moose 'stat';
- $st = stat '/etc/passwd';
+ $st = stat '/etc/passwd';
@st = @$st;
-=item lstat( I<file> : Str|ArrayRef[Str]|FileHandle|CacheFileHandle|OpenHandle = $_ ) : Self|Array
+=item lstat( I<file> : Str|FileHandle|CacheFileHandle|OpenHandle = $_ ) : Self|Array
It is identical to C<stat>, except that if I<file> is a symbolic link, then
the link itself is checked, not the file that it refers to.
Modified: File-Stat-Moose/trunk/t/tlib/File/Stat/MooseTest.pm
===================================================================
--- File-Stat-Moose/trunk/t/tlib/File/Stat/MooseTest.pm 2009-01-14 08:46:12 UTC (rev 7305)
+++ File-Stat-Moose/trunk/t/tlib/File/Stat/MooseTest.pm 2009-01-14 11:46:51 UTC (rev 7306)
@@ -65,19 +65,6 @@
assert_not_equals(0, $obj->size);
};
-sub test_new_file_spec {
- my ($volume, $directories, $filename) = File::Spec->splitpath($file);
- my @dirs = File::Spec->splitdir($directories);
- assert_not_null($filename);
- assert_not_null(@dirs);
- assert_not_equals('', $filename);
- assert_not_equals(0, scalar @dirs);
-
- my $obj = File::Stat::Moose->new( file => [ @dirs, $filename ] );
- assert_isa('File::Stat::Moose', $obj);
- assert_not_equals(0, $obj->size);
-};
-
sub test_new_symlink {
return unless $symlink;
More information about the Moose-commits
mailing list