r29035 - in /trunk/libdatetime-set-perl: Changes MANIFEST META.yml debian/changelog lib/DateTime/Set.pm lib/DateTime/Span.pm lib/DateTime/SpanSet.pm t/00load.t t/19spanset_daylight_savings.t t/20spanset_week_wrapped_recurrence.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Thu Jan 1 17:43:57 UTC 2009


Author: gregoa
Date: Thu Jan  1 17:43:54 2009
New Revision: 29035

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=29035
Log:
New upstream release.

Added:
    trunk/libdatetime-set-perl/t/19spanset_daylight_savings.t
      - copied unchanged from r29034, branches/upstream/libdatetime-set-perl/current/t/19spanset_daylight_savings.t
    trunk/libdatetime-set-perl/t/20spanset_week_wrapped_recurrence.t
      - copied unchanged from r29034, branches/upstream/libdatetime-set-perl/current/t/20spanset_week_wrapped_recurrence.t
Modified:
    trunk/libdatetime-set-perl/Changes
    trunk/libdatetime-set-perl/MANIFEST
    trunk/libdatetime-set-perl/META.yml
    trunk/libdatetime-set-perl/debian/changelog
    trunk/libdatetime-set-perl/lib/DateTime/Set.pm
    trunk/libdatetime-set-perl/lib/DateTime/Span.pm
    trunk/libdatetime-set-perl/lib/DateTime/SpanSet.pm
    trunk/libdatetime-set-perl/t/00load.t

Modified: trunk/libdatetime-set-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-set-perl/Changes?rev=29035&op=diff
==============================================================================
--- trunk/libdatetime-set-perl/Changes (original)
+++ trunk/libdatetime-set-perl/Changes Thu Jan  1 17:43:54 2009
@@ -1,4 +1,8 @@
 Changes for DateTime::Set
+
+0.26   2008-12-25
+- fixed DateTime::Spanset current() and set_time_zone() methods. 
+  Report and tests by Elliot Shank.
 
 0.25   2005-10-05
 - t/15time_zone.t does it's own time zone "add_duration" handling

Modified: trunk/libdatetime-set-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-set-perl/MANIFEST?rev=29035&op=diff
==============================================================================
--- trunk/libdatetime-set-perl/MANIFEST (original)
+++ trunk/libdatetime-set-perl/MANIFEST Thu Jan  1 17:43:54 2009
@@ -25,6 +25,8 @@
 t/16bounded_recurrence.t
 t/17quantize.t
 t/18as_list_empty.t
+t/19spanset_daylight_savings.t       
+t/20spanset_week_wrapped_recurrence.t
 lib/DateTime/Set.pm
 lib/DateTime/Span.pm
 lib/DateTime/SpanSet.pm

Modified: trunk/libdatetime-set-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-set-perl/META.yml?rev=29035&op=diff
==============================================================================
--- trunk/libdatetime-set-perl/META.yml (original)
+++ trunk/libdatetime-set-perl/META.yml Thu Jan  1 17:43:54 2009
@@ -1,13 +1,16 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         DateTime-Set
-version:      0.25
-version_from: lib/DateTime/Set.pm
-installdirs:  site
-requires:
+--- #YAML:1.0
+name:                DateTime-Set
+version:             0.26
+abstract:            DateTime set objects
+license:             ~
+author:              
+    - Flavio S. Glock <fglock at pucrs.br>
+generated_by:        ExtUtils::MakeMaker version 6.44
+distribution_type:   module
+requires:     
     DateTime:                      0.12
     Set::Infinite:                 0.59
     Test::More:                    0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: trunk/libdatetime-set-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-set-perl/debian/changelog?rev=29035&op=diff
==============================================================================
--- trunk/libdatetime-set-perl/debian/changelog (original)
+++ trunk/libdatetime-set-perl/debian/changelog Thu Jan  1 17:43:54 2009
@@ -1,7 +1,9 @@
-libdatetime-set-perl (0.25-4) UNRELEASED; urgency=low
+libdatetime-set-perl (0.26-1) UNRELEASED; urgency=low
 
   * debian/control: Changed: Switched Vcs-Browser field to ViewSVN
     (source stanza).
