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

IRC log for #mojo, 2013-11-28

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

All times shown according to UTC.

Time Nick Message
00:11 jberger_ joined #mojo
00:13 jberger__ joined #mojo
00:13 jberger_ joined #mojo
00:15 jberger__ joined #mojo
00:29 dsteinbrunner joined #mojo
00:34 jamesw joined #mojo
00:36 sri 75% compression for json messages sent via websockets is pretty neat
00:40 bluescreen_ joined #mojo
01:00 d4rkie joined #mojo
01:06 hahainternet sri: gzip?
01:06 purl gzip is not responsable for bad diskblocks. replicate my data.
01:06 hahainternet haha
01:06 sri https://github.com/kraih/mojo/issues/566
01:06 hahainternet ah nice
01:07 hahainternet that'll help out a lot actually
01:07 hahainternet if you have a min, i have a question above, but i think i need to learn more about routing really
01:07 hahainternet as ->continue might work but i don't know
01:11 laouji joined #mojo
01:20 mire__ joined #mojo
01:45 AirDisa joined #mojo
01:46 AirDisa Going through cookbook, got: Can't locate object method "text_before" via package "Mojo::DOM"
01:46 davido joined #mojo
01:47 AirDisa any help to speed me on my way much appreciated
01:48 davido For my own edification, would someone explain why the app generated by 'mojo generate app' doesn't "use lib", and instead does approximately what "use lib" would have done, in a BEGIN block? (Sheer curiosity, and hoping to learn something)
01:48 AirDisa tried: use Mojo::DOM;
01:48 AirDisa I haven't tried generate yet
01:54 sri davido: you'd expect that's what lib does, but it doesn't!
01:54 sri and that's the problem :)
01:55 * sri has websocket decompression working
01:55 davido I was just now trying to decipher the source of 'lib'.  ...From the POD: "is I<almost> the same as saying BEGIN{ unshift....... }"
01:56 davido I trust your judgement, of course.  Was just trying to understand the issue.
01:57 davido Looks like there's just too much cleverness.
01:57 sri if you're lucky you can get jberger to rant about it for an hour when he shows up ;p
01:58 davido Great... would love to hear that. ;)
01:59 sri hahainternet: most of us usually ignore questions we don't understand
01:59 sri AirDisa: upgrade your mojolicious
02:00 davido Is tempire still MIA?
02:00 davido I'd still love to solicit a talk from him at an upcoming PerlMongers.
02:00 sri last i heard he went to utah to become a mormon or so
02:01 davido Well, it's the *Salt Lake Perl Mongers* I'm soliciting for.
02:01 sri which in retrospect was inevitable with that beard
02:02 AirDisa will do
02:02 AirDisa thank you!
02:06 ronsavage joined #mojo
02:09 sri http://pastie.org/8513680 # not quite done yet, but a first websocket compression patch that works in both directions with chrome canary \o/
02:11 sri sadly my zlib-fu is weak
02:11 sri http://www.openbooktoronto.com/sites/default/files/obt/illustrations/I%20have%20no%20idea.jpg
02:12 AirDisa sri: still get error, insalled latest afaik
02:12 rem_lex joined #mojo
02:13 Adurah joined #mojo
02:13 AirDisa maybe because I'm useing lite?
02:14 AirDisa can't find method text_before, text_after are in docs... must be pilot error :)
02:17 bzero joined #mojo
02:19 Adurah_ joined #mojo
02:19 AirDisa I think I'm on to it
02:19 tba joined #mojo
02:26 duncanthrax joined #mojo
02:32 sri hah, i forgot client side extension negotiation
02:32 sri think i got a working patch now
02:42 sri hmmm....
02:44 sri for small messages it's generally bad to compress
02:44 sri for big ones it can really pay off
02:44 sri 262145 -> 272
02:44 sri :)
02:52 KindOne joined #mojo
03:01 hahainternet sri: oh sorry I didn't realise it was hard to understand, i'll simplify it
03:01 hahainternet I want requests to / to be routed to two different actions depending on whether the user is authenticated (with Mojo::Plugin::Authentication) or not
03:02 hahainternet I don't understand the router well enough to do this and at the moment am using a bridge('/') that redirects the user if they are not authenticated, this works but seems very hacky
03:23 good_news_everyone joined #mojo
03:23 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/q12-4g
03:23 good_news_everyone mojo/master 83ebad4 Sebastian Riedel: added support for permessage-deflate WebSocket compression (closes #566)
03:23 good_news_everyone left #mojo
03:23 sri well, that was fun
03:25 sri needs better tests though
04:09 good_news_everyone joined #mojo
04:09 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/RKuxvQ
04:09 good_news_everyone mojo/master 6ed889c Sebastian Riedel: better WebSocket compression tests
04:09 good_news_everyone left #mojo
04:12 sri AirDisa: if in doubt try a oneliner
04:13 sri perl -Mojo -E 'say g("mojolicio.us")->dom->find("a")->text_before'
04:14 AirDisa oh, let me try that
04:15 AirDisa Can't locate object method "text_before" via package "Mojo::Collection" at -e line 1.
04:15 sri or more fun ;p
04:15 sri perl -Mojo -E 'say g("mojolicio.us")->dom->find("a")->text_before->compact->map(sub { "* $_" })->join("\n")'
04:15 sri AirDisa: congrats, your installation is broken!
04:15 AirDisa hah!
04:15 AirDisa k
04:16 AirDisa I am able to get stuff like $e->text;
04:16 sri http://pastie.org/8513795 # what i see
04:16 AirDisa heh, I want my shell to say that
04:16 sri does "mojo version" really say 4.58?
04:17 AirDisa it did on last install (second ever!)
04:17 sri hahainternet: that doesn't really make it more clear
04:17 sri at least for me
04:18 AirDisa right?!?
04:18 AirDisa :)
04:18 AirDisa well, I find it interesting I'm getting $e->text but not text_before
04:18 sri mixed versions for sure
04:19 AirDisa seemingly
04:26 AirDisa Mojolicious is up to date. (4.58)
04:29 AirDisa I'll probably sleep on it. I'm pretty happy I got started today. I'll be back in the morning US time. Good night!
04:33 sri nn
04:33 sri hahainternet: anyway, redirecting is the RESTful thing to do
04:34 hahainternet sri: i think redirecting to /home or similar is probably pretty acceptable, but i'm just working on the orders of others at the moment
04:35 hahainternet anyhow it's working for now just fine
04:35 hahainternet mojo is such a pleasure 99.9% of the time
04:57 preflex_ joined #mojo
05:43 ronsavage joined #mojo
05:54 laouji joined #mojo
06:01 good_news_everyone joined #mojo
06:01 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/k3LjqQ
06:01 good_news_everyone mojo/master 0a777a0 Sebastian Riedel: replaced compressed attribute with has_compression method
06:01 good_news_everyone left #mojo
06:04 beyondcreed joined #mojo
06:13 Vandal joined #mojo
06:16 laouji joined #mojo
06:21 tba_ joined #mojo
06:21 russum joined #mojo
07:58 dod joined #mojo
08:01 marcus o/
08:04 dod joined #mojo
08:06 odc joined #mojo
08:25 nicolaas joined #mojo
08:32 trone joined #mojo
08:56 maxhq joined #mojo
09:26 laouji joined #mojo
09:33 ver joined #mojo
09:36 themage joined #mojo
09:36 russum left #mojo
09:43 batman \o
09:49 batman off-topic: is there a way i can say "binary required" in my Makefile.PL ?
09:50 batman something like exit $MAGIC_CODE unless grep { -x "$_/git" } split /:/, $ENV{PATH};
09:51 batman something like requires => { perl => .... } maybe..?
09:53 laouji joined #mojo
10:17 ilbot2 joined #mojo
10:17 Topic for #mojo is now 🎩, indubitably | http://mojolicio.us | http://irclog.perlgeek.de/mojo/today
10:17 bluescreen_ joined #mojo
10:17 marcus joined #mojo
10:17 Dandre joined #mojo
10:18 KindOne joined #mojo
10:18 Tiger joined #mojo
10:18 __mkrull joined #mojo
10:18 dvinciguerra joined #mojo
10:18 akiym joined #mojo
10:18 Mikey joined #mojo
10:18 sawtooth joined #mojo
10:18 wfaulk joined #mojo
10:18 Jonis joined #mojo
10:18 zivester joined #mojo
10:18 jan joined #mojo
10:18 bobkare joined #mojo
10:18 howitdo joined #mojo
10:18 ivan joined #mojo
10:18 bayashi joined #mojo
10:18 tardisx joined #mojo
10:18 gabiruh joined #mojo
10:18 jmmills_ joined #mojo
10:18 Andreas joined #mojo
10:18 robinsmidsrod joined #mojo
10:18 HtbaaPi joined #mojo
10:18 jberger joined #mojo
10:18 davido joined #mojo
10:18 Grrrr joined #mojo
10:19 ronsavage joined #mojo
10:20 bc547 joined #mojo
10:20 d4rkie joined #mojo
10:21 Mike-PerlRecruiter_ joined #mojo
10:26 garu joined #mojo
10:30 basiliscos joined #mojo
10:38 d4rkie joined #mojo
10:40 jamesw joined #mojo
10:46 hummeleBop joined #mojo
10:54 mire__ joined #mojo
11:03 laouji joined #mojo
12:11 ryozi joined #mojo
13:25 mire__ joined #mojo
13:36 maxhq joined #mojo
13:44 dvinciguerra joined #mojo
14:12 asarch joined #mojo
14:16 athenot joined #mojo
14:43 jberger_ joined #mojo
14:46 sh4 joined #mojo
14:46 jberger_ batman, o/
14:47 batman |o|
14:47 jberger_ _o/
14:47 jberger_ \o_
14:47 sri \o\
14:47 sri /o/
14:48 jberger_ hi all
14:48 jberger_ batman (and sri if you are interested), want to take a look at the current state of ForkCall?
14:48 batman url
14:48 sri you take  look at websocket compression first ;p
14:48 jberger_ https://github.com/jberger/Mojo-IOLoop-ForkCall
14:49 jberger_ oh, yeah, I saw that on the log
14:49 jberger_ sri++
14:49 * jberger_ looks
14:49 batman jberger_: die ENOMOJOPLUGIN;
14:49 jberger_ there is not one yet
14:49 batman spot on ;)
14:50 jberger_ but it now has all the return values and settings needed
14:50 batman $fc->ioloop->start unless $fc->ioloop->is_running; use the globals instead
14:51 batman i don't think a normal user should care that the $fc has ioloop
14:51 jberger_ sri specifically was interested in using alternate ioloops
14:51 jberger_ IIRC
14:51 batman ^ complaining about the SYNOPSIS
14:52 batman "Still, all is not lost." :D
14:52 sri not interested, it's a standard feature imo
14:52 jberger_ I could make the synopsis simpler
14:52 sri but yes, i would use globals in examples too
14:53 jberger_ the singleton is the documented default, so its not even inconsistent
14:53 batman WARNINGS++
14:53 sri no wait
14:54 sri actually i wouldn't http://mojolicio.us/perldoc/Mojo/IOLoop/Client#SYNOPSIS
14:54 batman sri: not the same thing imo
14:55 batman https://metacpan.org/pod/Mojo::UserAgent#SYNOPSIS <--- better example
14:55 sri wrong!
14:55 batman ?
14:55 sri user agent is a hybrid and only uses the ioloop attribute for blocking operations
14:56 batman $ua has ioloop, $fc has ioloop.
14:56 sri but for different purposes
14:56 * batman agrees with batman :)
14:57 batman ...but i'm not going to spend time forcing the SYNOPSIS for $fc
14:58 batman jberger_: L<AnyEvent::Util>'s C<fork_call>. ==> L<AnyEvent::Util/fork_call>.
14:58 sri somehow this cat reminds me of tempire http://i.imgur.com/YrfnljJ.jpg
14:58 batman jberger_: nevermind that last bit. AnyEvent::Util's pod sucks
14:59 jberger_ batman, :-)
15:00 batman i still don't like "finish" :(
15:00 jberger_ it doesn't matter if its an event or just the callback, there is going to be a reference to $fc in the callback
15:01 jberger_ but the weaken attribute works
15:01 batman yeah...don't like it :)
15:01 jberger_ I'm not sure I have a better solution
15:02 sri batman doesn't do better solutions, he only says when he doesn't like something ;p
15:02 jberger_ well in that case, noted and noted :-D
15:02 batman sri: i did make what-i-think-is-a-better-solution.
15:03 batman jberger_ and be discussed it, and we agreed to disagree :)
15:03 batman s/be/me/
15:03 sri now review websocket compression!
15:03 * jberger_ reviews
15:04 sri https://github.com/kraih/mojo/compare/819a6c80d2a3fc5175ae29302d7a5bd5fdffa894...0a777a00b45e12023b283128d626c60707d23768
15:04 batman $res = $serializer->([$@]) if $@; => i also like better eval { ...; 1 } or do { OH_NO() };
15:04 batman but that's a matter of taste :)
15:05 batman jberger_: i could have a singleton $fc and call run() as many times as i like...?
15:05 sri i forgot to implement a required option for websocket clients though
15:06 jberger_ batman, it needn't be a singleton, but yes you can reuse the object
15:06 batman yeah, bad use of words
15:06 batman jberger_++ # FC TO THE CPAN! NOW!
15:06 batman :D
15:07 jberger_ before making a plugin/helper?
15:08 * jberger_ did not know about Compress::Raw::Zlib
15:09 * jberger_ wonders why BBC America is showing TNG
15:10 batman sri: where do you set $self->{compress} ?
15:10 batman jberger_: sure. you can add the plugin later :)
15:11 batman jberger_: sucks stopping at 0.01 becuase THE CODE IS PERFECT!!!
15:11 batman ;)
15:11 jberger_ batman, sub _deflate
15:11 jberger_ hahaha
15:11 batman ah!
15:11 * batman need dinner :(
15:12 * jberger_ need breakfast
15:12 batman sri: looks too simple. but then again, i'm hungry so you shouldn't trust me :)
15:13 mire__ joined #mojo
15:15 jberger_ sri: so if I understand correctly, the client requests compression via headers
15:15 sri right
15:15 jberger_ is there some document I should look at to help me understand the flow?
15:15 jberger_ mozilla or w3c etc?
15:16 sri http://www.igvita.com/2013/11/27/configuring-and-optimizing-websocket-compression/ # good article about it
15:16 jberger_ thanks
15:17 sri http://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-15 # and the spec if you want to check details
15:17 jberger_ interesting that you negotiate the compression alogorithm
15:17 batman sri: what exactly do you want feedback on? you've tested compression on/off and that the ua has compression on by default..?
15:17 batman what more is there to do?
15:18 sri i forgot that no_context_takeover is a required feature for clients btw., thinking about how to add it
15:18 * batman doens't know the protocol.... **fading out**
15:18 sri batman: i don't know, i just want more eyeballs
15:18 batman ok. sorry for not being able to help
15:18 jberger_ the article is talking about messages, does it mean frames?
15:18 sri the point of reviews is to find stuff i overlooked
15:19 batman can't you do something simple??
15:19 batman :D
15:19 batman sri++ # fixing stuff so i don't
15:19 sri jberger: doubt it
15:20 jberger_ so how do you know the difference between "messages"
15:20 sri batman: first you complain that it looks too simpe... ;p
15:20 sri *+l
15:20 jberger_ batman, go eat you're not ... ALL GLORY TO THE HYPNOTOAD
15:20 batman sri: that's from a pure code-review standpoint
15:21 sri jberger: last frame of a message has the FIN bit set
15:21 batman sri: pure code review: doesn't look crazy and you did test the change.
15:21 jberger_ oh ok
15:21 batman but if it works in the real world ... i don't know :(
15:21 sri you can try it with chrome canary
15:22 sri compression is enabled by default now
15:22 jberger_ :-(
15:22 jberger_ "Chrome Canary is currently not available on the linux platform."
15:22 sri in january all chrome browsers will support it
15:24 jberger_ even chromium doesn't have linux: http://www.chromium.org/getting-involved/dev-channel
15:24 sri btw. using zlib i feel like http://www.openbooktoronto.com/sites/default/files/obt/illustrations/I%20have%20no%20idea.jpg
15:24 jberger_ chromium canary I mean
15:24 sri so that might be a good target for review
15:24 jberger_ hehe, well sadly I
15:24 jberger_ I'm no zlib expert either
15:26 rem_lex| joined #mojo
15:26 jberger_ if you're worried, possibly rely on a higher level zlib implementation if available?
15:26 * jberger_ looks for such a CPAN module
15:27 sri 75% compression for json messages is pretty amazing though
15:28 jberger_ why use Compress::Raw::Zlib over Compress::Zlib
15:28 jberger_ ?
15:30 sri because we're already using that interface for gzip compression https://github.com/kraih/mojo/blob/master/lib/Mojo/Content.pm#L291
15:30 sri if you can make it look cleaner, be my guest
15:41 punter joined #mojo
15:43 jberger_ sri: line 104. Are you defaulting permessage-deflate 'on' by default
15:43 jberger_ ?
15:49 jberger_ anyway, it all looks sensible to me, and your tests are good
15:49 jberger_ sri++
15:52 odc joined #mojo
16:09 batman Haha! @iamdevloper: DHTML: Definitely (not) How To Meet Ladies.
16:09 batman ^^^ stop making cool header for mojolicio.us sri ;)
16:10 jberger_ https://metacpan.org/pod/release/JBERGER/Mojo-IOLoop-ForkCall-0.01/README.pod
16:10 batman Cool!
16:11 jberger_ if I have time this weekend, I hope to use it to make part 3 of my async series
16:11 kwa joined #mojo
16:14 jberger_ I'm liking the OO interface better than the fork_call wrapper now too
16:14 jberger_ batman++
16:16 sri jberger_: yes, any reason not to?
16:16 jberger_ i don't think so, I was just making sure I was reading that correctly
16:16 sri it's not "default to on" actually, we announce that we support it
16:16 jberger_ right, thats true
16:17 jberger_ no I think its fine
16:22 rem_lex joined #mojo
16:28 Adurah_ Compress::Raw::Zlib does have fine granularity in options...
16:33 beyondcreed joined #mojo
16:42 hrupp joined #mojo
16:53 jberger_ https://twitter.com/joelaberger/status/406101594803957760
16:55 sri the context takeover shit really ruins the simplicity
16:55 jberger_ context takeover?
16:57 sri http://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-15#section-8.1.1
16:57 jwang joined #mojo
17:23 dsteinbrunner is there a way to have exception messages go to the log?
17:24 jberger_ dsteinbrunner, you could subscribe to the reactor's error event
17:24 dsteinbrunner I'm just using the default lite app and create a log dir so development.log start populating
17:24 hahainternet hmm, i'm trying to serve images from within public/ but everything is sent in text/plain, can i change the response content-type?
17:25 hahainternet the file itself is an image/tiff, with correct extension, and the browser is sending the correct accept header
17:27 jberger_ you might need to add the type to the types registry
17:27 jberger_ app->types->type( 'tif' => 'image/tiff')
17:27 hahainternet basaed on extension?
17:28 hahainternet ah, seems so
17:28 hahainternet thanks jberger_
17:28 jberger_ np
17:28 jberger_ see Mojolicious::Types
17:28 jberger_ for more info
17:28 hahainternet am seeing that currently :)
17:28 jberger_ mojo eval -V 'app->types->types'
17:29 jberger_ to see the whole list
17:29 jberger_ you can do the same thing for your app, once you declare it
17:29 hahainternet adding it solved one problem, now it's still not displaying in firefox, but makes sense
17:29 jberger_ ./myapp eval -V 'app->types->types'
17:29 hahainternet yeah already fixed, stuck in startup, thanks again
17:29 jberger_ :-)
17:29 jberger_ np
17:30 good_news_everyone joined #mojo
17:30 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/QN2gRA
17:30 good_news_everyone mojo/master ceb4799 Sebastian Riedel: added support for "client_no_context_takeover"
17:30 good_news_everyone left #mojo
17:30 sri time for some more reviewing :S
17:30 jberger_ do browsers show tiff?
17:30 hahainternet it seems not
17:30 jberger_ I didn't think so
17:30 jberger_ also, tiff are huge
17:30 jberger_ IIRC
17:30 sri https://github.com/kraih/mojo/compare/819a6c80d2a3fc5175ae29302d7a5bd5fdffa894...ceb4799a583df0c68ff6af79828c2b4bc08a9ec6
17:30 hahainternet that's fine it's for scientific purposes
17:30 hahainternet and i'll just convert to png
17:30 hahainternet which will be fairly huge itself
17:31 jberger_ I'm aware :-)
17:31 Adurah_ pngcrush away.
17:31 jberger_ hahainternet, electron microscope images?
17:31 hahainternet there's another png crush util too which i found very effective
17:31 hahainternet jberger_: something like that yes
17:34 dsteinbrunner jberger_: http://pastebin.com/4wz0uPwe
17:34 dsteinbrunner something like that?
17:35 purl rumour has it something like that is the basic gist of what we have going forward. Except I have to make sure there is oversight on the 'mst trained bastard' program
17:35 jberger_ dsteinbrunner, yes, but use the ioloop's reactor
17:36 jberger_ $reactor = Mojo::IOLoop->singleton->reactor
17:36 hahainternet jberger_: let me try a question on you that i couldn't express well enough for sri. I am trying to route '/' to two different actions, one if authenticated and one if not, the way i'm doing this at the moment is with a bridge route on '/' that checks whether the user is authenticated and redirects to /login if not
17:37 good_news_everyone joined #mojo
17:37 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/top76g
17:37 good_news_everyone mojo/master f72233c Sebastian Riedel: more WebSocket compression tests
17:37 good_news_everyone left #mojo
17:37 hahainternet if the user is going to /, i pass it through this check routine then use an -over(authenticated => 1) condition to match the authenticated action, then a route without the over condition for unauthetnicated
17:37 hahainternet this works, but it seems ugly as heck and i'm sure i just don't understand routes well enough
17:37 hahainternet sri pointed out that i should be redirecting anyway, but for the moment i want to learn more about the router
17:38 jberger_ hahainternet, I'm not very good at the router, its my weak-point in the Mojolicious stack
17:38 dsteinbrunner jberger_: changed but still does not appear to work
17:38 hahainternet jberger_: no problem, hopefully someone will chime in
17:38 hahainternet for now it is functional
17:38 jberger_ I would do it with redirects personally
17:41 sri i'm open for suggestions if anyone has an idea for doing this more elegantly https://github.com/kraih/mojo/blob/master/t/mojolicious/websocket_lite_app.t#L58
17:43 jberger_ sri: I'm not sure what else could be done
17:48 jberger_ dsteinbrunner, http://pastie.org/8515173
17:50 dsteinbrunner hmmm.. ok, maybe my other attempts worked
17:50 dsteinbrunner yours did not work till I used a browser
17:50 jberger_ ?
17:50 jberger_ it works for me
17:51 dsteinbrunner yea
17:51 jberger_ ./test.pl get /
17:51 dsteinbrunner but not when I run via test
17:51 jberger_ test?
17:51 purl test is X
17:51 dsteinbrunner ./test.pl test
17:51 jberger_ what test are you writing?
17:52 dsteinbrunner it appears "Reading config file" stuff hits the log when running tests but not other stuff
17:53 dsteinbrunner should I be doing something else to get logging to work from test code
17:53 dsteinbrunner using Test::Mojo
17:54 dsteinbrunner jberger_: thanks for the help so far
17:54 jberger_ I still am not sure what you are attempting to do
17:54 jberger_ are you attempting to test your log output?
17:54 dsteinbrunner no.. I'm just going normal testing
17:55 dsteinbrunner and wanting to see log output
17:55 jberger_ prove -lv
17:56 dsteinbrunner hmm.. ok
17:56 dsteinbrunner that works
17:58 jberger_ btw if you want to test that you have no exceptions, you might try this: https://github.com/jberger/Mojo-IOLoop-ForkCall/blob/master/t/weaken.t#L30
17:58 jberger_ or to test that you do, you would test that $loop_err is true
18:03 jberger_ dsteinbrunner, it looks like you can do verbose testing using your app too
18:03 jberger_ ./test.pl test -v
18:04 beyondcreed joined #mojo
18:04 jberger_ I just use prove, but the test command is handy I suppose
18:05 jberger_ oh!
18:05 jberger_ sri: can I propose a -j option for the test command?
18:06 jberger_ I don't use HARNESS_OPTIONS=-j9 as often as I should, because its too much to type
18:07 jberger_ but ./myapp test -j 9 I might actually do
18:07 jberger_ oh, it seems that prove takes -j as well
18:07 jberger_ I guess I could just do that
18:07 jberger_ nm
18:08 dsteinbrunner wonder why my call to plugin 'Config' logs without the -v
18:10 jberger_ log level? https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Plugin/Config.pm#L9
18:10 hrupp_ joined #mojo
18:11 dsteinbrunner the errors I was trying to output were debug also
18:13 jberger_ try logging something else in the app script, could be a load-time (compile-time) vs run-time thing
18:13 dsteinbrunner yeah
18:13 dsteinbrunner that would be it
18:14 jberger_ cool
18:14 jberger_ mystery solved then
18:16 hrupp_ jberger: I've sent a pull request for Galileo as described in my comments
18:16 * jberger_ look
18:16 jberger_ s
18:17 jberger_ hrupp_++
18:17 hrupp_ \o/
18:18 jberger_ hrupp_, the email went to my gmail forums folder
18:18 jberger_ which doesn't notify on my phone
18:18 jberger_ sorry I didn't see it sooner
18:18 jberger_ thanks for doing the legwork on this!
18:19 hrupp_ doesn't matter, we have irc ;)
18:21 hrupp_ jberger_: everytime again ;)
18:21 jberger_ let me put a bow on this and send it off to CPAN
18:35 jberger_ hrupp_, released!
18:36 jberger_ thanks again!
18:39 jberger_ hrupp_, do you have twitter?
18:41 hrupp_ no, not yet
18:41 jberger_ thinking about making one? I would mention you for your contributions
18:42 denisboyun joined #mojo
18:43 dsteinbrunner Is there a method that does this: foreach ($self->param) { $params{$_} = $self->param($_); }
18:44 dsteinbrunner returns prams with vals
18:44 hrupp_ jberger_: I'm going to create an account ... tomorrow
18:45 jberger_ tweet at me when you join
18:45 jberger_ https://twitter.com/joelaberger
18:45 hrupp_ ok, I will do so
18:51 dod joined #mojo
18:53 tba joined #mojo
19:04 denisboyun joined #mojo
19:08 batman sri: i think you need more parallex: http://wagerfield.github.io/parallax/ :)
19:08 tba_ joined #mojo
19:08 sri pretty
19:09 jberger_ nice
19:11 jberger_ ok so I'm working out the examples for post #3
19:11 jberger_ first: https://gist.github.com/jberger/7696837
19:12 jberger_ second: https://gist.github.com/jberger/7636217
19:12 Mike-PerlRecruiter_ joined #mojo
19:14 batman jberger_: why not use delay? #1
19:14 jberger_ no need
19:14 jberger_ the sleep is just to simulate a long running process
19:14 sri i don't like the way you use the delay in #2
19:15 sri the callback bassed to the delay would look better as a third step
19:15 sri *passed
19:15 batman i agree
19:15 batman i would also use the ioloop singleton
19:15 sri ->ioloop->start/->ioloop->stop also feel out of place
19:15 jberger_ I thought we didn't encourage using the final step (without a non-blocking callback) in the steps
19:15 jberger_ even though it works now
19:15 sri better $delay->wait unless Mojo::IOLoop->is_running
19:16 batman you're mixing singleton and objects. it makes it confusing imo
19:16 jberger_ batman, yes I can see that
19:16 sri jberger_: i don't understand
19:16 jberger_ there is no non-blocking in the delay finish handler
19:16 batman what? why don't you want people to have a final step?
19:16 batman s/people/delay/ :D
19:17 sri i don't get it either, maybe you're mixing something up
19:17 jberger_ maybe
19:17 * jberger_ searches the history
19:17 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Backend_web_services # it's very much encouraged actually
19:21 jberger_ I did the same thing in my second blog post: http://blogs.perl.org/users/joel_berger/2013/11/writing-non-blocking-applications-with-mojolicious-part-2.html
19:21 jberger_ should I revise?
19:22 batman https://gist.github.com/jhthorsen/7697006 # my suggestion
19:22 sri looks just as odd there
19:22 jberger_ I thought that if a step didn't have a begin, that there was some issue
19:22 sri i disagree with batman though
19:22 batman sri: on what?
19:22 purl on is un pronom personnel imbécile qui qualifie celui qui l'emploie
19:22 jberger_ and that it was "fixed" but not encouraged
19:23 sri on using the singleton
19:23 sri $delay->wait would be my choice
19:23 jberger_ sri: should I pass the ioloop from the delay to the fc?
19:23 batman ah! but do you disagree on Mojo::IOLoop->delay() and Mojo::IOLoop->recurring() ?
19:24 sri jberger_: begin only if there are more steps
19:24 jberger_ ok, well I stand corrected
19:24 jberger_ I can go back and fix the second post as well
19:25 sri thing about $delay->wait is that it can work inside an already running event loop
19:25 sri if you do "$delay->wait unless Mojo::IOLoop->is_running;"
19:25 mire__ joined #mojo
19:26 sri while ->start/->stop screw that up
19:26 batman i agree.
19:26 jberger_ in the conversion example, there is no other running loop
19:26 batman but i think you should use Mojo::IOLoop->whatever and not $fc->ioloop->whaterver
19:27 batman jberger_: doesn't really matter.
19:27 sri agreed
19:27 jberger_ yes, in the first example, that one needs an unless
19:27 batman it's about teaching the right thing from step one
19:27 jberger_ ok, I defer
19:27 jberger_ batman, true
19:27 jberger_ always
19:27 batman jberger_: did you look at my version?
19:27 jberger_ yes
19:28 jberger_ oh, ha! I was looking at the wrong example when I made that last comment
19:28 jberger_ disregard
19:29 batman have you updated the example? url?
19:29 jberger_ batman, not yet
19:29 batman haha! i read my own comment as yours :S
19:30 * batman has been looking at too much parallex...
19:31 * sri wonders if Mojo::Transaction::WebSocket should have a build_message method
19:32 sri my $bytes = $ws->build_message({text => 'lalala'})
19:32 sri for testing
19:35 jberger_ better? https://gist.github.com/jberger/7636217
19:35 jberger_ should I also explicitly remove the recurring, if only for teaching good style
19:36 jberger_ I guess it does go along with the idea of "converting"
19:37 batman `--
19:38 batman line 11 and 12..? looks weird
19:38 batman i really like qx{} instead of backticks.
19:39 jberger_ they look weird because they were wrong :-S
19:41 jberger_ personally I do to, but I think more readers will understand the backticks
19:46 batman i don't get MIT license... is it similar to apache?
19:54 good_news_everyone joined #mojo
19:54 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/YqnBaw
19:54 good_news_everyone mojo/master 6b9702a Sebastian Riedel: added build_message method to Mojo::Transaction::WebSocket
19:54 good_news_everyone left #mojo
19:55 sri yea, worth it for testing
19:56 sri batman: MIT is like BSD
19:56 batman even better :)
20:08 jberger_ sri: could there be a smart wait?
20:09 jberger_ where it checks to see if the ioloop is running, start it if needed, and if it had to start it, end it on finish?
20:09 sri easy to add, very very hard to explain
20:09 sri imo it's better to make it obvious in this case
20:10 jberger_ I suppose
20:10 jberger_ DDD++
20:10 jberger_ (I really am taking to that concept)
20:11 meshl joined #mojo
20:13 Mad_Dud- joined #mojo
20:20 good_news_everyone joined #mojo
20:20 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/9PDaxQ
20:20 good_news_everyone mojo/master 1dd8ffa Sebastian Riedel: removed deprecated mode specific methods in application class
20:20 good_news_everyone left #mojo
20:38 trone joined #mojo
20:38 lukep joined #mojo
20:41 jberger_ sri: one more (possibly silly) thought
20:41 jberger_ what about some begin/end pair for Mojo::IOLoop
20:41 jberger_ where begin increments a counter and starts the loop if not running
20:41 jberger_ end decrements and ends the loop if the counter is zero
20:42 jberger_ that is easier to document than doing so in the delay
20:42 sri use case?
20:42 jberger_ all the portability examples
20:43 jberger_ Mojo::IOLoop->begin (no unless is_running)
20:43 sri i think you might be missing a few things
20:43 sri try it with some actual code, almost certain it will suck
20:44 jberger_ it says 'this code is event based, be sure the loop is running, but don't kill it if others depend on it'
20:46 sri aside from the names being confusing because of delays
20:47 jberger_ that was where I took the names from actually
20:47 jberger_ a similar concept of tracking a counter
20:47 sri thing is... in general you don't actually start and stop an event loop repeatedly
20:48 sri if you do odds are your code is bad
20:48 jberger_ well that is true
20:49 sri you might also not be aware of the other delay use case
20:50 jberger_ parallel non-blocking processes in the same step
20:50 sri first example delay
20:50 sri oops
20:50 sri http://mojolicio.us/perldoc/Mojo/IOLoop#delay
20:51 sri delays do that already
20:51 jberger_ I guess I have always done that inside a steps, but it makes sense that you don't need it
20:51 sri it's how delays started
20:51 jberger_ and steps came later
20:51 sri a variation of condvars
20:51 jberger_ interesting
20:54 jberger_ so perhaps my second blog post shouldn't introduce steps at all!
20:56 sri :o
20:56 jberger_ I had never used delays without steps, seems rather silly now that I see it
20:57 sri http://img.pandawhale.com/45822-steve-jobs-mind-blown-gif-1XU8.gif
20:57 jberger_ hahaha
20:57 jberger_ yeah, that's about right
20:58 jberger_ but I tell you, that's part of the reason I like Mojolicious, the tools are easy enough to start with, and yet they keep surprising you
20:58 moritz now we'd just a book that explains them from the ground up, but doesn't stop at introductory examples
20:59 jberger_ but it seems that I have accidentally introduced things in the right order!
20:59 jberger_ once I fix the post
20:59 Lucas1 joined #mojo
20:59 sri once you start using delays like that you'll quickly notice why it's not really encouraged anymore though ;)
21:01 sri http://mojolicio.us/perldoc/Mojo/UserAgent#SYNOPSIS
21:01 sri there's another example, with the right comment above
21:02 sri (the whole "my @args = $delay->wait" thing)
21:03 sri of course, if you have to control the event loop, it's still a good use case
21:04 sri but explaining the difference between controlling an event loop and running inside one is so damn hard
21:06 sri node.js has it a bit better there... since the loop is always running
21:07 al joined #mojo
21:13 jberger_ I don't think its too much harder in Mojo
21:14 jberger_ the ioloop is not running unless you use the mojolicious servers
21:14 jberger_ in which case you have to start them
21:14 jberger_ of course that is easier to say in a blog post than sprinkled into the documentation
21:15 batman jberger_: it doesn't run in all environments. like (earlier) on heroku
21:16 jberger_ batman, yes it did
21:16 jberger_ it just didn't support websockets
21:16 batman no, it did not.
21:16 jberger_ how could it know
21:16 jberger_ you tell it some process to start
21:17 jberger_ so I start my app as a daemon
21:17 batman maybe i started it the wrong way.
21:17 batman had to do $delay->wait unless ...; on both heroku and dotclound iirc
21:18 sri haha, my point exactly!
21:18 sri batman got it wrong like most do
21:23 * jberger_ leaves for family thanksgiving feast
21:23 jberger_ happy thanksgiving all
21:24 sri we don't have that over here
21:24 sri but a happy turkey day to you
21:26 jberger_ I know you don't still, I can wish you a happy one all the same
21:27 jberger_ its one of the few non-commerical holidays here
21:27 jberger_ a time to spend with family and thinking about the blessings we have
21:27 jberger_ so I say again, happy thanksgiving to you all!
21:28 tba joined #mojo
21:29 sri better hurry.... black friday starts soon!
21:43 mire__ joined #mojo
22:29 b2b joined #mojo
22:39 asarch joined #mojo
22:51 good_news_everyone joined #mojo
22:51 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Sa8wZw
22:51 good_news_everyone mojo/master a0f8e0f Sebastian Riedel: simplify build_message logic
22:51 good_news_everyone left #mojo
22:54 good_news_everyone joined #mojo
22:54 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/F_Iyng
22:54 good_news_everyone mojo/master 93560be Sebastian Riedel: documentation tweak
22:54 good_news_everyone left #mojo
23:38 meshl Is there any way to pass "-m production" to my app through Plack::Runner (or what would be a good workaround)?
23:39 tba_ joined #mojo
23:43 meshl OR: is there a way to detect the Plack::Runner -E option from within my mojo app?
23:51 meshl got it: $ENV{PLACK_ENV}

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