The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2014-02-25

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

All times shown according to UTC.

Time Nick Message
00:05 Stefan joined #mojo
00:09 dsteinbrunner joined #mojo
00:19 jack joined #mojo
00:31 punter There's a leaktracker for mojolicious: https://metacpan.org/pod/Mojolicious::Plugin::LeakTracker
00:31 punter I'm surprised it wasn't mentioned
00:38 dsteinbrunner joined #mojo
00:44 asarch joined #mojo
00:57 lukep joined #mojo
01:00 laouji_ joined #mojo
01:10 d4rkie joined #mojo
01:18 marty joined #mojo
01:25 ka2u joined #mojo
01:46 dsteinbrunner joined #mojo
01:48 sri if anyone is looking for inspiration for their mojolicious book... the new flask book is quite good and crazy popular http://flaskbook.com/
02:05 jberger__ joined #mojo
02:13 GabrielVieira joined #mojo
02:41 Stefan joined #mojo
02:41 klapperl_ joined #mojo
02:47 btyler joined #mojo
04:16 beyondcreed joined #mojo
04:31 sk joined #mojo
04:35 laouji_ joined #mojo
04:39 jberger__ tempire: perlr is not updating?
04:40 sujithm joined #mojo
04:56 Stefan joined #mojo
05:12 ka2u joined #mojo
05:19 cpan_mojo Mojo-Twist 0.1 by STL - http://metacpan.org/release/STL/Mojo-Twist-0.1
05:37 dotandimet joined #mojo
05:38 tl joined #mojo
05:53 sujithm joined #mojo
05:57 sujithm_ joined #mojo
06:01 Stefan joined #mojo
06:32 laouji_ joined #mojo
06:48 denisboyun joined #mojo
07:08 hesperaux_ joined #mojo
07:26 laouji_ joined #mojo
07:47 laouji_ joined #mojo
07:54 davido_ joined #mojo
07:56 gnephiak joined #mojo
08:02 eseyman joined #mojo
08:03 denisboyun joined #mojo
08:04 rawler joined #mojo
08:09 schetchik joined #mojo
08:22 ver joined #mojo
08:29 trone joined #mojo
08:34 odc joined #mojo
08:36 basiliscos joined #mojo
08:36 Vandal joined #mojo
08:43 avkhozov joined #mojo
08:52 mire__ joined #mojo
09:00 maxhq joined #mojo
09:11 arpadszasz joined #mojo
09:13 laouji_ joined #mojo
09:24 fhelmber_ joined #mojo
09:31 tholen42 joined #mojo
09:48 ka2u joined #mojo
09:54 nicomen how would you go on about traversing the DOM, depth-firsth with Mojo::DOM ?
10:04 Andy2 joined #mojo
10:05 moritz nicomen: use $dom->children to get the children of a node; the rest is just a small matter of programming
10:37 nicomen moritz: but it's so boring :-(
10:45 dod joined #mojo
10:52 GabrielV_ joined #mojo
10:54 Jonneh joined #mojo
11:05 denisboyun joined #mojo
11:10 Stefan joined #mojo
11:24 nicomen moritz: with ->children I would need to recurse, what I would like is an ->each that went depth first
11:26 nicomen hm, I guess it's the nature of ->find->each I was talking about, but I see that what I do want is a ->find that returns depth first sorted collection
11:26 nicomen oh well
11:27 dsteinbrunner joined #mojo
11:28 Jonneh joined #mojo
11:30 Jonneh_ joined #mojo
11:47 moritz nicomen: no need for recursion, a simple array will doo
11:47 moritz s/doo/do/
11:50 nic_ joined #mojo
11:53 sujithm joined #mojo
11:54 nicomen moritz: I used a reverse collection
11:55 nicomen moritz: (problem is that I need to process an element after a child is potentially deleted because it was empty, then the parent is empty too)
11:57 mil Any idea why $t->tx->res->headers->content_encoding is undef in a test, where MOJO_USERAGENT_DEBUG clearly says Content-Encoding is gzip
11:59 mil https://github.com/kraih/mojo/blob/master/lib/Mojo/Content.pm#L300
11:59 mil Hrmm :)
12:00 sujithm_ joined #mojo
12:03 ka2u joined #mojo
12:17 sujithm joined #mojo
12:21 d4rkie joined #mojo
12:22 ka2u joined #mojo
12:25 klapperl joined #mojo
12:33 arpadszasz joined #mojo
12:34 d4rkie joined #mojo
12:37 nicomen mil: checking it before it is set perhaps?
12:38 nicomen ah saw the git paste now
12:42 avkhozov joined #mojo
13:19 mattastrophe joined #mojo
13:21 dod joined #mojo
13:32 jberger_ joined #mojo
13:38 dod joined #mojo
13:43 radixo joined #mojo
13:44 radixo Hello guys.. I am facing problems with Mojo::DOM.. It is not parsing a XML
13:47 * moritz still doesn't know what the error message or the input is
13:51 Jonneh joined #mojo
13:56 sh4 joined #mojo
14:06 radixo guys... http://pastebin.com/gzV9vJfy
14:07 radixo why this code get no div?
14:07 nic_ joined #mojo
14:08 moritz radixo: because there's no div in your XML
14:08 moritz radixo: your XML mostly consists of a big lump of text (search for CDATA)
14:09 moritz radixo: and inside that text there's stuff that looks like HTML again, but that's not part of the XML markup
14:10 radixo moritz: thanks... I will see..
14:15 radixo moritz: Is there a way to select CDATA text with Mojo::DOM??
14:15 moritz radixo: well, you can extract it, and parse it again (probably a new Mojo::DOM object)
14:15 radixo moritz: thank you..
14:18 Andy2 joined #mojo
14:32 da5id joined #mojo
14:35 btyler joined #mojo
14:46 radixo moritz: I am trying to get one elemente attr.. but if the elemente does not exists.. is there a way to return empty string or undef than get an error?
14:47 mire__ joined #mojo
14:47 moritz radixo: check if the element exists before calling ->attr
14:49 Andy2 joined #mojo
14:59 Andy2 joined #mojo
15:08 Stefan joined #mojo
15:12 sujithm joined #mojo
15:20 marty joined #mojo
15:20 marty joined #mojo
15:25 gryphon joined #mojo
15:27 ka2u joined #mojo
15:41 meshl joined #mojo
15:43 GabrielVieira joined #mojo
16:03 arpadszasz joined #mojo
16:12 Stefan joined #mojo
16:33 mattastrophe joined #mojo
16:58 aggrolite joined #mojo
17:10 jzawodn joined #mojo
17:27 bowtie_ joined #mojo
17:33 denisboyun joined #mojo
17:37 ka2u joined #mojo
18:12 * sri sometimes wonders if non-blocking stuff in mojolicious would be easier to learn if it used promises
18:13 sri like my $promise = $ua->aget('http://mojolicio.us');
18:14 sri $promise->then(sub { my $tx = shift; ... });
18:16 sri Mojo::Promise->all($aget1, $aget2)->then(sub { my ($tx1, $tx2) = @_; ... });
18:16 nic I find it difficult to imagine what other people (with different knowledge/experience/training) will find easy/hard to learn
18:17 sri i try to get a feeling for it by browsing through prominent non-blocking apps
18:17 sri ghost being one of the biggest atm. https://github.com/TryGhost/Ghost/blob/master/core/server/index.js
18:18 sri it uses when.js heavily for promises
18:18 sri i've also been digging through perl6 code... using the new promises and supplies stuff
18:18 arpadszasz joined #mojo
18:19 sri supplies solve the accept callback problem
18:20 sri my $supply = Mojo::IOLoop->server({port => 8080}); my $subscription = $supply->tap(sub { my $stream = shift; ... });
18:21 btyler joined #mojo
18:22 nic 'sfunny.. those examples do seem very intuitive
18:24 sri don't think there will be ->on(progress => sub {...}) stuff in perl6... instead you'll have a supply and ->progress->tap(sub {...})
18:27 basiliscos joined #mojo
18:33 arpadszasz_ joined #mojo
18:46 Phil21 joined #mojo
18:46 sri well, realistically... we could only deprecate delays and add Mojo::Promise as a replacement, without changing any other apis
18:51 sri side note... Ghost is sooooooooooooooo pretty https://ghost.org/
18:57 dod joined #mojo
19:04 tempire jberger: oh dear
19:04 tempire let me check it out
19:07 doby I agree with sri on this one, I switched off Contenticious because ghost is so pretty
19:07 mattastrophe joined #mojo
19:07 doby mine -> http://doyleyoung.net/
19:10 maxhq1 joined #mojo
19:11 basiliscos joined #mojo
19:13 sri i only promises weren't so damn ugly
19:14 tempire erg.
19:15 moritz .oO( you need ghost.org promises )
19:16 sri *if
19:17 maxhq joined #mojo
19:18 basiliscos1 joined #mojo
19:23 tempire jberger: perlr updated. the host machined their perls and didn't have all the things installed
19:33 basiliscos joined #mojo
19:40 sahadev joined #mojo
19:49 Stefan joined #mojo
19:51 skullbocks joined #mojo
20:25 lukep joined #mojo
20:37 good_news_everyone joined #mojo
20:37 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/h6Y3Pg
20:37 good_news_everyone mojo/master 562e258 Sebastian Riedel: improved Mojo::Reactor::EV responsiveness
20:37 good_news_everyone left #mojo
20:37 sujithm joined #mojo
20:38 sri looks like i missed that getting fixed in EV
20:39 sri if anyone has something to contribute to promises in mojolicious... you better speak up... i'm investigating this seriously atm and might make a decision without you otherwise
20:44 marcus sri: I think promises is interesting. I'm rather worried about delays getting deprecated. So much end user code depending on it :-/
20:44 marcus sri: would be a huge rewrite of Convos for instance.
20:45 sri you could fork delays and keep them
20:46 sri then it's merely a s/.../.../
20:46 skullbocks joined #mojo
20:47 sri i'm more interested in correctness of the pattern
20:48 sri what should we be teaching perl newbies... delays or promises?
20:50 sri marcus: batman has actually been one of those pushing for promises in the past ;p
20:51 sri CAREFUL WHAT YOU ASK FOR... YOU MIGHT ACTUALLY GET IT!
20:52 marcus Yeah, ghost looks good.
20:53 marcus Not so sure about promises. I think delays has worked pretty well for me, and fairly easy to understand
20:53 sri for you maybe, but that has not been the feedback we've been getting over the last year
20:54 marcus I know diegok was interested in promises.
20:54 sri tempire too
20:54 marcus Well, maybe it's the basic concept of the ioloop people have trouble with, and not delays/promises?
20:57 tempire I think people will have the same trouble with promises that they have with delays.
20:58 marcus having said that, promises might be prettier.
20:58 * tempire likes delays/steps
20:59 marcus I'm having a little trouble thinking through how promises will scale for more involved operations with multiple steps/parallel operations
21:00 sri my $combined_promise = Mojo::IOLoop->promise->all($promise1, $promise2, $promise3);
21:00 sri $combined_promise->then(sub { my ($result1, $result2, $result3) = @_; })
21:02 sri every ->then() may return a new promise, which can be a compound promise again
21:02 sri and you chain ->then()->then()->then()
21:03 aggrolite joined #mojo
21:03 sri perltidy murders such chains though... so you would have to assign each new promise to a variable
21:03 sri my $step1 = $promise->then(sub {...}); my $step2 = $step1->then(sub {...});...
21:05 sri with Mojo::UserAgent a promise would look like my $promise = Mojo::IOLoop->promise; $ua->get('mojolicio.us' => $promise->resolver); $promise->then(sub { my $tx = shift; });
21:06 sri or my $promise = $ua->aget('mojolicio.us') if it gets dedicated methods
21:06 marcus Not so pretty anymore, imo
21:07 sri https://metacpan.org/pod/Promises#SYNOPSIS # this is the reality of promises
21:09 marcus eek
21:10 sri bolted on promises i should say... you can also have things return promises
21:11 marcus I actually implemented promises for a search engine I did at startsiden like 8 years ago :)
21:11 marcus By returning a promise object and reblessing when I got data back. horrible
21:12 sri my $compound_promise = Mojo::IOLoop->promise->all($ua->aget('mojolicio.us'), $ua->aget('metacpan.org')); $compound_promise->then(sub { my ($tx1, $tx2) = @_; })
21:12 sri or rather
21:12 sri Mojo::IOLoop->promise->all($ua->aget('mojolicio.us'), $ua->aget('metacpan.org'))->then(sub { my ($tx1, $tx2) = @_; ... })
21:14 marcus sri: And if you want to do something else based on the data of those promises, you set up another ->then inside the callback?
21:14 sri no, you make the callback return a promise and append a ->then to the ->then
21:14 sri on the outside
21:15 sri Mojo::IOLoop->promise->all($ua->aget('mojolicio.us'), $ua->aget('metacpan.org'))->then(sub { my ($tx1, $tx2) = @_; ...; return $promise })->then(sub {...});
21:15 marcus ok.
21:20 tempire I've never liked ->then in promises
21:20 tempire done/fail/progress is much nicer
21:20 good_news_everyone joined #mojo
21:20 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/UsIBeg
21:20 good_news_everyone mojo/master 21f6503 Sebastian Riedel: updated EV requirement to 4.15 for certain bug fixes
21:20 good_news_everyone left #mojo
21:20 tempire I'm indifferent towards promises in perl at this point.
21:26 Stefan joined #mojo
21:37 mattastrophe joined #mojo
21:47 chansen joined #mojo
22:01 sri here's an adaption of our biggest cookbook example http://pastie.org/8784059
22:01 sri for comparison the original http://pastie.org/8784061
22:04 sri and this is promises without special Mojo::UserAgent methods http://pastie.org/8784066
22:04 sri oops, typo
22:05 sri http://pastie.org/8784068
22:07 sri but i suppose thay example might not be really fair
22:08 sri delay without steps would be just as short
22:10 Stefan joined #mojo
22:11 jkg joined #mojo
22:14 sri ok, this one is much more realistic for steps
22:14 sri http://pastie.org/8784094
22:14 sri http://pastie.org/8784081 # old
22:15 gryphon joined #mojo
22:23 Stefan joined #mojo
22:31 rem_lex|pivo joined #mojo
22:37 Stefan joined #mojo
22:39 Stefan joined #mojo
22:40 Stefan joined #mojo
22:42 Stefan joined #mojo
22:44 Stefan joined #mojo
22:44 good_news_everyone joined #mojo
22:44 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/0CCiow
22:44 good_news_everyone mojo/master e8cdca0 Sebastian Riedel: recurring timers cannot be zero in EV
22:44 good_news_everyone left #mojo
22:48 jberger_ joined #mojo
22:48 * jberger_ likes delays and steps
22:49 jberger_ tempire++ # fixing perlr
22:51 GabrielV_ joined #mojo
22:54 nmac joined #mojo
22:54 sri so, do we have nobody in favor of promises anymore?
22:54 sri maybe i've misjudged the situation
22:55 tempire I like them, but I don't know about replacing delay
22:56 sri well, having both would defeat the purpose
23:08 punter joined #mojo
23:09 sri alternatives to $delay->steps() could also be interesting
23:10 sri current ->steps() is more like ->waterfall()... possible additions from async.js would be ->series() and ->parallel()
23:11 sri waterfall = callbacks run in series, passing arguments to the next... series = callbacks run in series, but arguments get collected for last callback in chain... parallel = all callbacks except for the last one get called right away, and arguments get collected for last callback
23:12 sri with some interesting possibilities for options... like a limit on how many callbacks can be active at a time (waiting for events)
23:17 punter joined #mojo
23:57 jberger_ It seems that the Promises module can work with Mojo
23:58 jberger_ It even has a Mojo::IOLoop backend
23:59 jberger_ Delay is used to support the mojo core and is a simple general purpose solution
23:59 jberger_ I don't see any reason to include something more complex in the mojo core
23:59 jberger_ Sounds like a job for a mojo hack of the day article

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