+
+  * New upstream release.
 
  -- gregor herrmann <gregoa at debian.org>  Sun, 16 Nov 2008 20:41:37 +0100
 

Modified: trunk/libdatetime-set-perl/lib/DateTime/Set.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-set-perl/lib/DateTime/Set.pm?rev=29035&op=diff
==============================================================================
--- trunk/libdatetime-set-perl/lib/DateTime/Set.pm (original)
+++ trunk/libdatetime-set-perl/lib/DateTime/Set.pm Thu Jan  1 17:43:54 2009
@@ -16,7 +16,7 @@
 use constant NEG_INFINITY => -1 * (100 ** 100 ** 100);
 
 BEGIN {
-    $VERSION = '0.25';
+    $VERSION = '0.26';
 }
 
 
@@ -706,21 +706,29 @@
 
 =head1 DESCRIPTION
 
-DateTime::Set is a module for datetime sets.  It can be used to
-handle two different types of sets.
+DateTime::Set is a module for datetime sets.  It can be used to handle
+two different types of sets.
 
 The first is a fixed set of predefined datetime objects.  For example,
 if we wanted to create a set of datetimes containing the birthdays of
-people in our family.
-
-The second type of set that it can handle is one based on the idea of
-a recurrence, such as "every Wednesday", or "noon on the 15th day of
+people in our family for the current year.
+
+The second type of set that it can handle is one based on a
+recurrence, such as "every Wednesday", or "noon on the 15th day of
 every month".  This type of set can have fixed starting and ending
 datetimes, but neither is required.  So our "every Wednesday set"
 could be "every Wednesday from the beginning of time until the end of
 time", or "every Wednesday after 2003-03-05 until the end of time", or
 "every Wednesday between 2003-03-05 and 2004-01-07".
 
+This module also supports set math operations, so you do things like
+create a new set from the union or difference of two sets, check
+whether a datetime is a member of a given set, etc.
+
+This is different from a C<DateTime::Span>, which handles a continuous
+range as opposed to individual datetime points. There is also a module
+C<DateTime::SpanSet> to handle sets of spans.
+
 =head1 METHODS
 
 =over 4
@@ -734,8 +742,7 @@
 The datetimes can be objects from class C<DateTime>, or from a
 C<DateTime::Calendar::*> class.
 
-C<DateTime::Infinite::*> objects are not valid set members. 
-However, these datetimes are very useful as set boundaries.
+C<DateTime::Infinite::*> objects are not valid set members.
 
 =item * from_recurrence
 
@@ -762,20 +769,20 @@
     );
 
 The recurrence function will be passed a single parameter, a datetime
-object. The parameter can be an object from class C<DateTime>, 
-or from one of the C<DateTime::Calendar::*> classes. 
-The parameter can also be a C<DateTime::Infinite::Future> or
-a C<DateTime::Infinite::Past> object.
-
-The recurrence must return the I<next> event 
-after that object.  There is no guarantee as to what the returned 
-object will be set to, only that it will be greater than the object
-passed to the recurrence.
-If there are no more datetimes after the given parameter, 
-then the recurrence function should return C<DateTime::Infinite::Future>.
-
-It is ok to modify the parameter C<$_[0]> inside the recurrence function.
-There are no side-effects.
+object. The parameter can be an object from class C<DateTime>, or from
+one of the C<DateTime::Calendar::*> classes.  The parameter can also
+be a C<DateTime::Infinite::Future> or a C<DateTime::Infinite::Past>
+object.
+
+The recurrence must return the I<next> event after that object.  There
+is no guarantee as to what the returned object will be set to, only
+that it will be greater than the object passed to the recurrence.
+
+If there are no more datetimes after the given parameter, then the
+recurrence function should return C<DateTime::Infinite::Future>.
+
+It is ok to modify the parameter C<$_[0]> inside the recurrence
+function.  There are no side-effects.
 
 For example, if you wanted a recurrence that generated datetimes in
 increments of 30 seconds, it would look like this:
