Re: DateTime parse(), parser()

2003-07-16 Thread Dave Rolsky
On Wed, 16 Jul 2003, Iain Truskett wrote: What do people think parsers should return if they can't parse? And what if they do parse, but DateTime doesn't want to create an object of the appropriate specification? Should we wrap our methods in evals and return undef? Should we just throw

Re: DateTime parse(), parser()

2003-07-16 Thread Rick Measham
At 3:42 PM +1000 16/7/03, Iain Truskett wrote: What do people think parsers should return if they can't parse? And what if they do parse, but DateTime doesn't want to create an object of the appropriate specification? DateTime::Undef :) If all modules return DateTime::Undef and all modules handle

Re: DateTime parse(), parser()

2003-07-16 Thread Dave Rolsky
On Wed, 16 Jul 2003, Rick Measham wrote: At 3:42 PM +1000 16/7/03, Iain Truskett wrote: What do people think parsers should return if they can't parse? And what if they do parse, but DateTime doesn't want to create an object of the appropriate specification? DateTime::Undef :) If all

Re: DateTime parse(), parser()

2003-07-16 Thread Iain Truskett
* Dave Rolsky ([EMAIL PROTECTED]) [16 Jul 2003 16:11]: [...] Fatal errors are a _good_ thing. Forging ahead with bad data and _not_ getting errors is a very, very, very bad thing. autarch++ Despite most of the _innards_ of Builder returning undef when they hit problems, all the external

Re: DateTime parse(), parser()

2003-07-16 Thread Rick Measham
On Wed, 16 Jul 2003, Iain Truskett wrote: What do people think parsers should return if they can't parse? And what if they do parse, but DateTime doesn't want to create an object of the appropriate specification? Should we wrap our methods in evals and return undef? Should we just throw

Re: DateTime parse(), parser()

2003-07-16 Thread Claus Färber
Dave Rolsky [EMAIL PROTECTED] schrieb/wrote: Fatal errors are a _good_ thing. Forging ahead with bad data and _not_ getting errors is a very, very, very bad thing. DBI has an option RaiseError. We could: . have a variable $DateTime::AutoRaise (which should be overridden using local) . have

Re: DT::F::DBI docs

2003-07-16 Thread Joshua Hoblitt
Well, there are only two modules: DT::F::MySQL and DT::F::Pg. I'd really like to see a lot more database formatters. I'm willing to do DT::F::DB2. That still leaves several major DB's unsupported: Oracle SQL Server Sybase And all the minors: mSQL SQLite InterBase Pheonix SAPs DB Access???

Re: DateTime parse(), parser()

2003-07-16 Thread Joshua Hoblitt
Actually, DT::Undef is just a special case of the proposed DT::Partial object. Not really - it's totally different state. Any partial time can already be expressed with the current DT class. We just need a means to specify the precision. -J --

Re: DateTime parse(), parser()

2003-07-16 Thread Claus Färber
Rick Measham [EMAIL PROTECTED] schrieb/wrote: Right, they won't bother using the eval (at first) and so will be forced to deal with data problems. Why is that bad? Same with not using $dt-is_undef. At least the programme fails and prints an error message instead of silently using wrong

Re: DateTime::Format::Simple and Indication of month/day/year or d/m/y in Locales...

2003-07-16 Thread Claus Färber
Ben Bennett [EMAIL PROTECTED] schrieb/wrote: On Wed, Jul 16, 2003 at 12:05:00PM +0200, Claus Färber wrote: Not all languages use suffixes when writing numbers. In German, for example, you'd just write 14. Juli. (Actually, it's spoken vierzehn*ter* Juli, but one does not write 14ter Juli; in

RE: nmake test failure on perl 5.8.0 CVS version of datetime.pm

2003-07-16 Thread Hill, Ronald
Hi Dave, [snipped] The test was wrong, I believe. Either that or the locale had a bug that is now fixed. yes, It now passes on 5.8.0 [more snippage] I can't stress this enough. When tests fail, please rerun the tests with 'make test TEST_VERBOSE=1 TEST_FILES=t/...' This gives

Re: DateTime parse(), parser()

2003-07-16 Thread Ben Bennett
On Wed, Jul 16, 2003 at 10:15:46AM -0400, John Siracusa wrote: [snip] IMO. Also, I don't think DT::Infinite is in the same boat, because that is a legitimate date (that DT::F::Simple must parse, BTW: /^([-+])?inf(?:inity)?$/i). Returning DT::Infinite is not an error! Is infinity really a

Re: DateTime parse(), parser()

2003-07-16 Thread Dave Rolsky
On Wed, 16 Jul 2003, John Siracusa wrote: Here's my take on handling parse errors, and error handling in general. 1. I don't like to (unconditionally) die from within libraries except for conditions that are totally avoidable. For example, I die if you forget to send a required argument.

Re: DateTime parse(), parser()

2003-07-16 Thread Dave Rolsky
On Tue, 15 Jul 2003, Joshua Hoblitt wrote: 2. My option: $day_of_month = STDIN; $dt-set( day = $day_of_month )-truncate( to = 'day' ); print Your day must be a number in the current month if $dt-is_undef; See, most people won't _bother_ with the 3rd line in option 2!

Re: DateTime parse(), parser()

2003-07-16 Thread Dave Rolsky
On Tue, 15 Jul 2003, Joshua Hoblitt wrote: We were talking about returning DT::Undef objects from parsers. So, for example, if the _format_ being parsed _defines_ an unknown or undefined date/time an object can be returned that reflects this. Simply returning undef when an object is

Re: DT::F::DBI docs

