Camelia, the Perl 6 bug

IRC log for #mojo, 2012-08-16

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:43 tempire marcus: not sure what you mean
00:54 d4rkie joined #mojo
00:55 laouji joined #mojo
00:55 perlite joined #mojo
00:57 woremacx joined #mojo
01:05 scott joined #mojo
01:14 jnap joined #mojo
01:49 nich0s joined #mojo
01:49 nich0s left #mojo
02:14 rem_lex| joined #mojo
02:41 jnap joined #mojo
02:47 lukep joined #mojo
02:52 jeen joined #mojo
02:52 noganex_ joined #mojo
03:05 d4rkie joined #mojo
03:36 l3l1p joined #mojo
04:26 xaka joined #mojo
04:44 jeen joined #mojo
05:00 d4rkie joined #mojo
05:27 laouji joined #mojo
05:32 Britzel_ joined #mojo
05:50 spleenjack joined #mojo
05:53 espent joined #mojo
06:09 tabbi joined #mojo
06:19 marcus tempire: not sure either. Would like for static assets to be served by a proper web server I guess, but it seems maybe it doesn't even do that for rails apps
06:19 marcus http://www.modernperlbooks.com/mt/20​12/08/serving-templated-directories-​from-a-catalyst-controller-role.html # Who says you can't code java in Perl?
06:28 fhelmber_ joined #mojo
06:30 Vandal joined #mojo
06:30 sri https://github.com/kraih/mojo/issues/371 # thoughts?
06:31 sri or do you know any REST APIs that actually use Allow headers?
06:34 fhelmbe__ joined #mojo
06:36 tempire marcus: seems like a job for cloudflare
06:37 sri marcus: ewww
06:40 tempire Whenever I see multiple lines of MooseX::, I raise an eyebrow
06:40 tempire I figured maybe I just don't "get it" yet.
06:58 Leandr joined #mojo
06:58 davido joined #mojo
07:02 marcus tempire: I suppose
07:02 marcus "With only 40 lines of boilerplate, I can serve 3 static files in 1 line of controller code"
07:04 marcus I mean two lines of controller code.
07:05 davido Java in Perl.... So perhaps if I spent some time with Java I'd come around to chromatic's perspective.
07:06 davido (That's still not reason enough to spend some time with Java.)
07:23 taryk joined #mojo
07:35 alexeiras joined #mojo
07:40 marcus sri: I think we should consider adding some callback helpers to mojolicious. Something like parallol, and something to run a sequence of callbacks in series to avoid nesting so much. Should I be making a github issue for discussion?
07:41 sri marcus: i'd be more interested in proposed implementations, because i have no idea how something like that should look like
07:41 marcus sri: oki, I'll start a branch with a proposal this weekend.
07:42 sri if you have mockups a discussion would make sense
07:57 sri marcus: what does parallol have that delays don't?
07:59 marcus sri: mostly convenience, like tracking the a number of callbacks and doing a callback on completion of the last one (Defaulting to render) and having a default behavior of stashing the return value.
08:00 sri hmm, that seems way too specialized for core
08:00 marcus it's a very common set of patterns
08:00 marcus I use it with several different apps with different backend (A rest api client, a solr backend, and redis).
08:00 judofyr joined #mojo
08:00 judofyr sri: Parallol is just a Mojo::Controller-optimized Mojo::IOLoop::Delay. just for convenience.
08:00 marcus backends
08:01 sri think i'm -1 on that atm
08:01 judofyr ("optimized" for common cases, not for performance)
08:01 sri more interested in your other suggestion
08:01 judofyr I think something like promises (or other ways to compose callbacks) would be interesting
08:01 marcus the other pattern, which is very common in node, is $self->serialize(sub {… }, sub {… }, sub { …. } ;
08:02 sri is anyone else here using Parallol?
08:02 marcus is anyone else here doing apps with multiple async callbacks in the controller?
08:02 cosmincx joined #mojo
08:03 marcus serialize is probably a bad word, as it is ambigious
08:03 batman_ joined #mojo
08:07 sri i think we've talked about that before
08:07 sri and we both liked some js libraries
08:08 marcus yes
08:09 marcus like https://github.com/shtylman/chain-js
08:09 judofyr is there a common pattern for errors in callbacks in Mojo? e.g. Node.js' function(err, res)?
08:10 marcus or https://github.com/creationix/step/
08:10 marcus judofyr: emit events?
08:10 sri judofyr: not common, but i like error as first argument (after invocant)
08:10 sri we have a mix of first argument, error events and decorated transaction objects
08:11 sri whatever makes the most sense in a given situation
08:11 judofyr it would be way easier to create a common library for handling it it was more standardized
08:11 sri Mojo::IOLoop->client does first argument, Mojo::UserAgent does decorating for active transactions and error event for exceptions not tied to transactions
08:12 sri judofyr: good luck with that :)
08:13 sri Mojo::UserAgent for example does sync and async, i don't think there's a way to have one exception handling pattern
08:14 sri oh, and some exceptions also just die :)
08:16 sri not even the purist node.js has a single exception handling pattern though
08:17 sri i believe all four we use happen there too
08:18 sri marcus: right, step was the one we all liked
08:18 Psyche^ joined #mojo
08:19 sri pondering Mojo::IOLoop->steps(sub {} => sub {} => sub {})?
08:20 sri do you know a bigger node.js project using step?
08:20 sri i'd really like to see it in action
08:23 sri error event would be the obvious lowest common denominator for exception handling, but especially for ->steps() it would get impossible to use
08:23 marcus I don't, but I asked in #node.js now
08:23 sri you'd have no idea which callback threw the exception
08:25 sri if the implementation was similar to delays with Mojo::IOLoop::Steps and Mojo::IOLoop->steps() i don't think i would have a problem with it
08:26 jeen joined #mojo
08:26 sri but i wonder how hard it would be for users to grok as a concept
08:27 sri we don't have that much feedback for delays yet
08:27 marcus http://images.cheezburger.com/completestore/201​0/9/14/d8525d24-205c-4188-b46a-de8f56525eec.jpg
08:27 sri \o/
08:28 diegok marcus: I'm doing multiple async calls
08:28 marcus diegok: in parallel? And how do you trigger rendering
08:28 marcus ?
08:31 diegok marcus: let me check...
08:31 sri marcus: we kinda have delays blessed for that in the documentation http://mojolicio.us/perldoc​/Mojolicious/Controller#ua
08:32 marcus sri: yeah I know, just curious what diegok does :)
08:32 sri of course
08:33 * sri was just thinking that the idea of making more of it implicit scares him
08:35 marcus because magic?
08:35 diegok marcus: using delay on_finish event
08:35 sri marcus: not really, more that we still have trouble explaining async to people
08:37 sri it's not so much magic, as hiding the gory details of non-blocking
08:38 sri oh, sketch 2.1 is out \o/
08:39 marcus sufficiently sweet sugar is indistinguishable from technology.
08:40 marcus TM2 continues it's wild update rate. Looks promising
08:40 sri any of the ux problems fixed?
08:41 marcus better pasting, and new options for pasting indenting, and better tag trigger boundaries
08:41 marcus also improvements to rmate and retina prefs icons :)
08:43 diegok marcus: I think parallol would fit in my use case
08:44 sri btw. in the parallol docs you create a title helper, that helper already exists in DefaultHelpers
08:44 sri (for a different purpose)
08:44 marcus sri: good point, we'll fix that.
08:44 * marcus snaps his fingers and points at judofyr
08:44 marcus :D
08:44 judofyr /o\
08:45 * sri wonders if parallol predated Mojo::EventEmitter
08:45 sri on_* methods still freak me out :)
08:45 marcus it was written 1 year ago.
08:45 sri oh, then it does
08:46 daxim joined #mojo
08:52 judofyr sri: Parallol was mostly a result of seeing the same Delay-boilerplate in pretty much every action/controller
08:53 judofyr well, or, I don't think I even bothered using Delay because I realized most of the controller would look the same
08:53 judofyr I do see your point though: async is hard :(
08:53 sri what i find interesting is that your basic Parallol would fit into Mojo::IOLoop::Delay just fine
08:54 sri as $delay->begin(sub {...})
08:54 marcus https://npmjs.org/browse/depended/step
08:54 sri marcus++
08:56 sri that begin calback could preprocess the arguments, so only return values are collected for the finish event
08:57 sri perhaps a little complex
09:02 sri hmm
09:02 sri https://github.com/creationix/ns​tore/blob/master/nstore.js#L210
09:02 sri looks like step is only used for exception handling in some projects Oo
09:05 sri https://github.com/sendgrid/sendgrid-​nodejs/blob/master/lib/email.js#L212
09:05 sri used like that it looks pretty clean
09:05 marcus yepp
09:06 marcus https://github.com/einaros/GitAzur​e/blob/master/lib/gitazure.js#L142
09:08 sri how would you deal with invocants and arguments though?
09:09 sri you start out with two arguments already for every step
09:09 sri $self, $err
09:09 sri my ($self, $err, $ua, $tx) = @_;?
09:10 marcus I suppose so.
09:14 batman_ i don't like too many arguments. would be nice if $ua or $tx or some $obj had ->error i could check instead...
09:18 sri ->steps() would be too generic for that
09:18 marcus "My god, it's full of geezers" -- we need to add another file for that quote.
09:19 sri :)
09:33 fhelmber_ joined #mojo
09:58 kmx Hi, I have an async Mojo::UserAgent script like this https://gist.github.com/3368962 which gets 3 urls and prints their TITLEs. It basically works as expected (on linux/centos6/x86 box, perl-5.10.1), the only thing that is strange to me is a delay (10-20s) after the last "title:" message is printed.
09:59 kmx Is there anything missing in my script?
10:00 sri kmx: when do you expect it to stop?
10:01 kmx sri: quite shortly after printing the last "title:"
10:01 kmx as there should be nothing more todo
10:01 kmx but it my first async script with Mojo :)
10:01 sri there are always keep alive connections open and you don't tell the ioloop to stop
10:02 sri so... for the ioloop there is more stuff to do
10:02 kmx sri: ok, can I somehow tell "no-keepalive" ?
10:03 sri many ways
10:03 kmx inactivity_timeout(0) ?
10:03 berov joined #mojo
10:03 sri no
10:04 sri max_connections(0)
10:04 sri disabling keep alive is generally a bad idea though
10:05 sri only kills your performance
10:05 sri just telling the ioloop when to stop is easier
10:06 sri (with a delay and ->wait)
10:06 kmx I am not sure if I can detect that all async gets are finished
10:06 sri just read up on delays
10:07 kmx yes, it seems to exactly what I need
10:14 kmx sri: delay/wait did the job, thanks
10:14 kmx I should carefully read the synopsis http://mojolicio.us/perldo​c/Mojo/UserAgent#SYNOPSIS
10:14 sri :)
10:15 sri cookbook also has some recipes
10:15 kmx yes, Mojo documentation is excellent
10:19 alexeiras joined #mojo
10:30 sri marcus: http://hastebin.com/raw/mugufamapi
10:32 sri and if you have multiple requests in one step arguments grow
10:32 sri my ($steps, $err, $ua, $tx, $ua, $tx) = @_;
10:33 sri delays chop off the invocant btw
10:35 sri i'm kind of in favor of letting steps chop off the invocant too, but allowing a second call convention that doesn't
10:36 sri like sub { $steps->(@_) }
10:37 sri similar to $delay->end(@_)
10:39 sri marcus: all three http://hastebin.com/raw/rocilofeye
10:42 marcus rocilofeye!
10:43 marcus sri: I like the invocants chopped off.
10:46 judofyr sri: and what's the usecase for $err? should you handle $err in every step? does it stop executing the next steps when $err is present?
10:50 sri judofyr: i don't know
10:50 sri i suppose there is no use case
10:51 sri hmm
10:51 sri wait
10:51 Lucas1 joined #mojo
10:52 sri what should happen is a step dies?
10:52 sri isn't error passed to next step sensible?
10:53 marcus I'd prefer if it stopped and emitted an event, actually
10:53 sri but then you don't know which step died
10:53 marcus the other way feels a lot like try/catch, I hate that kind of error handling.
10:53 marcus like, using errors for normal situations.
10:53 sri if you have to teardown some setup steps things get messy
10:54 dbr joined #mojo
10:54 marcus I suppose.
10:55 dbr joined #mojo
10:58 sri tempire, crab: what do you think?
11:00 sri i'm not even sure how to explain steps with a simple example
11:00 sri http://mojolicio.us/perldoc​/Mojo/IOLoop/Delay#SYNOPSIS
11:01 sri something simple, self contained like this
11:02 sri hmm... i guess timers work fine for an example there too
11:03 marcus yeah
11:09 Britzel_ joined #mojo
11:17 perlite_ joined #mojo
11:34 jeen joined #mojo
11:36 jeen_ joined #mojo
11:43 Leandr joined #mojo
11:56 Htbaa joined #mojo
12:02 batman_ joined #mojo
12:14 D4RK-PH0ENiX joined #mojo
12:25 * nic likes the resque call-to-arms: https://gist.github.com/3369773
12:26 d4rkie joined #mojo
12:29 sri marcus: you working on Mojo::IOLoop::Steps yet? otherwise i might give it a try later
12:30 marcus sri: I'm not working on it yet, I won't have any time until saturday at the earliest.
12:30 sri ok, will think some more about it while watching futurama :)
12:32 Lucas1 joined #mojo
12:33 sri at least you've chosen a quote already, but we need a second one for the test!
12:47 jnap joined #mojo
12:48 d4rkie joined #mojo
13:02 marcus__ joined #mojo
13:06 marcus__ hmm
13:06 andrefs joined #mojo
13:11 berov left #mojo
13:18 andrefs joined #mojo
13:21 andrefs joined #mojo
13:27 CromeDome joined #mojo
13:31 inokenty joined #mojo
13:34 * sri shakes tempire
13:50 vel joined #mojo
13:51 andrefs joined #mojo
13:51 crab what does Steps do?
13:53 sri controls the flow of events
13:54 sri crab: basically flatten callback spaghetti http://hastebin.com/raw/rocilofeye
13:54 sri your callbacks look sequential instead of nested
13:58 sri it can also handle multiple callbacks per step
13:59 sri you just do $ua->get($url1 => $steps->step); $ua->get($url2 => $steps->step);
13:59 sri and it will wait for both with the next step
14:03 sri $steps->step returns a callback (if that wasn't obvious)
14:04 sri $steps->wait or so might be more appropriate
14:07 sri i believe the only open question is still exception handling, but i think $err as first argument is the only sensible solution
14:10 sri it really depends on how we want to handle step exceptions, per step or for all steps
14:18 labrown joined #mojo
14:19 judofyr sri: is it possible to store the $err inside the coderef? my $steps = shift; $steps->error?
14:19 sri i suppose
14:20 sri that only makes checking for errors more unpleasant though
14:22 sri i tend to only store errors in objects when there is added value, for transactions that would be ->success checks and the fact that request/response objects even work when they are fresh
14:24 judofyr how does $err get set?
14:24 sri if the previous callback died
14:24 judofyr ugh
14:25 judofyr then it doesn't play well with composition
14:25 sri not sure i follow
14:25 judofyr e.g. sub mything { $self->ua->get('api' => pop) }
14:25 judofyr no, wait
14:26 judofyr e.g. sub mything { my $cb = pop; $self->ua->get('api' => sub { handle_response; $cb->() }) }
14:26 sri still don't get it
14:26 judofyr there's no way for Step to capture errors that occur in handle_response
14:27 sri what is step?
14:27 judofyr Mojo::IOLoop->steps (or whatever)
14:27 sri or rather... what is inside the step callback?
14:27 judofyr ->steps(sub { mything(123 => $steps) }
14:28 judofyr god, I should have written this in a file/pastie
14:28 sri ah
14:28 judofyr so many scrambled thoughts
14:28 sri of course you can't catch that
14:28 sri it's async
14:28 sri $err is only for the sync part
14:28 sri everything else is up to the respective event thingy you're using
14:29 judofyr ah, so $err is just "the previous step died", nothing else?
14:29 sri right
14:30 sri only the event loop can sandbox everything async
14:30 sri in our case Mojo::IOLoop->singleton->reactor->on(error => sub {...})
14:30 judofyr doesn't seem very useful though. die-ing in a callback is a big no-no anyway. the $err in steps would only cover a small part of your code.
14:30 sri if everything else fails that event gets emitted
14:31 sri judofyr: you still want to know if it fails
14:31 sri silent event failures are one of the worst thing to debug
14:31 sri *+s
14:31 judofyr just emit a reactor error
14:32 judofyr that's what it does today
14:32 judofyr and what it will continue to do in many cases even with steps' protection
14:32 sri hmm
14:32 sri you may have a point there
14:33 sri simplifies the code a lot too
14:33 batman_ +1
14:34 sri a wild batman appears
14:34 batman_ +1 on what judofyr said
14:39 krism joined #mojo
14:40 judofyr "sri: you may have a point there" weeeee, sri (for once) agrees with me \o/
14:40 sri \o/
14:41 sri when did i last disagree with you?
14:41 judofyr not sure, I just feel like you're always "oh, yeah. but no, I'm not going to do it"
14:41 sri :D
14:42 sri that's me... most of the time
14:46 * sri shakes crab
14:53 krism i am calling "[% c.url_with.query(page => p) %]" (using template toolkit) and the generated URL keeps appending new "&page=n" instead of changing the  existing page
14:54 krism so i end up with http://foo/bar/action?page​=1&page=2&page=3? etc
14:54 krism can anyone point at what i might be doing wrong?
14:55 judofyr krism: Template Toolkit converts => into a HASHREF
14:55 judofyr so .query(page => p) calls ->query({page => p})
14:55 batman TT--
14:55 good_news_everyone joined #mojo
14:55 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/ET2tUg
14:55 good_news_everyone [mojo/master] fixed json_has method in Test::Mojo (closes #372) - Sebastian Riedel
14:55 good_news_everyone left #mojo
14:55 krism hah thank you, i'll look into it
14:56 judofyr krism: if you want to replace the query, use: .query('page', p). for merge, use: .query(['page', p])
14:57 judofyr krism: see https://metacpan.org/module/Mojo::URL#13 for merge vs replace vs append
14:57 mire joined #mojo
14:57 judofyr (I think merge is the one you want to use, considering you're using url_with)
14:57 krism thanks a lot, that resolved it. i'll read up :)
14:58 judofyr but yeah, that is a pretty retarded TT "feature"
14:59 judofyr TT--
14:59 krism i can't argue that :)
14:59 sri well, TT is very old
15:00 sri i think we only started doing all that helper method stuff with Catalyst, years after its first release
15:00 judofyr sri: is there a good "rule" for remembering that [ = merge and { = append?
15:00 judofyr I also mix them up
15:00 sri nope, i actually wish i had made them the other way around ;p
15:01 batman sri: i agree. since adding keys to a hash will merge...
15:02 sri think i've complained about it multiple times before... but changing would break a lot
15:02 batman yeha. don't do that :)
15:02 batman https://metacpan.org/module/​Mojolicious::Plugin::UrlWith <-- use my module instead ;)
15:03 judofyr it's also not possible to use .query.merge(…) in templates :/
15:03 batman pretty awesome that my url_with is not consistent with the builtin  ..... ... .. .
15:03 sri listen to the flying rodent guy
15:03 judofyr does Perl have a K Combinator (like Ruby's #tap)?
15:04 judofyr has* (or do*) whatever
15:04 batman what is that?
15:05 judofyr sub tap { my ($obj, $cb) = @_; $cb->($obj); $obj }
15:05 judofyr call a callback, return the object again
15:06 judofyr in Ruby you could e.g. do: url_with.tap { |u| u.query.merge("a" => 1) }
15:06 judofyr and it would return the URL
15:06 judofyr it's like a shortcut for: my $foo = …; $foo->…; $foo
15:07 sri chaining is actually not very common in perl
15:11 sri that kinda syntactic sugar is not part of the core language
15:11 daxim SOAP::Lite->fsm->please->kill->me->now
15:12 sri hmm, we could add some sugar methods to Mojo::Base :D
15:12 sri tap seems fun
15:13 sri $url->tap(sub { $_->path->trailing_slash(1) })->scheme('https')
15:14 judofyr it's a shame that methods can have coderef prototypes. $url->tap { … } would be so much better :(
15:14 judofyr (IMO)
15:14 judofyr but anyway
15:15 batman yeah. that sucks... i don't understand why it hasn't been added :/ sub foo ($&@) { ... }
15:15 * sri pokes marcus, tempire and crab
15:15 sri something else to think about!
15:15 sri ruby-ish sugar for all mojo classes
15:15 judofyr ruby-ish sounds so hacky. K Combinator is way more classy
15:15 sri batman/judofyr: heck, i don't understand why we don't have subroutine signatures yet...
15:16 sri judofyr: i can prolly even make it look perl6-ish :)
15:16 batman :)
15:17 judofyr is there any reason why sub sigs haven't been implemented?
15:17 judofyr do people oppose to it?
15:17 Leandr joined #mojo
15:17 sri lack of agreement on semantics
15:17 sri and it can be done with cpan modules... so there's no hurry
15:18 sri cpan modules battle out semantics, the last module standing gets into core
15:19 sri you have to consider that we don't have a BDFL anymore
15:19 sri so decisions are very very slow
15:20 sri letting users decide with their feet sure beats battling it out on the mailing list where the loudest neckbeard wins...
15:21 batman https://gist.github.com/3370979 <--- #tap?
15:21 skylos joined #mojo
15:22 sri batman: yea
15:23 sri actually wonder what other fun methods the ruby object base classes have we could steal
15:23 sri and perl6 of course
15:24 sri marcus, tempire, crab: K Combinator for Mojo::Base, yay or nay?
15:24 * sri plunders ruby
15:25 judofyr there's not that many methods on Object though: http://ruby-doc.org/core-1.9.3/Object.html. most of them are related to the object model
15:26 sri yea, tap seems to be the only one we could make good use of
15:27 judofyr introspection, equality, dup/clone and default implementions of to_* and enum_for
15:27 judofyr there's #inspect and #display though
15:27 judofyr but I rarely need to dump Mojo::Base objects
15:28 sri no need to have those everywhere
15:29 judofyr although I wish there was something simpler than "use Data::Dumper; say Dumper(…)" or "say Data::Dumper::Dumper(…)"
15:29 judofyr but Mojo won't help there :/
15:30 sri say Mojolicious->new->dumper() ;p
15:30 sri a helper we use for exception pages
15:31 judofyr yeah, I often use $self->dumper(…) in controllers
15:31 judofyr or h.dumper(…) in TT
15:32 judofyr god, Chrome is killing my machine :(
15:32 judofyr constantly using 250% CPU
15:34 t4nk980 joined #mojo
15:47 batman judofyr: https://gist.github.com/3370979#file_d.pm :)
15:49 sri judofyr: just talked to some perl6 folks, i think they are adding .tap() there too now :D
15:49 judofyr haha, sweet
15:49 judofyr how would it look in Perl6? (syntax-wise)
15:50 sri good question, i'm not sure
15:50 xaka joined #mojo
15:50 sri $foo.tap($foo -> $foo.bar.baz(1)).lalalala or so
15:51 sri they seem to be using arrows for closures everywhere now
15:55 sri marcus, tempire, crab: i take your silence as a yay for Mojo::Base->tap and will go ahead with implementing it ;p
15:59 fhelmber_ joined #mojo
16:17 crab i don't object
16:17 crab it seems harmless, if a little eccentric. i don't like the name, because it doesn't mean/say anything to me, but by the same token it doesn't mislead me either
16:18 sri #perl6 is currently arguing about the name
16:18 sri i think it might end up being .also() or so
16:19 crab why would you ever use it?
16:20 sri templates for example
16:20 sri quick modifications to an attribute that's also an object
16:20 sri %= url_for->also(sub { $_->path->leading_slash(1) })
16:21 sri i know i've been there many times
16:22 crab maybe i'll get used to it, but it just reads very weirdly. it's like i understand each of these words, but what are they doing together?
16:23 sri you're basically causing some side effects in a method chain
16:26 sri hehe, it might end up being $foo->btw(sub {...})
16:29 sri oh my
16:29 sri $foo->self(sub {...}) # OF COURSE!
16:33 krism joined #mojo
16:36 Htbaa1 joined #mojo
16:41 krism joined #mojo
16:43 good_news_everyone joined #mojo
16:43 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/mhYePQ
16:43 good_news_everyone [mojo/master] added K Combinator support to Mojo::Base - Sebastian Riedel
16:43 good_news_everyone left #mojo
16:43 sri it will be renamed once #perl6 makes a decision ;p
16:47 Netfeed "Let's boldy go where we gone before" <-- that ought to be a quote for a module that has been refactored :)
16:47 sri :)
16:58 Leandr joined #mojo
17:27 tempire the new new style seems the cleanest
17:27 ZadYree joined #mojo
17:28 tempire ->ohhaibtw
17:30 tempire stackato now supports websockets
17:33 CromeDome joined #mojo
17:36 tempire eck.  activestate has the worst user experience.
17:39 sri yes they do
17:39 tempire although they get points for using the url: api.stacka.to
17:40 sri hmm, doesn't look like the perl6 folks are making a decision yet :(
17:41 sri soooo... which name should we take? ->tap, ->also, ->self or ->btw?
17:43 tempire oh, stackato uses a different password besides their activestate account.
17:43 tempire :/
17:44 * sri tends towards ->self
17:48 sri think i might make Mojo::IOLoop::Steps use begin/end, just like delays
17:49 sri hmmm
17:49 sri maybe that's too confusing
17:50 tempire ->self seems like a bad idea
17:51 tempire assuming it works like this: sub tap { my ($obj, $cb) = @_; $cb->($obj); $obj }...I support also
17:51 tempire it's the only one that tells you something.
17:51 tempire although I do like ->btw, I'm guessing ->also is better for non-native speakers
17:52 sri it's already in master
17:52 sri also has 4 characters though!
17:52 Mad_Dud joined #mojo
17:52 rwstauner is `options->{test}` a typo? https://github.com/kraih/mojo/blob/ma​ster/lib/Mojolicious/Renderer.pm#L84
17:53 sri rwstauner: oh my, it is indeed
17:53 rwstauner i'm currently trying to debug my app, and i noticed that
17:54 sri it doesn't really matter though
17:54 sri same for data and json, we could just drop the values
17:55 sri it might actually cause bugs if it was {text} :D
17:55 rwstauner i didn't even look up where/if $options is used, i just noticed it was not consistent with the other lines
17:55 tempire what's in master, btw or self?
17:56 sri ->tap
17:56 tempire what am I missing with tap?
17:57 rwstauner :-)
17:57 tempire seems arbitrary
17:57 sri it's the ruby name
17:57 sri Object#tap
17:57 sri rwstauner++
17:57 rwstauner :-)
17:57 tempire right, but what does it mean?
17:58 sri is that a philosophical question? :)
17:58 tempire as in, $self makes sense.  ->render_exception makes sense
17:59 tempire but tap...
17:59 sri http://ruby-doc.org/core-1.9​.3/Object.html#method-i-tap
17:59 tempire tap into
17:59 tempire ok
18:01 sri think i'll go with $steps->next
18:16 alexeiras joined #mojo
18:21 sri it's cool that we can add stuff like ->tap to everything so easily thanks to the shared base class
18:21 inokenty \o/
18:22 heytrav how can I generate a url with placeholders (eg ~/admin/:id/edit ) using $self->url_for(...)? Is basic string concatenation the only way to go or can that be done with specific options?
18:32 batman url_for(adminidedit => { id => $id })
18:32 batman ^ something like that. depends on what the route is actually named...
18:41 lammel2 joined #mojo
18:47 andrefs joined #mojo
18:54 good_news_everyone joined #mojo
18:54 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/70TspA
18:54 good_news_everyone [mojo/master] added Mojo::IOLoop::Steps - Sebastian Riedel
18:54 good_news_everyone left #mojo
18:58 batman why do you need $self->{counter} ?
18:58 sri multiple callbacks in one step
18:59 batman right
19:01 xaka sri: btw, https://github.com/caolan/async/, a lot on interesting stuff like you've done
19:05 lammel2 joined #mojo
19:08 tempire huh.  parallel and series.
19:10 heytrav batman: Cool. I'll give that a go. Thanks a lot.
19:17 sri not sure yet if support for multiple ->next calls will stay, or if we should just encourage mixing delays and steps
19:17 sri after all you could just do my $delay = Mojo::IOLoop->delay($steps->next);
19:17 sri it is one extra step though
19:24 berov joined #mojo
19:27 Ulti sri did you add Template::Mojo to Rakudo?
19:55 sri Ulti: no
19:55 tempire arg
19:56 tempire Y EVERY REQUEST LIBRARY NO HAVE DEBUGGING TO STDOUT
19:58 Ulti k
19:58 Ulti there's a new .msi windows version of Rakudo if you haven't seen yet and they mention in the release Template::Mojo
20:09 CromeDome joined #mojo
20:11 sri hmmmm
20:11 sri if i remove support for multiple callbacks from Steps, i could just pass the callback as first argument
20:17 xaka joined #mojo
20:25 sri http://hastebin.com/raw/totusonihu
20:25 sri there would be no $steps instance basically, just a callback
20:36 atom12 joined #mojo
20:40 good_news_everyone joined #mojo
20:40 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/lhq7ew
20:40 good_news_everyone [mojo/master] simplify Mojo::IOLoop::Steps - Sebastian Riedel
20:40 good_news_everyone left #mojo
20:40 sri not sure if that's the way to go
20:40 * sri pokes marcus, tempire and crab
20:41 * tempire defers to marcus since he's been using a lot of async stuff lately
20:41 sri http://mojolicio.us/perldoc/Mojo/IOLoop#steps
20:41 sri on the plus side, it should be very very easy to understand now
20:41 tempire looks fine to me
20:41 tempire wait
20:42 tempire so you have to specifically schedule the next step?
20:42 sri what do you mean with schedule?
20:42 sri the next step is the timer callback
20:42 tempire right, so if you don't use  Mojo::IOLoop->timer(3 => $next);, the next step won't execute
20:43 sri right
20:43 tempire hmm, so you can make it parallel or serial
20:43 tempire well, concurrent
20:44 sri what does that even mean?
20:44 sri how do you make multiple callbacks parallel?
20:45 xaka actually Delay does it in parallel
20:45 xaka and Steps in serial
20:45 bjoernfan joined #mojo
20:45 tempire if you do ->timer(0 => '..') before the content of each step
20:46 * sri doesn't follow
20:48 sri if you want to synchronize events, then delays are for you, steps are for sequentializing
20:48 tempire was thinking of https://gist.github.com/3373540
20:49 sri steps is a list of steps that happen after another
20:50 sri marcus: these misunderstandings are not a good sign
20:50 tempire you shouldn't use me as a gauge.  I'm not fully paying attention.
20:51 sri :S
20:58 sri anyway, so far nobody here seems to grok steps
20:59 sri maybe it's still too early for that kinda stuff in mojolicious
20:59 tempire I got it to begin with, but my skimming over the log made me think it was different.
21:01 sri then tell me, should it be ->timer(0 => $next) or ->timer(0 => $steps->next)
21:01 sri (latter implies multi callback support)
21:01 xaka i think it's just because everyone was trying to do on its own with features that delay/steps provide like me )
21:02 tempire ok, I'm paying attention now.  Multi-callbacks mean you could execute any number of the steps?
21:03 sri no, it means multiple timers in a single step
21:03 xaka in delay you have $delay->begin/end so to be consistent $steps->next looks better
21:03 sri sub { ->timer(0 => $steps->next); ->timer(0 => $steps->next) },  sub { say 'i waited for both' }
21:06 tempire the next step executes twice?
21:06 tempire or is it the next two steps
21:07 sri only once
21:07 tempire ah, multi-callback, so probably next two steps.
21:07 sri no, it waits for both callbacks before moving on to the nest step
21:07 sri *next
21:10 mercutioviz joined #mojo
21:11 tempire well I'm definitely confused by the multi-callback part, then.
21:25 marcus I really like the multi cb part, but it might be harder to grok.
21:26 sri i'm giving it a last try
21:28 good_news_everyone joined #mojo
21:28 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/hkHctw
21:28 good_news_everyone [mojo/master] make Mojo::IOLoop::Steps more powerful again - Sebastian Riedel
21:28 good_news_everyone left #mojo
21:28 sri http://mojolicio.us/perldoc/Mojo/IOLoop#steps
21:34 sri marcus: you don't think it clashes with delays?
21:35 marcus sri: it certainly overlaps
21:37 marcus sri: I guess you could have a delay inside step 2 and get the same functionality, with a litte more verbosity.
21:37 good_news_everyone joined #mojo
21:37 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/xkTN0w
21:37 good_news_everyone [mojo/master] hint at parallel timers - Sebastian Riedel
21:37 good_news_everyone left #mojo
21:37 sri marcus: with one additional line
21:37 tempire that comment helps
21:37 tempire maybe even a: say 'Third step in 3 seconds, after the two timer calls finish.';
21:38 sri callback as first argument of course also costs extensibility
21:39 sri with the object we could add new functionality
21:40 marcus yeah, I like this
21:41 sri i don't know, some independent opinions would be nice
21:42 marcus guess crab is sleeping
21:42 marcus it's late in india
21:42 marcus heck, it's late in Oslo.
21:42 sri was about to say it
21:43 sri go the f**k to sleep
21:43 lammel2 I could spare an opinion, but didn't follow up to now
21:43 marcus I own that book
21:44 marcus lammel2: just read http://mojolicio.us/perldoc/Mojo/IOLoop#steps and give us your thoughts.
21:46 lammel2 Wrapping my head into parallel streams of sequential execution now...
21:47 lammel2 ->steps would just give me a steps object that I could use instead of a callback elsewhere?
21:48 lammel2 which would ensure that the callback (consisting of mutliple callbacks actually) would be executed in the correct order i defined in steps?
21:48 lammel2 somethings like ->on_read($mysteps_for_read);
21:48 lammel2 ?
21:49 good_news_everyone joined #mojo
21:49 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/lK-7Vg
21:49 good_news_everyone [mojo/master] better description for Mojo::IOLoop::Steps - Sebastian Riedel
21:49 good_news_everyone left #mojo
21:49 marcus lammel2: actually you would have to set up the ->on_read inside the first cb and pass it $steps->next
21:50 sri he's close enough
21:50 marcus yea
21:50 marcus sri: I also asked twitter
21:50 sri oh noes
21:51 marcus devops borat really likes it.
21:51 marcus j/k
21:51 sri -.-
21:55 good_news_everyone joined #mojo
21:55 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/l-XFfQ
21:55 good_news_everyone [mojo/master] updated Mojo::IOLoop::Steps example - Sebastian Riedel
21:55 good_news_everyone left #mojo
22:00 marcus twitter is ignoring me re Steps.
22:00 marcus Have a good discussion about Cathulhu going on tho
22:02 lammel2 marcus: Seems like I got it inside out, so no steps object to use where a method would need a callback
22:02 marcus lammel2: right, but as sri said, close enough :)
22:03 sri yea, you got the concept, that's the important part
22:05 lammel2 maybe the first code exmaples mislead me a little, as they return the steps object in $steps
22:05 lukep joined #mojo
22:05 lammel2 calling steps->next in a step will always return the next step right?
22:06 lammel2 so even calling it multiple times in a step, will just give me the next step callback
22:06 sri http://mojolicio.us/perldoc/Mojo/IOLoop/Steps#next
22:11 sri basically, you can make as many as you like, but they all need to be called before the next step can be reached
22:15 lukep joined #mojo
22:15 bjoernfan joined #mojo
22:15 berov joined #mojo
22:15 lammel2 joined #mojo
22:15 andrefs joined #mojo
22:15 alexeiras joined #mojo
22:15 mire joined #mojo
22:15 d4rkie joined #mojo
22:15 perlite joined #mojo
22:15 l3l1p joined #mojo
22:15 njlg joined #mojo
22:15 jmmills joined #mojo
22:15 kmx joined #mojo
22:15 Liam` joined #mojo
22:15 memowe joined #mojo
22:15 dwierenga joined #mojo
22:15 edenc joined #mojo
22:15 marcus joined #mojo
22:15 kvorg joined #mojo
22:15 drift joined #mojo
22:15 phips joined #mojo
22:15 trone joined #mojo
22:15 diegok joined #mojo
22:15 mattp_ joined #mojo
22:15 keedi joined #mojo
22:15 whee joined #mojo
22:15 charsbar__ joined #mojo
22:15 mikegrb joined #mojo
22:15 bzero joined #mojo
22:15 ashleydev joined #mojo
22:15 garu joined #mojo
22:15 BinGOs joined #mojo
22:15 jzawodn joined #mojo
22:15 hide joined #mojo
23:01 memowe joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary