Re: RFC: API for DateTime::Business:Week
Flavio S. Glock wrote: About the API: when you said It could then be extended ... you mean another module, right? I think you are defining a lot of functionality, beyond ::Week. - Flavio S. Glock Yup, that's true. So what do we have? DateTime::Business::Week Define a week as an infinite spanset - Should this return a DateTime::Spanset or should it @ISA spanset? DateTime::Business::Employee All the other stuff I figure we have these two modules although I could easily put the week definition into the Employee module. I think it would be best not to because we'll probably need the 'week' object for other things and there may be other things that should go into the Week module. Cheers! Rick
DateTime::Locale-register Errors
Hi everybody, I'm trying to make some custom locales and I've been having trouble getting the register method to work. Even using the example code: DateTime::Locale-register ( id = 'en_GB_RIDAS', en_language = 'English', en_territory = 'United Kingdom', en_variant = 'Ridas Custom Locale', ); gives me: Can't use string (id) as a HASH ref while strict refs in use at /usr/lib/perl5/site_perl/5.8.0/DateTime/Locale.pm line 37. Lines 35-37 being: foreach my $l ( ref $_[0] ? @{ $_[0] } : $_[0] ) { my @p = %$l; Only 'id' is being used to create @p and perl is getting very confused. Shouldn't $l be set to all items in @_ and not just $_[0]? Line 35 would then be something like (untested): foreach my $l ( ref $_[0] ? @{ $_[0] } : @_ ) The documentation also mentions that the id method is required for new custom locales, where abouts is id defined for the default locales? Cheers, David Hood
Re: DateTime::Locale-register Errors
On Sat, 4 Oct 2003, [NS]Elgyn wrote: Hi everybody, I'm trying to make some custom locales and I've been having trouble getting the register method to work. Even using the example code: DateTime::Locale-register ( id = 'en_GB_RIDAS', en_language = 'English', en_territory = 'United Kingdom', en_variant = 'Ridas Custom Locale', ); gives me: Can't use string (id) as a HASH ref while strict refs in use at /usr/lib/perl5/site_perl/5.8.0/DateTime/Locale.pm line 37. This is a mistake in the docs. Register takes an array of hash references. It'll be fixed in the next release. The documentation also mentions that the id method is required for new custom locales, where abouts is id defined for the default locales? These are all in the DateTime/LocaleCatalog.pm file. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
ANNOUNCE: DateTime::Locale 0.04
0.04 2003-10-03 - The documentation incorrectly showed the DateTime::Locale-register method as taking an array, rather than an array of hash references. Reported by David Hood. The code is identical to 0.03. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
DateTime Problem with nmake test
Any ideas as to what the problem is?? Not all tests passed for nmake test when installing DateTime.pm. There were no issues with nmake. I have Perl 5.8 with VC++ 5 (latest service pack) Please message below: D:\Perl\bin\perl.exe -MExtUtils::Command::MM -e test_harness(0, 'blib\lib', 'blib\arch') t\00load.t t\01sanity.t t\02last_day.t t\03components.t t\04epoch.t t\05set.t t\06add.t t\07compare.t t\09greg.t t\10subtract.t t\11duration.t t\12week.t t\13strftime.t t\14locale.t t\15jd.t t\16truncate.t t\17set_return.t t\18today.t t\19leap_second.t t\20infinite.t t\21bad_params.t t\22from_doy.t t\23storable.t t\24from_object.t t\25add_subtract.t t\26dt_leapsecond_pm.t t\00loadok t\01sanity..ok t\02last_dayok t\03components..ok t\04epoch...ok 4/32 skipped: Negative epoch times do not work on some operating systems, including Win32 t\05set.ok t\06add.ok t\07compare.ok t\09gregok t\10subtractok t\11durationok t\12weekok t\13strftimeok t\14locale..ok t\15jd..ok t\16truncateok t\17set_return..ok t\18today...ok t\19leap_second.ok t\20infinitedubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 12-13 Failed 2/39 tests, 94.87% okay t\21bad_params..ok t\22from_doyok t\23storableok t\24from_object.ok t\25add_subtractok t\26dt_leapsecond_pmok Failed TestStat Wstat Total Fail Failed List of Failed --- t\20infinite.t2 512392 5.13% 12-13 4 subtests skipped. # this may take a minute... # New locale: de # New locale: it # Failed test (t\20infinite.t at line 61) # got: '-2147483648' # expected: '2147483648' # Failed test (t\20infinite.t at line 61) # got: '-2147483646' # expected: '2147483648' # Looks like you failed 2 tests of 39. Failed 1/26 test scripts, 96.15% okay. 2/1494 subtests failed, 99.87% oka NMAKE : fatal error U1077: 'D:\Perl\bin\perl.exe' : return code '0xff' Stop.
Re: DateTime Problem with nmake test
On Fri, 3 Oct 2003, Michael and Alice Smith wrote: Any ideas as to what the problem is?? # Failed test (t\20infinite.t at line 61) # got: '-2147483648' # expected: '2147483648' # Failed test (t\20infinite.t at line 61) # got: '-2147483646' # expected: '2147483648' # Looks like you failed 2 tests of 39. Failed 1/26 test scripts, 96.15% okay. 2/1494 subtests failed, 99.87% oka NMAKE : fatal error U1077: 'D:\Perl\bin\perl.exe' : return code '0xff' Stop. the infinite stuff has known but as yet unfixed problems on Win32 (and elsewhere) In general, it seems like Perl's handling of IEEE infinite numbers isn't quite up to snuff across all platforms. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: DateTime::TimeZone :: dieing on non existing timezone
On Thu, 2 Oct 2003, Mathieu wrote: to my problem i didn't spotted ? If it's the proper way is there any chance it will be included in a future release ? It's definitely not the proper way, but I could be persuaded to add a DateTime::TimeZone-zone_name_is_valid method. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: DT-subtraction bugs in DT::F::Excel and DT::Event::Sunrise
Dave Rolsky schreef: On Fri, 3 Oct 2003, Eugene van der Pijll wrote: $dt1-subtract_datetime( $dt2, [ 'months', 'days', 'minutes', 'seconds' ] ); It's not hard, just a little bit of math. I'm more concerned with the API. I don't like the one you have up there, but I don't want to just change the existing syntax either, maybe something like: $dt1-subtract_datetime( $dt2 ); # current behavior $dt1-subtract_datetime( datetime = $dt2, units = [ qw( days minutes nanoseconds ) ] ); I didn't really like my API either, but a function with two different API's isn't very nice either. I can live with both, though, if there is no better solution. Eugene
Re: RFC: API for DateTime::Business:Week (was Re: Time Delta)
On Thu, 2 Oct 2003, RIck Measham wrote: $working_hours = new DateTime::Business::Week( days = [1 .. 5], start = {hour = 9, minute = 0}, end = {hour = 17, minute = 30} ); and, for those with more complex weeks: $working_hours = new DateTime::Business::Week( { days = [3 .. 5], start = {hour = 9, minute = 0}, end = {hour = 17, minute = 30} }, { days = 6, start = {hour = 9, minute = 0}, end = {hour = 17, minute = 00} }, { days = 7, start = {hour = 10, minute = 30}, end = {hour = 16, minute = 30} }, ); This all looks reasonable. Basically Business::Week-new would return an infinite spanset for all working hours. Actually, it should probably be something that _contains_ a span set. It could then be extended to allow for spans so we can include historical data: $working_hours-history( span = $span, week = $business_week ); And such things as a finite span: $working_hours-set_start($dt1); # start of employment $working_hours-set_end($dt2); # sacked! In this case I think we might want to create a new object, something like: my $finite_working_hours = $working_hours-finite_chunk( start = $dt1, end = $dt2 ); Then we could create other spansets for employee related information $working_hours-public_holiday( $recurrence ); # or $span or $spanset I see us needing a couple things: - Recording the fact that certain days are special non-work days. This includes both public holidays, company holidays, one shot things like fumigating the building, etc. We not only want to record when these are, but their names (Christmas, Company Founder's B-Day, Fumigation Day, etc.) and possibly other arbitrary data associated with them. - Partial work days, which could again be a recurrence or a one-shot deal. These need a name and a start/end time of day. $working_hours-annual_leave( $span ); # or $spanset $working_hours-sick_leave( $span ); # or $spanset This seems like it belongs in a different module. Then we can set a project for a particular span: $working_hours-project( name = 'Project X', span = $span, # or $spanset ); If given a 'name' this method returns spanset for that project. ditto Now we can get a complete record of activity: print $working_hours-activity( $datetime ); # Annual Leave print $working_hours-activity_span( $datetime )-min-ymd; # 2003-08-12 print $working_hours-activity_span( $datetime )-max-ymd; # 2003-08-19 ditto again. And we need a quick boolean test to see if the person was actually at work print Absent unless $working_hours-at_work; ditto Comments/Thoughts/...? I think you're mixing two sets of functionality. The first thing we need is a business calendar module that lets us define standard work days/hours, days off, and partial days. It should also be able to do calculations like, tell us how many business days occur between two dates, how many business hours/minutes occur between two datetimes, and generally let us do business datetime math. Then we can use that module in another module that implements the per-employee stuff you're interested in. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Fw: DateTime
Forwarding to [EMAIL PROTECTED] as requested. Question below. - James M Snell [EMAIL PROTECTED] http://www.ibm.com (877) 511-5082 / Office 930-1979 / Tie Line - Forwarded by James M Snell/Fresno/IBM on 10/03/2003 03:03 PM - Dave Rolsky [EMAIL PROTECTED] 10/03/2003 02:27 PM To James M Snell/Fresno/[EMAIL PROTECTED] cc Subject Re: DateTime Can you send this to the [EMAIL PROTECTED] list? On Fri, 3 Oct 2003, James M Snell wrote: Hello Dave, I'm trying to use DateTime in ActiveState's Perl 5.8.0.806 build for Windows. I've installed the packages from CPAN: perl -CPAN -e shell install DateTime But the installation fails when it tries to run the tests: C:\Environment\Perl\bin\perl.exe -MExtUtils::Command::MM -e test_harness(0, 'blib\lib', 'blib\arch') t\00load.t t\01sanity.t t\02last_day.t t\03components.t t\04epoch.t t\05set.t t\06add .t t\07compare.t t\09greg.t t\10subtract.t t\11duration.t t\12week.t t\13strftime.t t\14locale.t t\1 5jd.t t\16truncate.t t\17set_return.t t\18today.t t\19leap_second.t t\20infinite.t t\21bad_params.t t\22from_doy.t t\23storable.t t\24from_object.t t\25add_subtract.t t\26dt_leapsecond_pm.t t\00loadNOK 1# Failed test (t\00load.t at line 6) # Tried to use 'DateTime'. # Error: Can't locate loadable object for module DateTime in @INC (@INC contains: C:\.cpan\buil d\DateTime-0.1703\blib\lib C:\.cpan\build\DateTime-0.1703\blib\arch C:/Environment/Perl/lib C:/Envir onment/Perl/site/lib . C:/Environment/Perl/lib C:/Environment/Perl/site/lib .) at C:\.cpan\build\Dat eTime-0.1703\blib\lib/DateTime.pm line 43 # BEGIN failed--compilation aborted at C:\.cpan\build\DateTime-0.1703\blib\lib/DateTime.pm line 43. # Compilation failed in require at (eval 1) line 2. # Looks like you failed 1 tests of 1. t\00loaddubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 1 Failed 1/1 tests, 0.00% okay The problem is the Can't locate loadable object for module DateTime. It appears to be an issue with the use of XSLoader but I just haven't been able to track it down. Any ideas on what may be causing this? - James M Snell [EMAIL PROTECTED] http://www.ibm.com (877) 511-5082 / Office 930-1979 / Tie Line /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: Fw: DateTime
On Fri, 3 Oct 2003, James M Snell wrote: But the installation fails when it tries to run the tests: C:\Environment\Perl\bin\perl.exe -MExtUtils::Command::MM -e test_harness(0, 'blib\lib', 'blib\arch') t\00load.t t\01sanity.t t\02last_day.t t\03components.t t\04epoch.t t\05set.t t\06add .t t\07compare.t t\09greg.t t\10subtract.t t\11duration.t t\12week.t t\13strftime.t t\14locale.t t\1 5jd.t t\16truncate.t t\17set_return.t t\18today.t t\19leap_second.t t\20infinite.t t\21bad_params.t t\22from_doy.t t\23storable.t t\24from_object.t t\25add_subtract.t t\26dt_leapsecond_pm.t t\00loadNOK 1# Failed test (t\00load.t at line 6) # Tried to use 'DateTime'. # Error: Can't locate loadable object for module DateTime in @INC (@INC contains: C:\.cpan\buil d\DateTime-0.1703\blib\lib C:\.cpan\build\DateTime-0.1703\blib\arch C:/Environment/Perl/lib C:/Envir onment/Perl/site/lib . C:/Environment/Perl/lib C:/Environment/Perl/site/lib .) at C:\.cpan\build\Dat eTime-0.1703\blib\lib/DateTime.pm line 43 # BEGIN failed--compilation aborted at C:\.cpan\build\DateTime-0.1703\blib\lib/DateTime.pm line 43. # Compilation failed in require at (eval 1) line 2. # Looks like you failed 1 tests of 1. t\00loaddubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 1 Failed 1/1 tests, 0.00% okay The problem is the Can't locate loadable object for module DateTime. It appears to be an issue with the use of XSLoader but I just haven't been able to track it down. Any ideas on what may be causing this? Is there there actually a compiled DateTime.so? If not, then it's not an XSLoader problem, it's just that nothing is being compiled. If it is, then is it in any of the places that XSLoader is looking for it? -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: RFC: API for DateTime::Business:Week (was Re: Time Delta)
On 2003-10-03 Dave Rolsky wrote: I see us needing a couple things: - Recording the fact that certain days are special non-work days. This includes both public holidays, company holidays, one shot things like fumigating the building, etc. We not only want to record when these are, but their names (Christmas, Company Founder's B-Day, Fumigation Day, etc.) and possibly other arbitrary data associated with them. But this should really be kept to a minimum imo, perhaps just one additional field for a key to look up the associated data somewhere else. Individual days might collect several layers of special information. And whatever approach is used, we need to be able to look things up both ways, i.e., by the date and by the special datum. Otherwise Fumigation Day could get scheduled for Founder's B-Day. In some of my production calendars, each day has 30 or 40 pieces of associated information, so I use date methods to derive the set of dates, then create a table -- in memory or database -- with the dates as primary keys. When the layout program calls for a date, it gets an object with all that date's info plus self-awareness of its place in the set. From this perspective, I wouldn't need DateTime::Business to do much besides provide the sets or spans, plus the math. I suppose DT::Biz could provide an API for populating the individual date objects, which would then inherit DT::Biz math etc methods; maybe this is what you meant. My caution is just to keep in mind that the associated data can multiply, and a structure that incorporates the associated data for a whole set of dates/times could get large. Dave also said in response to some advance thinking by Rick: The first thing we need is a business calendar module that lets us define standard work days/hours, days off, and partial days. It should also be able to do calculations like, tell us how many business days occur between two dates, how many business hours/minutes occur between two datetimes, and generally let us do business datetime math. Then we can use that module in another module that implements the per-employee stuff you're interested in. Dave++ And Flavio said in anther message: How about trying to figure out a rough DateTime::Business::* directory structure? It would also help other authors to find out where to put their modules. Flavio++ - Bruce __bruce__van_allen__santa_cruz__ca__
RE: DateTime Problem with nmake test
Hello, # New locale: it # Failed test (t\20infinite.t at line 61) # got: '-2147483648' # expected: '2147483648' # Failed test (t\20infinite.t at line 61) # got: '-2147483646' # expected: '2147483648' # Looks like you failed 2 tests of 39. Failed 1/26 test scripts, 96.15% okay. 2/1494 subtests failed, 99.87% oka NMAKE : fatal error U1077: 'D:\Perl\bin\perl.exe' : return code '0xff' Stop. This is a known problem :( No known workaround :( Ron Hill
Re: Time Delta
On Thu, 2 Oct 2003, Flavio S. Glock wrote: Rick Measham wrote: At 5:07 PM +1000 2/10/03, Scott Penrose wrote: I am trying to do the age old problem... * Here is DateTime 1 * Here is DateTime 2 * Here is the working week (Mon-Fri, 9-5) (or whatever we define) * Tell me the working hours between DateTime 1 and DateTime 2 I've been working on an extension to Time::Piece which I call Time::Period. Then you can subtract one Time::Period from another, and it gives a Time::Seconds which is the length of the first time period minus the length of the *overlapping* second time period. It'd be nice if we had an easy way to shoot this problem in the head :). eg: DateTime 1 DateTime 2 Difference 19/8/2003 16:35 20/8/2003 11:15 2:40 or - 2 hours, 40 minutes What is the simplest, shortest way. [...] G'day DateTimers, Any clues on why the intersections don't create properly? Rick: Creating a complex recurrence function is hard. It is much easier to use DT::Event::Recurrence: use DateTime; use DateTime::Span; use DateTime::Set; use DateTime::SpanSet; use DateTime::Event::Recurrence; use Data::Dumper; # For displaying results $datetime1 = DateTime-new( year = 2003, month = 8, day = 19, hour = 16, minute = 35 ); $datetime2 = DateTime-new( year = 2003, month = 8, day = 20, hour = 11, minute = 15 ); $span = DateTime::Span-from_datetimes( start = $datetime1, end = $datetime2 ); $wd_start = DateTime::Event::Recurrence-weekly( days = [ 1,2,3,4,5 ], hours = [ 9 ], ); $wd_end = DateTime::Event::Recurrence-weekly( days = [ 1,2,3,4,5 ], hours = [ 17 ], ); $working_hours = DateTime::SpanSet-from_sets( start_set = $wd_start, end_set = $wd_end, ); $relevent_work_hours = $working_hours-intersection( $span ); print Dumper($relevent_work_hours-duration-deltas); $VAR1 = 'months'; $VAR2 = 0; $VAR3 = 'days'; $VAR4 = 0; $VAR5 = 'minutes'; $VAR6 = 160; $VAR7 = 'seconds'; $VAR8 = 0; $VAR9 = 'nanoseconds'; $VAR10 = 0; - Flavio S. Glock - | Name: Tim Nelson | Because the Creator is,| | E-mail: [EMAIL PROTECTED] | I am | - BEGIN GEEK CODE BLOCK Version 3.12 GCS d+ s:- a- C++$ U++ P++ L++ E- W+++ N+ w--- V- Y+++ PGP-++ R !tv b++ DI D+ G e++ h! y- -END GEEK CODE BLOCK-
Re: ANNOUNCE: DateTime::Locale 0.04
0.04 2003-10-03 - The documentation incorrectly showed the DateTime::Locale-register method as taking an array, rather than an array of hash references. Reported by David Hood. The documentation is still incorrect, using the example given in the documentation I get: Not an ARRAY reference at /usr/lib/perl5/site_perl/5.8.0/DateTime/Locale.pm line 35. The arguments need to be contained within an array reference: DateTime::Locale-register ( [ { id = 'en_GB_RIDAS', en_language = 'English', en_territory = 'United Kingdom', en_variant = 'Ridas Custom Locale', }, ], ); This seems like a lot of extra work for a single locale, is there a reason why named arguments aren't allowed when registering only one locale? The code is identical to 0.03. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: ANNOUNCE: DateTime::Locale 0.04
On Sat, 4 Oct 2003, David Hood wrote: 0.04 2003-10-03 - The documentation incorrectly showed the DateTime::Locale-register method as taking an array, rather than an array of hash references. Reported by David Hood. The documentation is still incorrect, using the example given in the documentation I get: Not an ARRAY reference at /usr/lib/perl5/site_perl/5.8.0/DateTime/Locale.pm line 35. No, this time it's a code bug ;) This seems like a lot of extra work for a single locale, is there a reason why named arguments aren't allowed when registering only one locale? You should able to just pass hashref. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
ANNOUNCE: DateTime::Locale 0.05
This time I got the bright idea of adding those testy thingies. 0.05 2003-10-03 - Really make the documentation and code match! This time there are even tests for this. Reported by David Hood (again). - DateTime::Locale won't try to load a class if it already has a new() method. This is so you can define multiple locale subclasses in one file and load that file yourself before calling the load() method. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: Fw: DateTime
Is there there actually a compiled DateTime.so? If not, then it's not an XSLoader problem, it's just that nothing is being compiled. Doh! Teach me to be rusty on my Perl and make stuff. I just checked and what I had not noticed is that make was throwing up when it tried to launch the compiler. The DateTime object wasn't being built. Now I get to go figure out what the heck happened to by build environment. Thx. - James M Snell [EMAIL PROTECTED] http://www.ibm.com (877) 511-5082 / Office 930-1979 / Tie Line Dave Rolsky [EMAIL PROTECTED] 10/03/2003 03:12 PM To James M Snell/Fresno/[EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: Fw: DateTime On Fri, 3 Oct 2003, James M Snell wrote: But the installation fails when it tries to run the tests: C:\Environment\Perl\bin\perl.exe -MExtUtils::Command::MM -e test_harness(0, 'blib\lib', 'blib\arch') t\00load.t t\01sanity.t t\02last_day.t t\03components.t t\04epoch.t t\05set.t t\06add .t t\07compare.t t\09greg.t t\10subtract.t t\11duration.t t\12week.t t\13strftime.t t\14locale.t t\1 5jd.t t\16truncate.t t\17set_return.t t\18today.t t\19leap_second.t t\20infinite.t t\21bad_params.t t\22from_doy.t t\23storable.t t\24from_object.t t\25add_subtract.t t\26dt_leapsecond_pm.t t\00loadNOK 1# Failed test (t\00load.t at line 6) # Tried to use 'DateTime'. # Error: Can't locate loadable object for module DateTime in @INC (@INC contains: C:\.cpan\buil d\DateTime-0.1703\blib\lib C:\.cpan\build\DateTime-0.1703\blib\arch C:/Environment/Perl/lib C:/Envir onment/Perl/site/lib . C:/Environment/Perl/lib C:/Environment/Perl/site/lib .) at C:\.cpan\build\Dat eTime-0.1703\blib\lib/DateTime.pm line 43 # BEGIN failed--compilation aborted at C:\.cpan\build\DateTime-0.1703\blib\lib/DateTime.pm line 43. # Compilation failed in require at (eval 1) line 2. # Looks like you failed 1 tests of 1. t\00loaddubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 1 Failed 1/1 tests, 0.00% okay The problem is the Can't locate loadable object for module DateTime. It appears to be an issue with the use of XSLoader but I just haven't been able to track it down. Any ideas on what may be causing this? Is there there actually a compiled DateTime.so? If not, then it's not an XSLoader problem, it's just that nothing is being compiled. If it is, then is it in any of the places that XSLoader is looking for it? -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/