r32912 - in /branches/upstream/libdatetime-set-perl/current: Changes META.yml lib/DateTime/Set.pm lib/DateTime/Span.pm lib/DateTime/SpanSet.pm t/08span.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Thu Apr 9 16:37:17 UTC 2009


Author: gregoa
Date: Thu Apr  9 16:37:13 2009
New Revision: 32912

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=32912
Log:
[svn-upgrade] Integrating new upstream version, libdatetime-set-perl (0.27)

Modified:
    branches/upstream/libdatetime-set-perl/current/Changes
    branches/upstream/libdatetime-set-perl/current/META.yml
    branches/upstream/libdatetime-set-perl/current/lib/DateTime/Set.pm
    branches/upstream/libdatetime-set-perl/current/lib/DateTime/Span.pm
    branches/upstream/libdatetime-set-perl/current/lib/DateTime/SpanSet.pm
    branches/upstream/libdatetime-set-perl/current/t/08span.t

Modified: branches/upstream/libdatetime-set-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-set-perl/current/Changes?rev=32912&op=diff
==============================================================================
--- branches/upstream/libdatetime-set-perl/current/Changes (original)
+++ branches/upstream/libdatetime-set-perl/current/Changes Thu Apr  9 16:37:13 2009
@@ -1,4 +1,8 @@
 Changes for DateTime::Set
+
+0.27   2009-04-02
+- fixed DateTime::Spanset duration() method.
+  Reported by Anton Berezin <tobez at tobez.org>
 
 0.26   2008-12-25
 - fixed DateTime::Spanset current() and set_time_zone() methods. 

Modified: branches/upstream/libdatetime-set-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-set-perl/current/META.yml?rev=32912&op=diff
==============================================================================
--- branches/upstream/libdatetime-set-perl/current/META.yml (original)
+++ branches/upstream/libdatetime-set-perl/current/META.yml Thu Apr  9 16:37:13 2009
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                DateTime-Set
-version:             0.26
+version:             0.27
 abstract:            DateTime set objects
 license:             ~
 author:              

Modified: branches/upstream/libdatetime-set-perl/current/lib/DateTime/Set.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-set-perl/current/lib/DateTime/Set.pm?rev=32912&op=diff
==============================================================================
--- branches/upstream/libdatetime-set-perl/current/lib/DateTime/Set.pm (original)
+++ branches/upstream/libdatetime-set-perl/current/lib/DateTime/Set.pm Thu Apr  9 16:37:13 2009
@@ -16,7 +16,7 @@
 use constant NEG_INFINITY => -1 * (100 ** 100 ** 100);
 
 BEGIN {
-    $VERSION = '0.26';
+    $VERSION = '0.27';
 }
 
 

Modified: branches/upstream/libdatetime-set-perl/current/lib/DateTime/Span.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-set-perl/current/lib/DateTime/Span.pm?rev=32912&op=diff
==============================================================================
--- branches/upstream/libdatetime-set-perl/current/lib/DateTime/Span.pm (original)
+++ branches/upstream/libdatetime-set-perl/current/lib/DateTime/Span.pm Thu Apr  9 16:37:13 2009
@@ -286,11 +286,11 @@
 sub duration { 
     my $dur;
 
+    local $@;
     eval {
         local $SIG{__DIE__};   # don't want to trap this (rt ticket 5434)
         $dur = $_[0]->end->subtract_datetime_absolute( $_[0]->start )
     };
-    $@ = undef;  # clear the eval() error message
     
     return $dur if defined $dur;
 

Modified: branches/upstream/libdatetime-set-perl/current/lib/DateTime/SpanSet.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-set-perl/current/lib/DateTime/SpanSet.pm?rev=32912&op=diff
==============================================================================
--- branches/upstream/libdatetime-set-perl/current/lib/DateTime/SpanSet.pm (original)
+++ branches/upstream/libdatetime-set-perl/current/lib/DateTime/SpanSet.pm Thu Apr  9 16:37:13 2009
@@ -516,11 +516,14 @@
 sub duration { 
     my $dur; 
 
+    return DateTime::Duration->new( seconds => 0 ) 
+        if $_[0]->{set}->is_empty;
+
+    local $@;
     eval { 
         local $SIG{__DIE__};   # don't want to trap this (rt ticket 5434)
         $dur = $_[0]->{set}->size 
     };
-    $@ = undef;  # clear the eval() error message
 
     return $dur if defined $dur && ref( $dur );
     return DateTime::Infinite::Future->new -

Modified: branches/upstream/libdatetime-set-perl/current/t/08span.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdatetime-set-perl/current/t/08span.t?rev=32912&op=diff
==============================================================================
--- branches/upstream/libdatetime-set-perl/current/t/08span.t (original)
+++ branches/upstream/libdatetime-set-perl/current/t/08span.t Thu Apr  9 16:37:13 2009
@@ -3,7 +3,7 @@
 use strict;
 
 use Test::More;
-plan tests => 7;
+plan tests => 8;
 
 use DateTime;
 use DateTime::Duration;
@@ -52,5 +52,17 @@
     is( $span->duration->seconds , DateTime::Set::INFINITY, "infinite duration" );
 }
 
+{
+    # empty span
+    my $span1 = DateTime::Span->from_datetimes( 
+                    start => DateTime->new( year => 2000 ), 
+                    end   => DateTime->new( year => 2001 ) );
+    my $span2 = DateTime::Span->from_datetimes( 
+                    start => DateTime->new( year => 2003 ), 
+                    end   => DateTime->new( year => 2004 ) );
+    my $empty = $span1->intersection($span2);
+    is( $empty->duration->seconds , 0, "null duration" );
+}
+
 1;
 




More information about the Pkg-perl-cvs-commits mailing list