2003-07-16 Thread Dave Rolsky
On Wed, 16 Jul 2003, Joshua Hoblitt wrote: Pheonix First of all, it's Phoenix, and second of all, you're thinking of Firebird. Don't get that name wrong or they'll come down on you like a ton of bricks ;) -dave /*=== House Absolute Consulting www.houseabsolute.com

Re: DT::F::DBI docs

2003-07-16 Thread Eugene van der Pijll
Joshua Hoblitt schreef: Well, there are only two modules: DT::F::MySQL and DT::F::Pg. I'd really like to see a lot more database formatters. snip 10 other databases Do all of these have different datetime formats? If database X has the same formats as e.g. Pg, it doesn't need a separate

Re: DateTime parse(), parser()

2003-07-16 Thread Ben Bennett
Well, I don't think that the simple is supposed to indicate simple to parse (at the moment the parser is all but simple... but I am trying to clean it up). I read it as simple formats, i.e. common formats that define the date and time in fairly straightforward ways (month names and numbers for

Re: DateTime parse(), parser()

2003-07-16 Thread David Wheeler
On Tuesday, July 15, 2003, at 11:11 PM, Rick Measham wrote: I'm an anti-fan of die. Die requires wrapping in eval or parsing the user's input before passing to -parse_datetime, which is just crazy. We should only throw errors on programmer error. For example: $dt-set( weekday =

Re: Ambiguous years (what does 03 mean?)

2003-07-16 Thread Eugene van der Pijll
Claus F?rber schreef: Rick Measham [EMAIL PROTECTED] schrieb/wrote: It's in the year 3 A.D. Period. This is a 'simple' module so I don't think it should try bending user input too much. If you assume it to be 2003, then how do I say it's the year 3? 02/11/0003 Nope. With that input,

Re: DateTime parse(), parser()

2003-07-16 Thread John Siracusa
On 7/16/03 2:16 PM, Eugene van der Pijll wrote: Most of the formatting modules don't know what to do with infinite dates. That's a bug/feature in the formatting modules, IMO, not a reason to pretend that infinite dates don't exist. Similarly, most of the programs using DT won't use infinite

Re: DT::F::DBI docs

2003-07-16 Thread Joshua Hoblitt
First of all, it's Phoenix, and second of all, you're thinking of Firebird. Don't get that name wrong or they'll come down on you like a ton of bricks ;) Your right - I'd been traveling for 24 hours. :) -J --

Re: DateTime parse(), parser()

2003-07-16 Thread Joshua Hoblitt
Infinite dates do not exist. (And neither do undefined ones.) If you accept that as dates or not, they are both valid pieces of information that need to be expressed. -J --

Re: DT constructor

2003-07-16 Thread Joshua Hoblitt
In a thread long ago we'd had discussed the possibility of breaking up the DT constructor(s) to be a little more friendly to sub-classing. Specifically so the validation behavior could be modified. Here is an example of changes to new() to allow this. What do you think about something like

Re: DateTime parse(), parser()

2003-07-16 Thread John Siracusa
On 7/16/03 3:39 PM, Eugene van der Pijll wrote: John Siracusa schreef: On 7/16/03 2:16 PM, Eugene van der Pijll wrote: Most of the formatting modules don't know what to do with infinite dates. That's a bug/feature in the formatting modules, IMO, not a reason to pretend that infinite dates

Re: DT::F::DBI docs

2003-07-16 Thread Eugene van der Pijll
Joshua Hoblitt schreef: Do all of these have different datetime formats? If database X has the same formats as e.g. Pg, it doesn't need a separate format. Of course DT::F::DBI should know about these cases. If X has identical date/time handling as Pg I'd like to see DT::F::X be isa

Re: DateTime parse(), parser()

2003-07-16 Thread Eugene van der Pijll
Joshua Hoblitt schreef: Infinite dates do not exist. (And neither do undefined ones.) If you accept that as dates or not, they are both valid pieces of information that need to be expressed. Sure. If the programmer chooses to, by choosing modules that return them. But no part of DateTime,

Re: DateTime parse(), parser()

2003-07-16 Thread Dave Rolsky
On Wed, 16 Jul 2003, Eugene van der Pijll wrote: But no part of DateTime, the base module, should return these non-dates. They should only be a result of some action where it makes sense that something else than a date is returned. Specifically, the default parser should not return these

Re: DateTime parse(), parser()

2003-07-16 Thread Eugene van der Pijll
John Siracusa schreef: On 7/16/03 3:39 PM, Eugene van der Pijll wrote: Infinite dates do not exist. Infinite DateTime objects do, which was my point. The Loch Ness monster exists. That doesn't mean that DateTime::Format::Roman should accept it. A Format object does not have to accept

Re: DateTime parse(), parser()

2003-07-16 Thread John Siracusa
On 7/16/03 4:17 PM, Eugene van der Pijll wrote: I never suggested that ambiguous forms should be parsed by DT::F::Simple. Not even 04/05/2003? That's not ambiguous, thanks to the handy setting in DT::F::Simple that tells it exactly how to interpret that :) If today is parsed, people expect

Re: DateTime parse(), parser()

2003-07-16 Thread Flavio S. Glock
Eugene van der Pijll wrote: Oh, I forgot one: if now is parsed, never should be as well (returning DT::Undef). (That one is somewhat sensible to include, even.) now is a DT, or a DT function never is DT::Set-new_empty forever is DT::Set( -inf, inf ) undef is DT::Undef - Flavio S. Glock

Re: DateTime parse(), parser()

2003-07-16 Thread Joshua Hoblitt
The Loch Ness monster exists. That doesn't mean that DateTime::Format::Roman should accept it. Yes it does. It should accepts Dave's organic cucumbers too. -J --