@@ -789,16 +796,17 @@
       }
   }
 
-Note that this recurrence takes leap seconds into account. 
-You should use datetime calendar methods whenever possible, 
-in order to avoid complicated arithmetic problems!
+Note that this recurrence takes leap seconds into account.  Consider
+using C<truncate()> in this manner to avoid complicated arithmetic
+problems!
 
 It is also possible to create a recurrence by specifying either or both
 of 'next' and 'previous' callbacks.
 
-The callbacks can return C<DateTime::Infinite::Future> and 
-C<DateTime::Infinite::Past> objects, in order to define I<bounded recurrences>.
-In this case, both 'next' and 'previous' callbacks must be defined:
+The callbacks can return C<DateTime::Infinite::Future> and
+C<DateTime::Infinite::Past> objects, in order to define I<bounded
+recurrences>.  In this case, both 'next' and 'previous' callbacks must
+be defined:
 
     # "monthly from $dt until forever"
 
@@ -820,9 +828,9 @@
 
 Bounded recurrences are easier to write using C<span> parameters. See above.
 
-See also C<DateTime::Event::Recurrence> and the other C<DateTime::Event::*>
-factory modules for generating specialized recurrences, 
-such as sunrise and sunset times, and holidays.
+See also C<DateTime::Event::Recurrence> and the other
+C<DateTime::Event::*> factory modules for generating specialized
+recurrences, such as sunrise and sunset times, and holidays.
 
 =item * empty_set
 
@@ -884,8 +892,8 @@
 
 The first and last C<DateTime> in the set.  These methods may return
 C<undef> if the set is empty.  It is also possible that these methods
-may return a C<DateTime::Infinite::Past> or C<DateTime::Infinite::Future> 
-object.
+may return a C<DateTime::Infinite::Past> or
+C<DateTime::Infinite::Future> object.
 
 These methods return just a I<copy> of the actual boundary value.
 If you modify the result, the set will not be modified.
@@ -916,62 +924,61 @@
 C<DateTime::Span> class's constructors, and an object will be created
 for you.
 
-Obviously, if the span you specify is not restricted both at the
-start and end, then your iterator may iterate forever, depending on
-the nature of your set.  User beware!
+Obviously, if the span you specify is not restricted both at the start
+and end, then your iterator may iterate forever, depending on the
+nature of your set.  User beware!
 
 The C<next()> or C<previous()> method will return C<undef> when there
 are no more datetimes in the iterator.
 
 =item * as_list
 
-Returns the set elements as a list of C<DateTime> objects.
-Just as with the C<iterator()> method, the C<as_list()> method can be
-limited by a span.  
+Returns the set elements as a list of C<DateTime> objects.  Just as
+with the C<iterator()> method, the C<as_list()> method can be limited
+by a span.
 
   my @dt = $set->as_list( span => $span );
 
-Applying C<as_list()> to a large recurrence set is a very expensive operation, both in 
-CPU time and in the memory used.
-If you I<really> need to extract elements from a large set, you can
-limit the set with a shorter span:
+Applying C<as_list()> to a large recurrence set is a very expensive
+operation, both in CPU time and in the memory used.  If you I<really>
+need to extract elements from a large set, you can limit the set with
+a shorter span:
 
     my @short_list = $large_set->as_list( span => $short_span );
 
-For I<infinite> sets, C<as_list()> will return C<undef>.
-Please note that this is explicitly not an empty list, since an empty list is a valid
-return value for empty sets!
+For I<infinite> sets, C<as_list()> will return C<undef>.  Please note
+that this is explicitly not an empty list, since an empty list is a
+valid return value for empty sets!
 
 =item * count
 
-Returns a count of C<DateTime> objects in the set.
-Just as with the C<iterator()> method, the C<count()> method can be
-limited by a span.  
+Returns a count of C<DateTime> objects in the set.  Just as with the
+C<iterator()> method, the C<count()> method can be limited by a span.
 
   defined( my $n = $set->count) or die "can't count";
