Skip Menu |

This queue is for tickets about the DateTime-Set CPAN distribution.

Report information
The Basics
Id: 8611
Status: resolved
Worked: 15 min
Priority: 0/
Queue: DateTime-Set

Owner: FGLOCK [...]
Requestors: rick [...]

Bug Information
Severity: Important
Broken in: 0.17
Fixed in: (no value)

Subject: DateTime::Set::from_recurrence
Download (untitled) / with headers
text/plain 3.1k
In DateTime-Set-0.17, the set is emptied if more than 210 entries are added. The following code demonstrates: use DateTime::Set; use DateTime; my $d1=DateTime->new(year=>2004,month=>1,day=>1); my $d2=$d1->clone->add(months=>47); my $set; do { $set=DateTime::Set->from_recurrence (start=>$d1,end=>$d2, recurrence=>sub { $_[0]->truncate(to=>'week')->add(weeks=>1) }); printf "%3d %s %s\n",$set->count,$set->min,$set->max,"\n"; $d2->add(weeks=>1); } while($set->count); the output: 204 2004-01-05T00:00:00 2007-11-26T00:00:00 205 2004-01-05T00:00:00 2007-12-03T00:00:00 206 2004-01-05T00:00:00 2007-12-10T00:00:00 207 2004-01-05T00:00:00 2007-12-17T00:00:00 208 2004-01-05T00:00:00 2007-12-24T00:00:00 209 2004-01-05T00:00:00 2007-12-31T00:00:00 210 2004-01-05T00:00:00 2008-01-07T00:00:00 0 2004-01-05T00:00:00 2008-01-21T00:00:00 $ perl -V Summary of my perl5 (revision 5 version 8 subversion 4) configuration: Platform: osname=darwin, osvers=7.3.0, archname=darwin-thread-multi-2level uname='darwin sherm-pendleys-computer.local 7.3.0 darwin kernel version 7.3.0: fri mar 5 14:22:55 pst 2004; root:xnuxnu-517.3.15.obj~4release_ppc power macintosh powerpc ' config_args='-Dprefix=/usr/local/cb/perl5.8.4 -Dusethreads -Duseshrplib -des' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include', optimize='-Os', cppflags='-no-cpp-precomp -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1495)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lc perllibs=-ldl -lm -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under darwin Compiled at Apr 24 2004 12:38:13 @INC: /usr/local/cb/perl5.8.4/lib/5.8.4/darwin-thread-multi-2level /usr/local/cb/perl5.8.4/lib/5.8.4 /usr/local/cb/perl5.8.4/lib/site_perl/5.8.4/darwin-thread-multi-2level /usr/local/cb/perl5.8.4/lib/site_perl/5.8.4 /usr/local/cb/perl5.8.4/lib/site_perl .
Download (untitled) / with headers
text/plain 649b
Please note that "count" is not zero - it is "undef", which means "uncountable". This happens because there is a limit on the complexity of a set, after which it is considered "too complex" to be counted. This limit is set internally to (about) 200 elements. If this limit didn't exist, it would loop for a long time trying to find the end of the set, and would use up a lot of memory. The limit only exists for recurrences - "normal" sets can have as many elements as you insert into them. ** Workaround - set up an iterator, and make a loop to count the datetimes. There is no limit for iterators - they can iterate forever. - Flavio S. Glock

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to