[Moose-commits] r7264 - in File-Stat-Moose/trunk: . lib/File/Stat
lib/MooseX/Types t/tlib/File/Stat
dexter at code2.0beta.co.uk
dexter at code2.0beta.co.uk
Sat Jan 10 15:26:27 GMT 2009
Author: dexter
Date: 2009-01-10 07:26:27 -0800 (Sat, 10 Jan 2009)
New Revision: 7264
Modified:
File-Stat-Moose/trunk/Changes
File-Stat-Moose/trunk/lib/File/Stat/Moose.pm
File-Stat-Moose/trunk/lib/MooseX/Types/CacheFileHandle.pm
File-Stat-Moose/trunk/lib/MooseX/Types/OpenHandle.pm
File-Stat-Moose/trunk/t/tlib/File/Stat/MooseTest.pm
Log:
* File::Stat::Moose: Attributes "ctime", "atime" and "mtime" returns undef if stat was not called.
* MooseX::Types::*: Fix description of modules.
Modified: File-Stat-Moose/trunk/Changes
===================================================================
--- File-Stat-Moose/trunk/Changes 2009-01-10 12:36:29 UTC (rev 7263)
+++ File-Stat-Moose/trunk/Changes 2009-01-10 15:26:27 UTC (rev 7264)
@@ -1,4 +1,15 @@
------------------------------------------------------------------------
+0.0401 | Piotr Roszatycki <dexter at debian.org> | 2009-01-10
+
+Changes:
+
+* File::Stat::Moose:
+ * Attributes "ctime", "atime" and "mtime" returns undef if stat was not
+ called.
+* MooseX::Types::*:
+ * Fix description of modules.
+
+------------------------------------------------------------------------
0.04 | Piotr Roszatycki <dexter at debian.org> | 2008-12-30
Changes:
Modified: File-Stat-Moose/trunk/lib/File/Stat/Moose.pm
===================================================================
--- File-Stat-Moose/trunk/lib/File/Stat/Moose.pm 2009-01-10 12:36:29 UTC (rev 7263)
+++ File-Stat-Moose/trunk/lib/File/Stat/Moose.pm 2009-01-10 15:26:27 UTC (rev 7264)
@@ -38,11 +38,12 @@
use constant::boolean;
use Scalar::Util 'weaken';
+
use DateTime;
use Exception::Base (
- '+ignore_package' => [ __PACKAGE__, 'Sub::Exporter', qr/^Moose::/, qr/^Class::MOP::/ ],
+ '+ignore_package' => [ __PACKAGE__, 'Sub::Exporter', qr/^Moose::/, qr/^Class::MOP::/ ],
);
use Exception::Argument;
use Exception::IO;
@@ -123,7 +124,6 @@
isa => 'Maybe[DateTime]',
lazy => 1,
default => sub {
- return '' if not exists $_[0]->{"_${attr}_epoch"};
defined $_[0]->{"_${attr}_epoch"}
? DateTime->from_epoch( epoch => $_[0]->{"_${attr}_epoch"} )
: undef
@@ -159,6 +159,8 @@
local ${^WIN32_SLOPPY_STAT} = $self->{sloppy};
+ delete @{$self}{ qw{ atime mtime ctime } };
+
@{$self}{ qw{ dev ino mode nlink uid gid rdev size _atime_epoch _mtime_epoch _ctime_epoch blksize blocks } }
= map { defined $_ && $_ eq '' ? undef : $_ }
CORE::stat $self->{file} or Exception::IO->throw( message => 'Cannot stat' );
@@ -178,6 +180,8 @@
local ${^WIN32_SLOPPY_STAT} = $self->{sloppy};
+ delete @{$self}{ qw{ atime mtime ctime } };
+
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 : $_ }
Modified: File-Stat-Moose/trunk/lib/MooseX/Types/CacheFileHandle.pm
===================================================================
--- File-Stat-Moose/trunk/lib/MooseX/Types/CacheFileHandle.pm 2009-01-10 12:36:29 UTC (rev 7263)
+++ File-Stat-Moose/trunk/lib/MooseX/Types/CacheFileHandle.pm 2009-01-10 15:26:27 UTC (rev 7264)
@@ -18,8 +18,8 @@
=head1 DESCRIPTION
-This module provides Moose type which represents opened file handle (glob
-reference or object).
+This module provides L<Moose> type which represents special cached file handle
+- underscore (C<_>) - which is used for C<stat> tests.
=cut
Modified: File-Stat-Moose/trunk/lib/MooseX/Types/OpenHandle.pm
===================================================================
--- File-Stat-Moose/trunk/lib/MooseX/Types/OpenHandle.pm 2009-01-10 12:36:29 UTC (rev 7263)
+++ File-Stat-Moose/trunk/lib/MooseX/Types/OpenHandle.pm 2009-01-10 15:26:27 UTC (rev 7264)
@@ -19,10 +19,7 @@
=head1 DESCRIPTION
-This module provides Moose type which represents special cached file handle -
-underscore (C<_>) - which is used for C<stat> tests.
-
-opened file handle (glob
+This module provides L<Moose> type which represents opened file handle (glob
reference or object).
=cut
Modified: File-Stat-Moose/trunk/t/tlib/File/Stat/MooseTest.pm
===================================================================
--- File-Stat-Moose/trunk/t/tlib/File/Stat/MooseTest.pm 2009-01-10 12:36:29 UTC (rev 7263)
+++ File-Stat-Moose/trunk/t/tlib/File/Stat/MooseTest.pm 2009-01-10 15:26:27 UTC (rev 7264)
@@ -99,17 +99,10 @@
my $obj = File::Stat::Moose->new;
assert_isa('File::Stat::Moose', $obj);
{
- foreach my $attr (qw{ dev ino mode nlink uid gid rdev size blksize blocks }) {
+ foreach my $attr (qw{ dev ino mode nlink uid gid rdev size atime ctime mtime blksize blocks }) {
assert_null($obj->$attr, $attr);
};
};
- {
- foreach my $attr (qw { atime mtime ctime }) {
- assert_raises( qr/does not pass the type constraint/, sub {
- $obj->$attr;
- }, $attr );
- };
- };
$obj->file($file);
assert_equals($file, $obj->file);
@@ -178,17 +171,10 @@
my $obj = File::Stat::Moose->new;
assert_isa('File::Stat::Moose', $obj);
{
- foreach my $attr (qw{ dev ino mode nlink uid gid rdev size blksize blocks }) {
+ foreach my $attr (qw{ dev ino mode nlink uid gid rdev size atime ctime mtime blksize blocks }) {
assert_null($obj->$attr, $attr);
};
};
- {
- foreach my $attr (qw { atime mtime ctime }) {
- assert_raises( qr/does not pass the type constraint/, sub {
- $obj->$attr
- }, $attr );
- };
- };
$obj->file($file);
assert_equals($file, $obj->file);
More information about the Moose-commits
mailing list