-  
+
   my $n = $set->count( span => $span );
   die "can't count" unless defined $n;
-  
-Applying C<count()> to a large recurrence set is a very expensive operation, 
-both in CPU time and in the memory used.
-If you I<really> need to count elements from a large set, you can 
-limit the set with a shorter span:
+
+Applying C<count()> to a large recurrence set is a very expensive
+operation, both in CPU time and in the memory used.  If you I<really>
+need to count elements from a large set, you can limit the set with a
+shorter span:
 
     my $count = $large_set->count( span => $short_span );
 
-For I<infinite> sets, C<count()> will return C<undef>.
-Please note that this is explicitly not a scalar zero, since a zero count
-is a valid return value for empty sets!
+For I<infinite> sets, C<count()> will return C<undef>.  Please note
+that this is explicitly not a scalar zero, since a zero count is a
+valid return value for empty sets!
 
 =item * union
 
-=item * intersection 
+=item * intersection
 
 =item * complement
 
-These set operation methods can accept a C<DateTime> list, 
-a C<DateTime::Set>, a C<DateTime::Span>, or a C<DateTime::SpanSet> 
+These set operation methods can accept a C<DateTime> list, a
+C<DateTime::Set>, a C<DateTime::Span>, or a C<DateTime::SpanSet>
 object as an argument.
 
     $set = $set1->union( $set2 );         # like "OR", "insert", "both"
@@ -985,8 +992,8 @@
 If C<complement> is called without any arguments, then the result is a
 C<DateTime::SpanSet> object representing the spans between each of the
 set's elements.  If complement is given an argument, then the return
-value is a C<DateTime::Set> object representing the
-I<set difference> between the sets.
+value is a C<DateTime::Set> object representing the I<set difference>
+between the sets.
 
 All other operations will always return a C<DateTime::Set>.
 
