Re: Install errors in DateTime::Locale
On Sun, 22 Oct 2006, Barry Moore wrote: t/01basicok 5/7101Can't locate object method "catfile" via package "File::Spec" (perhaps you forgot to load "File::Spec"?) at t/01basic.t line 52. There is in fact no use File::Spec in that test script, so when I add that I fix that error, but get this one: Can't call method "set" on an undefined value at t/01basic.t line 158. And I haven't been able to fix this yet, but I'm sure there must be something I'm missing... I'm running Mac OS 10.4.8 and perl 5.8.6. Any thoughts? Fixed in 0.3101 is what I think ;) -dave /*=== VegGuide.Orgwww.BookIRead.com Your guide to all that's veg. My book blog ===*/
Install errors in DateTime::Locale
Hi all- I'm stuck on DateTime::Locale install. Error is: t/01basicok 5/7101Can't locate object method "catfile" via package "File::Spec" (perhaps you forgot to load "File::Spec"?) at t/01basic.t line 52. There is in fact no use File::Spec in that test script, so when I add that I fix that error, but get this one: Can't call method "set" on an undefined value at t/01basic.t line 158. And I haven't been able to fix this yet, but I'm sure there must be something I'm missing... I'm running Mac OS 10.4.8 and perl 5.8.6. Any thoughts? Barry
Re: DateTime::Natural::Parse and the DateTime namespace
On Wed, Oct 25, 2006 at 09:41:27AM -0500, Dave Rolsky wrote: > I saw that you uploaded a new version with this name. The one other thing > I'd like to see to make it "fit in" is to make parse_datetime a class > method (at least optionally). Also, rather than taking a hash ref of > options, how about just making it check the number of args, so we can do > something like this: > > ->parse_datetime($string) > > ->parse_datetime( string => $string, debug => 1 ); Did both of it. But shouldn't we provide the options hash to new() instead? > This would be more like all the other modules. It's quite possible you'll > need more options in the future. For example, you might want to have a > parameter that allows people to specify whether dates are in mdy or dmy > order. Yeah, you're probably right. > One thing I was thinking was that maybe eventually there could something > like this: > > DateTime::Format::Natural->parse_datetime( string => $string, locale => > $dt_local_object ); > > The module could use the locale to figure out what module to load, or > maybe it could construct a parser based on info in the locale. It could > also use the locale to determine the native order for various components. Could you elaborate some more about it; I currently don't grasp the meaning of your words provided above. > -dave Regards, Steven -- #!/usr/bin/perlhttp://steven.accognoscere.org | /"\ print /\d+/ ? chr($_) : "\n" for grep {/[\d\%]+/} reverse | \ / split /\$/, '%$114$101$107$99$97$72$32$108$$114$101$80$32 | X $114$101$104$116$111$110$65$32$116$115$117$74'; | / \
Re: ANN: DateTime::Span::Birth
I picked the name to keep sync with Date::Range::Birth, but Birthdate was another candidate. I wouldn't mind renaming the module to increase my CPAN distro count :) On 10/26/06, Dave Rolsky <[EMAIL PROTECTED]> wrote: On Thu, 26 Oct 2006, Tatsuhiko Miyagawa wrote: > DateTime::Span::Birth 0.01 is now going to CPAN. A nit on the name. With just "birth", it seems like it might be related to predicting the birth of a baby, something like generating a span of dates in which the birth is expected. I think it might be better named ::Birthdate. -- Tatsuhiko Miyagawa
Re: ANN: DateTime::Span::Birth
On Thu, 26 Oct 2006, Tatsuhiko Miyagawa wrote: DateTime::Span::Birth 0.01 is now going to CPAN. A nit on the name. With just "birth", it seems like it might be related to predicting the birth of a baby, something like generating a span of dates in which the birth is expected. I think it might be better named ::Birthdate. What do others think? -dave /*=== VegGuide.Orgwww.BookIRead.com Your guide to all that's veg. My book blog ===*/
ANN: DateTime::Span::Birth
DateTime::Span::Birth 0.01 is now going to CPAN. This module is a port of Date::Range::Birth, which allows you to build a range of dates for birthdays of people with particular age. This makes it easy for you to build an SQL query for example, to select teenager users from your database which has 'birth' column as datetime. # build a datetime span for teenagers use DateTime::Span::Birth; my $span = DateTime::Span::Birth->new(from => 13, to => 19); # build an SQL query in a raw way my $sql = "SELECT * FROM user WHERE birthday >= ? AND birthdy <= ?" my $sth = $dbh->prepare($sql); $sth->execute($span->start->ymd, $span->end->ymd); The code is also available in my subversion repository: http://svn.bulknews.net/repos/public/DateTime-Span-Birth/trunk/ -- Tatsuhiko Miyagawa
Re: DateTime::Natural::Parse and the DateTime namespace
On Tue, 24 Oct 2006, Steven Schubiger wrote: If this were to go under DateTime, I'd probably want to have be something like DateTime::Format::Natural::EN or something like that, since it's quite possible people will want parsers for other languages as well. I'd also want it to have an interface more like the other DT::Format modules. Agreed upon. I saw that you uploaded a new version with this name. The one other thing I'd like to see to make it "fit in" is to make parse_datetime a class method (at least optionally). Also, rather than taking a hash ref of options, how about just making it check the number of args, so we can do something like this: ->parse_datetime($string) ->parse_datetime( string => $string, debug => 1 ); This would be more like all the other modules. It's quite possible you'll need more options in the future. For example, you might want to have a parameter that allows people to specify whether dates are in mdy or dmy order. One thing I was thinking was that maybe eventually there could something like this: DateTime::Format::Natural->parse_datetime( string => $string, locale => $dt_local_object ); The module could use the locale to figure out what module to load, or maybe it could construct a parser based on info in the locale. It could also use the locale to determine the native order for various components. -dave /*=== VegGuide.Orgwww.BookIRead.com Your guide to all that's veg. My book blog ===*/
Re: parenthesis in DateTime::Format::Strptime
Hm, you might want to make it backward compatible, not to escape them if it's already escaped. === lib/DateTime/Format/Strptime.pm == --- lib/DateTime/Format/Strptime.pm (revision 5695) +++ lib/DateTime/Format/Strptime.pm (local) @@ -582,6 +582,7 @@ my @fields = $field_list =~ m/(%\{\w+\}|%\d*.)/g; $field_list = join('',@fields); +$regex =~ s/(?now(); # Created just so we can do $tempdt->can(..) # Locale-ize the parser === t/008_parens.t == --- t/008_parens.t (revision 5695) +++ t/008_parens.t (local) @@ -0,0 +1,12 @@ +use strict; +use warnings; +use Test::More; +use DateTime::Format::Strptime; + +plan tests => 1; + +{ +my $str = "2006/10/25 (Wed)"; +my $p = DateTime::Format::Strptime->new(pattern => "%Y/%m/%d (%a)"); +ok my $dt = $p->parse_datetime($str); +} On 10/25/06, Tatsuhiko Miyagawa <[EMAIL PROTECTED]> wrote: Here's a patch for DateTime::Format::Strptime, to allow parsing strings like "2006/10/25 (Wed)" without the kludge to escape parenthesis in the format. === lib/DateTime/Format/Strptime.pm == --- lib/DateTime/Format/Strptime.pm (revision 5695) +++ lib/DateTime/Format/Strptime.pm (local) @@ -582,6 +582,7 @@ my @fields = $field_list =~ m/(%\{\w+\}|%\d*.)/g; $field_list = join('',@fields); +$regex =~ s/([\(\)])/\\$1/g; # escape parens my $tempdt = DateTime->now(); # Created just so we can do $tempdt->can(..) # Locale-ize the parser === t/008_parens.t == --- t/008_parens.t (revision 5695) +++ t/008_parens.t (local) @@ -0,0 +1,12 @@ +use strict; +use warnings; +use Test::More; +use DateTime::Format::Strptime; + +plan tests => 1; + +{ +my $str = "2006/10/25 (Wed)"; +my $p = DateTime::Format::Strptime->new(pattern => "%Y/%m/%d (%a)"); +ok my $dt = $p->parse_datetime($str); +} -- Tatsuhiko Miyagawa -- Tatsuhiko Miyagawa