Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6-lwp-gsoc, 2014-05-29

| Channels | #perl6-lwp-gsoc index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:22 ilbot3 joined #perl6-lwp-gsoc
00:22 Topic for #perl6-lwp-gsoc is now logs at http://irclog.perlgeek.de/perl6-lwp-gsoc/
07:20 FROGGS joined #perl6-lwp-gsoc
07:33 sergot morning! :)
07:37 FROGGS morning :o)
07:39 sergot FROGGS: what do you think about HTTP::Cookies? :)
07:40 sergot https://github.com/sergot/http-cookies
07:40 FROGGS sergot: it seems like a lot of work
07:41 FROGGS sergot: how far are you with this?
07:41 sergot I did some work yesterday. It is done-for-now, I think we should return to it if we have solid HTTP::{Request,Response}
07:42 sergot What I'll do today is: checking if a cookie exists and update it instead of adding new_one (&set_cookie)
07:42 sergot and it should remove expired ones
07:47 FROGGS ahh, I see
07:47 FROGGS sergot: can you document what is left TODO for now?
07:47 FROGGS in its readme or in the issues
07:48 sergot yes, I'll do this :)
07:51 sergot https://github.com/sergot/lwp-useragent/issues/15
08:02 dalek http-cookies: c88f97f | sergot++ | META.info:
08:02 dalek http-cookies: META.info updated
08:02 dalek http-cookies: review: https://github.com/sergot/http-cookies/commit/c88f97f3fd
08:04 sergot I want to do this today. There'll be some problems with removing expired cookies.
08:04 sergot FROGGS: Is there any way to convert HTTP date to P6 Date?
08:04 sergot or DateTime
08:05 sergot it has to be date and time
08:18 sergot FROGGS: what do you think about this loop: https://github.com/sergot/http-cookies/blob/master/lib/HTTP/Cookie.pm6#L12 ?
08:18 sergot is it readable?
08:22 FROGGS what is the problem with a HTTP date? is it just about parsing it?
08:23 sergot I think so.
08:23 sergot It's just parsing
08:24 sergot and then comparising which is lower than now().
08:24 FROGGS well, then we just need to know how such a date can look like (an RFC about this would be great), and then we just make a nice regex
08:25 FROGGS sergot: btw, that loop is kinda okay
08:26 FROGGS I'd add comments, like '# we have a name=value pair' and also a comment about why something that is not a pair is 'secure'
08:26 FROGGS and I'd change this: https://github.com/sergot/http-cookies/blob/master/lib/HTTP/Cookie.pm6#L10
08:26 FROGGS to a more readable form
08:26 sergot http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
08:27 FROGGS like: $s .= substr(11) if $s ~~ m:i/^ 'set-cookie' /;
08:27 FROGGS and I'd also put a comment there that describes why we strip that string
08:27 sergot FROGGS: I think it won't be needed, removing set-cookie can be done by http::headers maybe, we'll see, but yes, I'll change it, thanks. :)
08:28 FROGGS because substr(11) in code always looks suspicious due to the magic constant 11
08:30 sergot I  thiks this one "Sun, 06 Nov 1994 08:49:37 GMT" is most common.
08:30 sergot think*
08:30 FROGGS hmmm, do you want to write that DateTime::Parse::HTTPDate ?
08:30 FROGGS (or shall I?)
08:31 sergot I have enough time left so I whink I can do this. :)
08:31 sergot think*
08:31 sergot hah, something is wrong with my 'thinking'. :D
08:31 FROGGS okay :o)
08:32 sergot FROGGS: do you mean another module?
08:32 FROGGS yes
08:32 sergot Maybe just HTTP::Date then?
08:32 FROGGS hmmmm
08:33 FROGGS I'd call it DateTime::Parse, which then would have grammars/rules to parse rfc1123-date | rfc850-date | asctime-date
08:34 FROGGS damn, I wanna do that now *g*
08:35 sergot grammar HTTPdate { token TOP { <rfc1123> | <rfc850-date> | <asctime-date> }; ...  }
08:36 sergot something like this, right?
08:37 FROGGS right, and when you want to lock it down to a given subset you'd do: DateTime::Parse.new( '...', :token<rfc850-date> )
08:37 FROGGS this would then call the appropriate token instead of TOP automagially
08:38 FROGGS that is why I would not call it HTTPdate, because this would be extendable to parse all known formats
08:39 sergot awesome 0o
08:39 sergot :)
08:41 sergot https://github.com/sergot/datetime-parse
08:45 FROGGS :o)
08:46 FROGGS so, TOP should just be all "complete" tokensets OR'd together
08:46 FROGGS and there should be a token http-date, which you would use then in your HTTP::* modules
08:47 FROGGS and we need action methods then that create proper DateTime objects
09:08 dalek datetime-parse: 083a3ac | sergot++ | / (3 files):
09:08 dalek datetime-parse: init
09:08 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/083a3ac6fa
09:08 sergot FROGGS: what's wrong with this?
09:10 sergot You've the commit bit
09:13 FROGGS lemme check
09:16 dalek datetime-parse: 4e096f7 | sergot++ | lib/DateTime/Parse.pm6:
09:16 dalek datetime-parse: examples added
09:16 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/4e096f76ab
09:27 dalek datetime-parse: 58d652f | (Tobias Leich)++ | lib/DateTime/Parse.pm6:
09:27 dalek datetime-parse: copy&pasto int token time, it uses colons
09:27 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/58d652f0a5
09:29 FROGGS sergot: is it okay if I move the grammar in its own file, and ad actions?
09:29 FROGGS add*
09:36 sergot of course :)
09:36 sergot Do you mean DateTime::Parse::Grammar ?
09:36 sergot And ..Parse::Actions ?
09:49 FROGGS yeds
09:49 FROGGS yes*
10:48 sergot FROGGS: are you doing this now?
11:00 FROGGS sergot: yes, working on it...
11:02 dalek datetime-parse: b3b1818 | sergot++ | t/01-basic.t:
11:02 dalek datetime-parse: rfc tests
11:02 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/b3b1818db7
11:02 sergot FROGGS: ok :)
11:02 sergot I think, we should do something with date{1,2,3} it should be just date
11:11 dalek datetime-parse: 00fc4c3 | sergot++ | / (2 files):
11:11 dalek datetime-parse: date instead of date{1,2,3}
11:11 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/00fc4c34d7
11:11 sergot FROGGS: what do you think?
11:11 sergot does this make sense?
11:11 FROGGS yes, there could/should be a token date that is the superset of all dates
11:11 sergot it's weird
11:12 sergot I've just done this.
11:12 FROGGS ohh
11:12 sergot hmm, ok, that was my frist feeling about this :)
11:13 FROGGS but that would mean that when we add other date formats, that we parse stuff that does not comply to the HTTPDate rules
11:14 sergot that's right, I think we should do somethingwith this after you add Actions
11:15 sergot it's not correct, I should revert this commit.
11:16 sergot because it means, that rfc1123 can be Sun, 06-Nov-94 08:49:37 GMT, but it can't.
11:18 FROGGS yeah
11:23 FROGGS I need another 10 minutes before I can push something
11:23 sergot ok :)
11:23 sergot I deleted my last commit
12:27 [Coke] you can get it back from the reflog if you need to
12:30 dalek datetime-parse: 472c36a | (Tobias Leich)++ | / (4 files):
12:30 dalek datetime-parse: resolved conflicts
12:30 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/472c36acde
12:32 FROGGS damn, I messed up the commit message
12:35 dalek datetime-parse: aec014d | (Tobias Leich)++ | / (4 files):
12:35 dalek datetime-parse: add action class to produec DateTime objects
12:35 dalek datetime-parse:
12:35 dalek datetime-parse: The grammar got moved to its own file. The action methods for date and time
12:35 dalek datetime-parse: only produce hashes that can be passed to DateTime.new. Only date-time methods
12:35 dalek datetime-parse: like rfc850-date return DateTime objects.
12:35 dalek datetime-parse: The TOP rule of the grammar intentionally aliases to $<dt>, so that one is able
12:35 dalek datetime-parse: to figure out in what format a given datetime string is.
12:35 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/aec014d168
12:35 FROGGS that is better
12:36 FROGGS (except for the typo)
12:39 FROGGS ummm, we have no infix operators for DateTime... only for Date :/
12:40 FROGGS well, at least that works:
12:40 FROGGS perl6-m -Ilib -MDateTime::Parse -e "say DateTime::Parse.new('Sun, 06 Nov 1994 08:49:37 GMT').Date < DateTime.new('2013-01-01T00:00:00Z').Date"
12:40 FROGGS True
12:40 FROGGS perl6-m -Ilib -MDateTime::Parse -e "say DateTime::Parse.new('Sun, 06 Nov 1994 08:49:37 GMT').Date > DateTime.new('2013-01-01T00:00:00Z').Date"
12:40 FROGGS False
13:00 sergot what does "made" do?
13:00 sergot and make
13:02 sergot FROGGS: I forgot it I think
13:07 sergot make "runs" the next token, doesn't it?
13:07 sergot or made does this?
13:09 sergot ok, made does this, and make does what made expect. :D
13:12 sergot FROGGS++: that's awesome what you did, thank you very much for your help. I think we can add this do modules.perl6.org and use it in HTTP::Cookies. Thank You!
13:16 FROGGS make attaches the supplied argument to $/.made
13:16 FROGGS so you can access what the subrule made
13:18 FROGGS sergot: that was the goal (modules.perl6.org), since there were question about how to parse datetime strings often in #perl6
13:23 sergot FROGGS: great, I've just write META.info
13:23 sergot wrote
13:23 FROGGS nice :o)
13:23 sergot And a short readme
13:23 moritz FROGGS: doesn't your example lose the hours/minutes/seconds?
13:24 FROGGS moritz: yes
13:24 FROGGS since you cannot compare DateTimes right now
13:25 sergot It'll be needed, but we can do this later I think.
13:26 dalek datetime-parse: dd408a8 | sergot++ | / (2 files):
13:26 dalek datetime-parse: README.md, META.info added
13:26 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/dd408a8d46
13:27 dalek datetime-parse: 3f07b66 | sergot++ | README.md:
13:27 dalek datetime-parse: we dont use $localtime
13:27 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/3f07b66bd7
13:27 * sergot is adding this module to modules.perl6.org
13:29 FROGGS sergot++
13:30 sergot FROGGS++
13:30 sergot :)
13:30 FROGGS :o)
13:30 sergot You did the whole work.
13:30 FROGGS no, not really :o)
13:30 FROGGS but you see how powerful and nice such a grammar+actions is
13:31 sergot I'm really impressed :)
13:32 FROGGS so, when you want to turn text into structures or objects, then this is often the way to go
13:47 sergot thanks! :)
13:47 sergot Now it's clear
14:05 sergot panda has some troubles with testing our new module
14:05 sergot ==> Testing DateTime::Parse
14:05 sergot t/01-basic.t .. ===SORRY!===
14:05 sergot Could not find symbol '&Grammar'
14:05 sergot t/01-basic.t .. Dubious, test returned 1 (wstat 256, 0x100)
14:05 sergot Failed 6/6 subtests
14:06 FROGGS sergot: does it help to put 'use DateTime::Parse::Grammar;' into the test file as well?
14:06 sergot tests are fine if we run it locally
14:07 sergot I mean, by: perl6 -Ilib t/01-basic.t
14:07 sergot I'll do what you wrote
14:08 dalek datetime-parse: 91046bb | sergot++ | t/01-basic.t:
14:08 dalek datetime-parse: panda fix
14:08 dalek datetime-parse: review: https://github.com/sergot/datetime-parse/commit/91046bb9b2
14:09 sergot We'll see
14:10 FROGGS you can also do 'panda install .' within that directory
14:38 sergot Oh, I didn't know ,thanks
14:38 sergot the same problem
14:47 sergot any ideas? :)
14:57 dalek joined #perl6-lwp-gsoc
15:00 FROGGS that might be a precomp bug...
15:01 FROGGS but this is strange...
18:17 moritz
18:17 moritz +..
18:17 moritz sorry, flaky connection

| Channels | #perl6-lwp-gsoc index | Today | | Search | Google Search | Plain-Text | summary