@@ -999,8 +1006,8 @@
     if ( $set1->intersects( $set2 ) ) { ...  # like "touches", "interferes"
     if ( $set1->contains( $dt ) ) { ...    # like "is-fully-inside"
 
-These methods can accept a C<DateTime> list, a C<DateTime::Set>,
-a C<DateTime::Span>, or a C<DateTime::SpanSet> object as an argument.
+These methods can accept a C<DateTime> list, a C<DateTime::Set>, a
+C<DateTime::Span>, or a C<DateTime::SpanSet> object as an argument.
 
 =item * previous
 
@@ -1027,9 +1034,8 @@
 All of these methods may return C<undef> if there is no matching
 datetime in the set.
 
-These methods will try to set the returned value 
-to the same time zone as the argument, unless the argument
-has a 'floating' time zone.
+These methods will try to set the returned value to the same time zone
+as the argument, unless the argument has a 'floating' time zone.
 
 =item * map ( sub { ... } )
 
@@ -1050,32 +1056,29 @@
 
 This method is the "set" version of Perl "map".
 
-It evaluates a subroutine for each element of
-the set (locally setting "$_" to each datetime)
-and returns the set composed of the results of
+It evaluates a subroutine for each element of the set (locally setting
+"$_" to each datetime) and returns the set composed of the results of
 each such evaluation.
 
-Like Perl "map", each element of the set
-may produce zero, one, or more elements in the 
-returned value.
-
-Unlike Perl "map", changing "$_" does not change
-the original set. This means that calling map
-in void context has no effect.
-
-The callback subroutine may be called later in the program,
-due to lazy evaluation.
-So don't count on subroutine side-effects. For example,
-a C<print> inside the subroutine may happen later than you expect.
+Like Perl "map", each element of the set may produce zero, one, or
+more elements in the returned value.
+
+Unlike Perl "map", changing "$_" does not change the original
+set. This means that calling map in void context has no effect.
+
+The callback subroutine may be called later in the program, due to
+lazy evaluation.  So don't count on subroutine side-effects. For
+example, a C<print> inside the subroutine may happen later than you
+expect.
 
 The callback return value is expected to be within the span of the
-C<previous> and the C<next> element in the original set.
-This is a limitation of the backtracking algorithm used in
-the C<Set::Infinite> library.
-
-For example: given the set C<[ 2001, 2010, 2015 ]>,
-the callback result for the value C<2010> is expected to be
-within the span C<[ 2001 .. 2015 ]>.
+C<previous> and the C<next> element in the original set.  This is a
+limitation of the backtracking algorithm used in the C<Set::Infinite>
+library.
+
+For example: given the set C<[ 2001, 2010, 2015 ]>, the callback
+result for the value C<2010> is expected to be within the span C<[
+2001 .. 2015 ]>.
 
 =item * grep ( sub { ... } )
 
@@ -1088,21 +1091,19 @@
 
 This method is the "set" version of Perl "grep".
 
-It evaluates a subroutine for each element of
-the set (locally setting "$_" to each datetime)
-and returns the set consisting of those elements 
-for which the expression evaluated to true.
-
-Unlike Perl "grep", changing "$_" does not change
-the original set. This means that calling grep
-in void context has no effect.
+It evaluates a subroutine for each element of the set (locally setting
+"$_" to each datetime) and returns the set consisting of those
+elements for which the expression evaluated to true.
+
+Unlike Perl "grep", changing "$_" does not change the original
+set. This means that calling grep in void context has no effect.
 
 Changing "$_" does change the resulting set.
 
-The callback subroutine may be called later in the program,
-due to lazy evaluation.
-So don't count on subroutine side-effects. For example,
-a C<print> inside the subroutine may happen later than you expect.
+The callback subroutine may be called later in the program, due to
+lazy evaluation.  So don't count on subroutine side-effects. For
+example, a C<print> inside the subroutine may happen later than you
+expect.
 
 =item * iterate ( sub { ... } )
 
@@ -1120,16 +1121,17 @@
 
 Flavio Soibelmann Glock <fglock at pucrs.br>
 
-The API was developed together with Dave Rolsky and the DateTime Community.
+The API was developed together with Dave Rolsky and the DateTime
+Community.
 
 =head1 COPYRIGHT
 
-Copyright (c) 2003, 2004 Flavio Soibelmann Glock. All rights reserved.
-This program is free software; you can distribute it and/or
-modify it under the same terms as Perl itself.
-
-The full text of the license can be found in the LICENSE file
-included with this module.
+Copyright (c) 2003-2006 Flavio Soibelmann Glock. All rights reserved.
+This program is free software; you can distribute it and/or modify it
+under the same terms as Perl itself.
+
+The full text of the license can be found in the LICENSE file included
+with this module.
 
 =head1 SEE ALSO
 

Modified: trunk/libdatetime-set-perl/lib/DateTime/Span.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-set-perl/lib/DateTime/Span.pm?rev=29035&op=diff
==============================================================================
--- trunk/libdatetime-set-perl/lib/DateTime/Span.pm (original)
+++ trunk/libdatetime-set-perl/lib/DateTime/Span.pm Thu Jan  1 17:43:54 2009
@@ -331,7 +331,13 @@
 
 =head1 DESCRIPTION
 
-DateTime::Span is a module for date/time spans or time-ranges. 
+C<DateTime::Span> is a module for handling datetime spans, otherwise
+known as ranges or periods ("from X to Y, inclusive of all datetimes
+in between").
+
+This is different from a C<DateTime::Set>, which is made of individual
+datetime points as opposed to a range. There is also a module
+C<DateTime::SpanSet> to handle sets of spans.
 
 =head1 METHODS
 
@@ -363,8 +369,12 @@
    $span = DateTime::Span->from_datetimes( before => $dt2 );
 
 You cannot give both a "start" and "after" argument, nor can you give
-both an "end" and "before" argument.  Either of these conditions 
-will cause the C<from_datetimes()> method to die.
+both an "end" and "before" argument.  Either of these conditions will
+cause the C<from_datetimes()> method to die.
+
+To summarize, a datetime passed as either "start" or "end" is included
+in the span.  A datetime passed as either "after" or "before" is
+excluded from the span.
 
 =item * from_datetime_and_duration
 
@@ -404,12 +414,10 @@
 
 =item * end
 
-First or last dates in the span.  
-
-It is possible that the return value
-from these methods may be a 
-DateTime::Infinite::Future or a 
-DateTime::Infinite::Past object.
+First or last dates in the span.
+
+It is possible that the return value from these methods may be a
+C<DateTime::Infinite::Future> or a C<DateTime::Infinite::Past>xs object.
 
 If the set ends C<before> a date C<$dt>, it returns C<$dt>. Note that
 in this case C<$dt> is not a set element - but it is a set boundary.
@@ -475,9 +483,9 @@
 
 =head1 COPYRIGHT
 
-Copyright (c) 2003 Flavio Soibelmann Glock. All rights reserved.
-This program is free software; you can distribute it and/or
-modify it under the same terms as Perl itself.
+Copyright (c) 2003-2006 Flavio Soibelmann Glock. All rights reserved.
+This program is free software; you can distribute it and/or modify it
+under the same terms as Perl itself.
 
 The full text of the license can be found in the LICENSE file
 included with this module.

Modified: trunk/libdatetime-set-perl/lib/DateTime/SpanSet.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-set-perl/lib/DateTime/SpanSet.pm?rev=29035&op=diff
==============================================================================
--- trunk/libdatetime-set-perl/lib/DateTime/SpanSet.pm (original)
+++ trunk/libdatetime-set-perl/lib/DateTime/SpanSet.pm Thu Jan  1 17:43:54 2009
@@ -85,12 +85,12 @@
             if ( ref($min) )
             {
                 $min = $min->clone;
-                $min->set_time_zone( $tz );
+                $min->set_time_zone( 'floating' );
             }
             if ( ref($max) )
             {
                 $max = $max->clone;
-                $max->set_time_zone( $tz );
+                $max->set_time_zone( 'floating' ); 
             }
             return Set::Infinite::_recurrence->new( $min, $max );
         },
@@ -292,10 +292,30 @@
 sub current {
     my $self = shift;
 
-    my $return = $self->intersected_spans( $_[0] );
-
-    $return = $self->previous( $_[0] )
-        if ( ! defined $return->max );
+    my $previous;
+    my $next;
+    {
+        my $min;
+        $min = $_[0]->min if UNIVERSAL::can( $_[0], 'union' );
+        $min = $_[0] if ! defined $min;
+        return undef if ! ref( $min ) && $min == INFINITY;
+        my $span = DateTime::Span->from_datetimes( end => $min );
+        my $iterator = $self->intersection( $span );
+        $previous = $iterator->previous;
+        $span = DateTime::Span->from_datetimes( start => $min );
+        $iterator = $self->intersection( $span );
+        $next = $iterator->next;
+    }
+    return $previous unless defined $next;
+
+    my $dt1 = defined $previous
+        ? $next->union( $previous )
+        : $next;
+
+    my $return = $dt1->intersected_spans( $_[0] );
+
+    $return = $previous
+        if !defined $return->max;
 
     bless $return, 'DateTime::SpanSet'
         if defined $return;
@@ -542,9 +562,12 @@
 
 =head1 DESCRIPTION
 
-DateTime::SpanSet is a class that represents sets of datetime spans.
-An example would be a recurring meeting that occurs from 13:00-15:00
-every Friday.
+C<DateTime::SpanSet> is a class that represents sets of datetime
+spans.  An example would be a recurring meeting that occurs from
+13:00-15:00 every Friday.
+
+This is different from a C<DateTime::Set>, which is made of individual
+datetime points as opposed to ranges.
 
 =head1 METHODS
 
@@ -658,11 +681,11 @@
 that intersects a given datetime or span. If no current span
 is found, then the "previous" span is returned.
 
-The return value is a C<DateTime::SpanSet>, or C<undef> if there is no matching
-span in the set.
-
-If a span parameter is given, it may happen that "current" 
-returns more than one span.
+The return value is a C<DateTime::SpanSet>, or C<undef> if there is no
+matching span in the set.
+
+If a span parameter is given, it may happen that "current" returns
+more than one span.
 
 See also: C<intersected_spans()> method.
 
@@ -670,14 +693,14 @@
 
   my $span = $set->closest( $dt );
 
-This method is used to find the "closest" span in the set,
-given a datetime or span. 
-
-The return value is a C<DateTime::SpanSet>, or C<undef> if the
-set is empty.
-
-If a span parameter is given, it may happen that "closest" 
-returns more than one span.
+This method is used to find the "closest" span in the set, given a
+datetime or span.
+
+The return value is a C<DateTime::SpanSet>, or C<undef> if the set is
+empty.
+
+If a span parameter is given, it may happen that "closest" returns
+more than one span.
 
 =item * as_list
 
@@ -688,15 +711,15 @@
 Just as with the C<iterator()> method, the C<as_list()> method can be
 limited by a span.
 
-Applying C<as_list()> to a large recurring spanset is a very expensive operation, 
-both in CPU time and in the memory used.
-
-For this reason, when C<as_list()> operates on large recurrence sets, it will 
-return at most approximately 200 spans. For larger sets, and for I<infinite> 
-sets, C<as_list()> will return C<undef>.
-
-Please note that this is explicitly not an empty list, since an empty list is a 
-valid return value for empty sets!
+Applying C<as_list()> to a large recurring spanset is a very expensive
+operation, both in CPU time and in the memory used.
+
+For this reason, when C<as_list()> operates on large recurrence sets,
+it will return at most approximately 200 spans. For larger sets, and
+for I<infinite> sets, C<as_list()> will return C<undef>.
+
+Please note that this is explicitly not an empty list, since an empty
+list is a valid return value for empty sets!
 
 If you I<really> need to extract spans from a large set, you can:
 
@@ -728,17 +751,16 @@
 
 =item * intersected_spans
 
-This method can accept a C<DateTime> list,
-a C<DateTime::Set>, a C<DateTime::Span>, or a C<DateTime::SpanSet>
-object as an argument.
+This method can accept a C<DateTime> list, a C<DateTime::Set>, a
+C<DateTime::Span>, or a C<DateTime::SpanSet> object as an argument.
 
     $set = $set1->intersected_spans( $set2 );
 
-The method always returns a C<DateTime::SpanSet> object,
-containing all spans that are intersected by the given set.
-
-Unlike the C<intersection> method, the spans are not modified.
-See diagram below:
+The method always returns a C<DateTime::SpanSet> object, containing
+all spans that are intersected by the given set.
+
+Unlike the C<intersection> method, the spans are not modified.  See
+diagram below:
 
                set1   [....]   [....]   [....]   [....]
                set2      [................]
@@ -781,8 +803,8 @@
 start and end, then your iterator may iterate forever, depending on
 the nature of your set.  User beware!
 
-The C<next()> or C<previous()> methods will return C<undef> 
-when there are no more spans in the iterator.
+The C<next()> or C<previous()> methods will return C<undef> when there
+are no more spans in the iterator.
 
 =item * start_set
 
@@ -790,9 +812,11 @@
 
 These methods do the inverse of the C<from_sets> method:
 
-C<start_set> retrieves a DateTime::Set with the start datetime of each span.
-
-C<end_set> retrieves a DateTime::Set with the end datetime of each span.
+C<start_set> retrieves a DateTime::Set with the start datetime of each
+span.
+
+C<end_set> retrieves a DateTime::Set with the end datetime of each
+span.
 
 =item * map ( sub { ... } )
 
@@ -810,29 +834,26 @@
 
 This method is the "set" version of Perl "map".
 
-It evaluates a subroutine for each element of
-the set (locally setting "$_" to each DateTime::Span)
-and returns the set composed of the results of
-each such evaluation.
-
-Like Perl "map", each element of the set
-may produce zero, one, or more elements in the 
-returned value.
-
-Unlike Perl "map", changing "$_" does not change
-the original set. This means that calling map
-in void context has no effect.
-
-The callback subroutine may not be called immediately.
-Don't count on subroutine side-effects. For example,
-a C<print> inside the subroutine may happen later than you expect.
+It evaluates a subroutine for each element of the set (locally setting
+"$_" to each DateTime::Span) and returns the set composed of the
+results of each such evaluation.
+
+Like Perl "map", each element of the set may produce zero, one, or
+more elements in the returned value.
+
+Unlike Perl "map", changing "$_" does not change the original
+set. This means that calling map in void context has no effect.
+
+The callback subroutine may not be called immediately.  Don't count on
+subroutine side-effects. For example, a C<print> inside the subroutine
+may happen later than you expect.
 
 The callback return value is expected to be within the span of the
 C<previous> and the C<next> element in the original set.
 
-For example: given the set C<[ 2001, 2010, 2015 ]>,
-the callback result for the value C<2010> is expected to be
-within the span C<[ 2001 .. 2015 ]>.
+For example: given the set C<[ 2001, 2010, 2015 ]>, the callback
+result for the value C<2010> is expected to be within the span C<[
+2001 .. 2015 ]>.
 
 =item * grep ( sub { ... } )
 
@@ -846,32 +867,31 @@
 
 This method is the "set" version of Perl "grep".
 
-It evaluates a subroutine for each element of
-the set (locally setting "$_" to each DateTime::Span)
-and returns the set consisting of those elements 
-for which the expression evaluated to true.
-
-Unlike Perl "grep", changing "$_" does not change
-the original set. This means that calling grep
-in void context has no effect.
+It evaluates a subroutine for each element of the set (locally setting
+"$_" to each DateTime::Span) and returns the set consisting of those
+elements for which the expression evaluated to true.
+
+Unlike Perl "grep", changing "$_" does not change the original
+set. This means that calling grep in void context has no effect.
 
 Changing "$_" does change the resulting set.
 
-The callback subroutine may not be called immediately.
-Don't count on subroutine side-effects. For example,
-a C<print> inside the subroutine may happen later than you expect.
+The callback subroutine may not be called immediately.  Don't count on
+subroutine side-effects. For example, a C<print> inside the subroutine
+may happen later than you expect.
 
 =item * iterate
 
 I<Internal method - use "map" or "grep" instead.>
 
-This function apply a callback subroutine to all elements of a set
-and returns the resulting set.
-
-The parameter C<$_[0]> to the callback subroutine is a C<DateTime::Span>
-object.
-
-If the callback returns C<undef>, the datetime is removed from the set:
+This function apply a callback subroutine to all elements of a set and
+returns the resulting set.
+
+The parameter C<$_[0]> to the callback subroutine is a
+C<DateTime::Span> object.
+
+If the callback returns C<undef>, the datetime is removed from the
+set:
 
     sub remove_sundays {
         $_[0] unless $_[0]->start->day_of_week == 7;
@@ -880,13 +900,13 @@
 The callback return value is expected to be within the span of the
 C<previous> and the C<next> element in the original set.
 
-For example: given the set C<[ 2001, 2010, 2015 ]>,
-the callback result for the value C<2010> is expected to be
-within the span C<[ 2001 .. 2015 ]>.
-
-The callback subroutine may not be called immediately.
-Don't count on subroutine side-effects. For example,
-a C<print> inside the subroutine may happen later than you expect.
+For example: given the set C<[ 2001, 2010, 2015 ]>, the callback
+result for the value C<2010> is expected to be within the span C<[
+2001 .. 2015 ]>.
+
+The callback subroutine may not be called immediately.  Don't count on
+subroutine side-effects. For example, a C<print> inside the subroutine
+may happen later than you expect.
 
 =back
 

Modified: trunk/libdatetime-set-perl/t/00load.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdatetime-set-perl/t/00load.t?rev=29035&op=diff
==============================================================================
--- trunk/libdatetime-set-perl/t/00load.t (original)
+++ trunk/libdatetime-set-perl/t/00load.t Thu Jan  1 17:43:54 2009
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# $Header: /cvsroot/perl-date-time/modules/DateTime-Set/t/00load.t,v 1.2 2003/05/14 17:38:43 fglock Exp $
+# $Header$
 
 use Test::More;
 




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