Camelia, the Perl 6 bug

IRC log for #mojo, 2013-04-11

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

All times shown according to UTC.

Time Nick Message
00:07 kthakore ... rather 'simple' says this guy ==> sri
00:24 freman hmmm Cursers::UI->do_one_event doesn't return until it gets an event
00:30 sri kthakore: i already have a half finished patch ;p
00:35 sri http://pastie.org/7443366
00:35 sri the only part i'm not sure about it Test::Mojo
00:35 sri ->finished_ok(1009) doesn't look so great
00:35 sri ->status_is() is taken already though :S
00:36 sri ->websocket_status_is() doesn't look so great either
00:37 sri description for finished_ok is inaccurate though
00:38 sri "Wait for WebSocket connection to finish gracefully and check status."
00:38 sri that's better
00:42 cfedde joined #mojo
00:46 cfedde ~.
01:15 sri hmm, i guess i have a full patch now
01:17 good_news_everyone joined #mojo
01:17 good_news_everyone [mojo] kraih pushed 2 new commits to master: http://git.io/4c964A
01:17 good_news_everyone mojo/master 2d14575 Sebastian Riedel: documentation tweaks
01:17 good_news_everyone mojo/master 5dd19f7 Sebastian Riedel: added support for WebSocket status codes (closes #476)
01:17 good_news_everyone left #mojo
01:17 ka2u joined #mojo
01:20 * sri pokes jberger
01:21 sri i've not added reason strings yet
01:23 kthakore jebus
01:24 kthakore sri: I GO AWAY FOR 21:23 - 20:42 and you finish it
01:25 sri i'm not sure if it's the right way to implement it yet
01:30 d4rkie joined #mojo
01:34 good_news_everyone joined #mojo
01:34 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/_1RTYQ
01:34 good_news_everyone mojo/master fbe03ac Sebastian Riedel: fixed small WebSocket test bug
01:34 good_news_everyone left #mojo
01:38 buu Hrm
01:38 buu I'm getting "Can't locate object method "new" via package "SP" at /usr/local/share/perl/5.14.2/Mojo/Server.pm line 23." from t/basic.t
01:38 buu My package is indeed named SP
01:40 buu Needs a use lib 'lib';?
01:53 Averna joined #mojo
02:04 jberger sri++
02:05 jberger seems like a decent way to handle it
02:05 alnewkirk buu: paste
02:05 jberger as to reason strings, dualvar? \m/
02:06 jberger " Endpoints MAY use the following pre-defined status codes when sending a Close frame." -- really? MAY?
02:06 jberger what kind of standard is that?
02:09 good_news_everyone joined #mojo
02:09 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/n5ABqA
02:09 good_news_everyone mojo/master 0772343 Sebastian Riedel: added support for reason strings to Mojo::Transaction::WebSocket
02:09 good_news_everyone left #mojo
02:09 sri jberger: saving bytes on the wire
02:10 sri default is 1005
02:10 sri (if i had to guess, i don't know for sure... could also just be design by comittee madness of course)
02:11 sri RFC 6455 is a pretty good spec if you compare it with others
02:13 jberger yeah, I read it one other time, I'm just thinking that without a defined set of status codes, it seems rather silly to have status codes
02:13 jberger then again, I guess if the endpoint properly defines them somewhere ...
02:13 sri sub-protocols
02:14 jberger isn't that what higher numbers are for :-)
02:14 sri websocket is supposed to be a base protocol
02:14 sri i mean extension specs ;p
02:14 sri negotiating extension protocols is part of the handshake
02:15 sri they can then make their own status codes, extra frame flags, and payload layout
02:16 jberger I see
02:16 jberger do you expect that these dependent protocols will start popping up?
02:16 jberger do any exist?
02:16 * sri just saw the x-webkit-deflate websocket extension the first time
02:16 sri heh
02:17 jberger (besides GalileoSend of course)
02:17 sri or x-webkit-deflate-frame
02:17 * jberger wishes he could spend more time on that
02:17 sri well, for communicating with browsers it's not usable
02:18 sri since you don't get access to the low level api
02:18 sri it's for browser vendors and proprietary clients
02:19 * jberger meant spend more time on GalileoSend
02:19 jberger :-)
02:19 sri jberger: and you're fine with finished_ok?
02:19 jberger seems fine, what problem could you see for it
02:19 jberger I really haven't tested your implementation yet, but it seems sane
02:19 sri no problem, aestethics
02:20 jberger +1 from me
02:21 zivester joined #mojo
02:21 sri \o/
02:21 jberger so just always test for 1000, like testing for 200 for standard http
02:21 jberger ?
02:22 jberger (unless you are testing for specific other cases of course)
02:22 sri 1005 is default
02:22 sri 1000 has to be written
02:23 sri there could also still be timing bugs that make it result in 1006 at times ;p
02:24 sri https://developer.mozilla.org/en-US/docs/W​ebSockets/WebSockets_reference/CloseEvent
02:24 sri mozilla has a good overview
02:24 jberger yeah, I use the Mozilla docs a lot :-)
02:27 gryphon joined #mojo
02:29 cfedde joined #mojo
02:30 asarch joined #mojo
02:32 jberger this might be an easy one: is on finish fired when either the client or server closes the connection?
02:36 sri yes
02:36 cfedde_ joined #mojo
02:36 jberger in Galileo I close the connections on the client side
02:37 jberger so when I test that, I wouldn't test for a close status, since there wouldn't be one
02:37 jberger right
02:37 jberger (I'm just being overly pedantic here)
02:37 good_news_everyone joined #mojo
02:37 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/1UdI-g
02:37 good_news_everyone mojo/master 93179b2 Sebastian Riedel: removed a few deprecated functions and methods
02:37 good_news_everyone left #mojo
02:37 sri yea, no need to be pedantic
02:37 jberger cool
02:37 sri status codes and reasons are more for debugging
02:38 sri so you know mojolicious closed the connection because a message was too big
02:38 jberger oh ok
02:38 jberger that does sound useful
02:39 jberger ok, well good job, as always
02:39 jberger I'm gonna try to get another hour of typing in before bed
02:39 sri \o/
02:46 buu Quick question, where does stderr go when you invoke something via morbo?
02:48 buu I have a Controller that 'warns' some data during loading and I'd like to see it, but when I invoke it via morbo it just says "listening"
02:49 preflex_ joined #mojo
02:52 buu Well, it says "Server available" but yeah
02:56 sri we don't do anything with stderr if we don't have to
02:57 sri those messages would be stdout though
02:59 buu sri: Basically I have package Foo::Controller::Bar; warn "Hi I'm loaded"; use base ...;  and I don't see the message;
03:00 buu (in the morbo output)
03:22 good_news_everyone joined #mojo
03:22 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/qN3Nsg
03:22 good_news_everyone mojo/master 9263835 Sebastian Riedel: fixed small description bug in Test::Mojo
03:22 good_news_everyone left #mojo
03:27 trone_ joined #mojo
03:28 buu Ok I'm confused
03:28 buu Any code outside methods appears to not get executed when the module is loaded?
03:28 d4rkie joined #mojo
03:32 buu I have: package Foo::Bar::Baz; use Mojo::Base 'Mojolicious::Controller'; die "PLEASE WORK";
03:32 buu It dies when I do perl Foo/Bar/Baz.pm
03:35 buu So confused.
03:35 freman meh didn't end up using any part of the curses ui loop, I just call update every tick from mojo, don't need keyboard handling or anything
03:37 buu freman: Help!
03:42 egopro joined #mojo
03:43 sh4 joined #mojo
03:48 buu This insanity I will not stand for!
03:50 buu Ok, if I put a 'die' statement in the 'Main' pm file, then it successfully dies
03:50 buu But if I put it in the controller being loaded, it doesn't die or say anything.
03:50 buu Same with warns.
03:52 buu Ah, the controller isn't actually executed when the app is loaded..
03:52 buu I have to hit an action
03:53 buu Well, that explains a great deal.
03:55 freman mojo is lazy loading by default yes
03:56 rihegher joined #mojo
04:36 Meiermann joined #mojo
04:52 KindTwo joined #mojo
04:57 KindOne joined #mojo
05:03 ka2u joined #mojo
05:18 xaka joined #mojo
05:20 sh4|2 joined #mojo
05:48 basiliscos joined #mojo
06:05 tempire \o\
06:05 tempire _o|
06:05 tempire \o_
06:05 tempire |o_
06:09 Mike-PerlRecruiter_ joined #mojo
06:12 dod joined #mojo
06:13 dod joined #mojo
06:25 dpetrov_ joined #mojo
06:31 ka2u joined #mojo
06:34 mire joined #mojo
06:44 dod joined #mojo
06:45 rem_lex| joined #mojo
06:55 sivoais joined #mojo
06:58 suy joined #mojo
07:03 dod joined #mojo
07:06 Vandal joined #mojo
07:07 rihegher left #mojo
07:22 dotan joined #mojo
07:35 davido joined #mojo
07:41 dod joined #mojo
07:59 jzawodn joined #mojo
08:33 dod joined #mojo
08:42 bc547 is it possible to configure the listen address of a mojo app in the startup method (after reading a config file)?
09:01 dod joined #mojo
09:10 fhelmber_ joined #mojo
09:11 mrphilov joined #mojo
09:15 dexteruk|2 joined #mojo
09:18 nic bc547: Are you using hypnotoad?
09:23 bc547 nic: no.. I know for hypnotoad it is possible
09:24 bc547 nic: but since I use websockets in a way like https://github.com/kraih/mojo/wiki/Writi​ng-websocket-chat-using-Mojolicious-Lite, hypnotoad is not an option afaik
09:25 nic hm, I hadn't heard that.  What are you using?
09:27 bc547 nic: I just start the app with --daemon.
09:28 nic bc547: Have you tried (a recent) hypnotoad?  What are the problems with it?
09:30 bc547 nic: afaik, hypnotoad forks processes... so a 'shared' array of active websockets is not possible. If a client connects on process1, and another on process2, they will not 'see' eachother
09:31 nic If that's the only problem, just configure hypnotoad to have only one child
09:31 nic (I have to confess, I haven't played with any of this yet; other priorities keep overtaking it)
09:31 bc547 then what's the point of using hypnotoad?
09:32 nic hypnotoad is most easily configurable for production, eg the address configuration you were asking about
09:32 nic bc547: Is setting the address on the commandline no use to you?
09:33 dod joined #mojo
09:33 bc547 nic: I would prefer a config file to keep all settings of the application together
09:33 nic well it sounds like taking advantage of hypnotoad's startup sequence is your easiest path
09:34 nic (but not the only path of course)
09:34 nic You could write your own 'start' script which reads a config file and then exec's your real process with the appropriate commandline args
09:36 bc547 nic: also true... there are other options. But none of them would be so 'clean' i think :-)
09:45 denisboyun joined #mojo
10:10 psimanx1 bc547: best way to handle multiple websockets across multiple processes would be to use something like Redis and pub/sub - pretty easy.
10:28 ver joined #mojo
10:36 fhelmber_ joined #mojo
10:40 Britzel_ joined #mojo
10:57 arthas joined #mojo
11:16 bowtie joined #mojo
11:17 maxhq joined #mojo
11:22 ryozi joined #mojo
11:27 bowtie joined #mojo
11:33 bc547 psimanx1: nice.. didn't know about pub/sub. However, in this case, the application runs on a router and must have as few dependencies as possible.
11:33 psimanx1 ahh no probs.
11:34 mire joined #mojo
12:09 dod joined #mojo
12:29 ruz joined #mojo
12:37 jpn joined #mojo
12:47 d4rkie joined #mojo
12:55 _s_l_a_c_k joined #mojo
12:56 _s_l_a_c_k greetings friends...mojolicious noob here looking for help on the best way to store, say, an array using session().  Any takers?
12:59 chinaXing joined #mojo
13:05 chinaXing how to use Mojo::UserAgent do such a post
13:06 chinaXing curl -d "hello" http://a.com/p/
13:06 chinaXing data is form-url-encoded, but the data not a key=value data, just a pice of data
13:06 chinaXing like hello
13:08 _s_l_a_c_k something like this maybe?  http://mojolicio.us/perldoc/Mojolicio​us/Guides/Cookbook#Large_file_upload
13:12 _s_l_a_c_k seems like that would do what you want, chinaX, even if your file is small
13:14 _s_l_a_c_k ok, bye for now...
13:17 chinaXing oh, my post data is not image, this method will post a form-data content-type , not form-data-url-encoded
13:25 bluescreen joined #mojo
13:26 sri /o/
13:27 sri |o_
13:27 sri _o/
13:27 sri _o|
13:29 * Mikey parks the plane to the left, gets out, and takes off his helmet.
13:33 sri \o/
13:34 denisboyun joined #mojo
13:39 bluescreen_ joined #mojo
13:48 marty moin
13:48 sri moin
13:50 dod joined #mojo
13:51 sh4 joined #mojo
13:52 bc547 is it possible to configure the listen address of a mojo app in the startup method (after reading a config file)?
13:53 sri a "mojo app" has no listen port
13:53 sri s/port/address/
13:54 sri for all you know responses are served via snail mail ;p
13:54 mire joined #mojo
14:02 bc547 sri: but for hypnotoad it is possible
14:02 shmuel joined #mojo
14:02 sri hypnotoad is a specific server
14:04 sri configuration through the application is a feature of hypnotoad, not the application
14:04 Vandal cuz all hails it?
14:04 sri ALL GLORY TO THE HYPNOTOAD!
14:04 Vandal !!!
14:04 dod joined #mojo
14:05 moltar joined #mojo
14:21 good_news_everyone joined #mojo
14:21 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/xFcOew
14:21 good_news_everyone mojo/master 7b806e9 Sebastian Riedel: better Mojo::UserAgent example for tutorial
14:21 good_news_everyone left #mojo
14:21 bc547 sri: so the only option would be to parse the config before the Mojolicious::Commands->start_app() line and use the host/port parameters as argument to start_app? (I cannot use hypnotoad since I use a 'chat'-like websocket plugin and cannot use redis to exchange messages between processes)
14:24 sri there's a million ways
14:24 sri none is "the right one" though
14:25 bc547 sri: :-(
14:31 sh3 joined #mojo
14:37 gryphon joined #mojo
14:43 Mikey my app fork()s during startup(), even
14:43 Mikey after creating a FIFO and stuff
14:44 Mikey it's my zmq publisher
14:45 Mikey i've taken huge trending topics from twitter and pointed them at my mojo app and i haven't been able to get it to use more than 10% cpu on the app server, it's even rendering every message from a template every time
14:45 Mikey this is with 20+ clients watching
14:45 Mikey can't get postgres to use even 2% cpu
14:46 Mikey it's a next generation academic portal about to be deployed at a university with 35k students
14:46 Mikey based around a twitter clone / message bus.  100% mojolicious, zmq, postgres, backbone.js
14:46 sri bc547: if you want something that behaves like hypnotoad, then make a Mojo::Server::Daemon script that does exactly that
14:47 labrown joined #mojo
14:47 sri it's not magic, all the apis used are public
14:47 Mikey *nod* there are lots of goodies at all levels of the mojo stack
14:48 sri Mikey: neat
14:48 Mikey i demo to the cio next tues.
14:51 bc547 sri: tnx.. i'll look into that
15:07 kbenson joined #mojo
15:27 rihegher joined #mojo
15:32 Zx3 joined #mojo
15:34 rihegher left #mojo
15:35 chinaXing left #mojo
15:42 rihegher joined #mojo
15:42 rihegher left #mojo
16:00 D4RK-PH0ENiX joined #mojo
16:08 xaka joined #mojo
16:16 xaka joined #mojo
16:19 kthakore 1/win 2
16:26 mire joined #mojo
16:42 njlg joined #mojo
16:45 fildon joined #mojo
16:47 sri oh, tpf is not on the list of accepted organizations for gsoc 2013 :(
17:00 njlg i wonder why that is
17:14 sri a) tpf was rejected b) nobody had time to apply
17:21 inokenty joined #mojo
17:30 njlg Perl GSOC has a facebook page! (https://www.facebook.com/perlgsoc) Last updated: 2012-03-05 =)
17:57 ruz joined #mojo
18:05 sh3 joined #mojo
18:09 Mike-PerlRecruiter_ joined #mojo
18:14 mire joined #mojo
18:46 jpn joined #mojo
18:50 d4rkie joined #mojo
18:59 nelio joined #mojo
19:06 good_news_everyone joined #mojo
19:06 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/68htFw
19:06 good_news_everyone mojo/master f21bf45 Sebastian Riedel: fixed message size limit bug in Mojo::Transaction::WebSocket
19:06 good_news_everyone left #mojo
19:07 suy joined #mojo
19:08 sri fun test case https://github.com/kraih/mojo/commit/f21bf​459a481645be2a28a11e4c810e43aad4015#L2R144
19:08 sri love that we can test this stuff so easily
19:20 good_news_everyone joined #mojo
19:20 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Y6ZtbQ
19:20 good_news_everyone mojo/master feb2769 Sebastian Riedel: test tweaks
19:20 good_news_everyone left #mojo
19:24 dvinciguerra joined #mojo
19:30 basiliscos joined #mojo
19:44 gryphon joined #mojo
20:02 kthakore hello
20:05 kthakore sri:  is tehre a way to have Mojo::JSON include for(;;); or while(1); in front of encoded arrays so as to prevent JSON injection attack? I am using this right now  sub { my $in = shift;  my $j = j( $in); $j = 'for(;;); ' . $j if ref $in eq 'ARRAY'; return $j; }
20:05 kthakore I just wanted to refactor it out
20:06 buu How does that prevent.. anything?
20:07 kthakore the issue is with people accessing your .json array using the <script> tage
20:07 kthakore the for(;;); goes into an infinite loop;
20:07 kthakore see this
20:08 kthakore http://haacked.com/archive/2008/11/20/ana​tomy-of-a-subtle-json-vulnerability.aspx
20:08 kthakore we have had people try this on our application (not malicious, just hospital IT aware of the issue)
20:09 kthakore I am also adding CRSF token (as soon as I fuckin learn how to do it)
20:20 buu zounds.
20:24 Zx3 joined #mojo
20:26 kthakore buu: zouns?
20:27 buu ZOUNDS AND GADZOOKS.
20:28 kthakore i don't follow. MEans good exclaimation or bad excliam or ... wtf?
20:29 buu It's an expression of surprise.
20:30 kthakore I got that ... but why are you suprised?
20:32 good_news_everyone joined #mojo
20:32 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/-xI5fg
20:32 good_news_everyone mojo/master 375b9f0 Sebastian Riedel: better reason examples
20:32 good_news_everyone left #mojo
20:39 jpn joined #mojo
21:04 basiliscos joined #mojo
21:16 sri i guess one thing we could do in 4.0 is to change the default secret to use the application moniker instead of the class
21:16 perlite_ joined #mojo
21:19 powerman1 joined #mojo
21:21 powerman1 hi. most js template engines uses same <%…%> delimiters. if I change tag_start/tag_end for EPRenderer this resolve conflict for my own templates, but what about mojo's default very nice 404 page?
21:23 powerman1 I can copy default templates into my app's dir and change delimiters. But this should be done again and again after each mojo upgrade. :(
21:23 powerman1 Is there better way to handle this?
21:33 njlg you don't /need/ to change your exception / not_found templates after each upgrade
21:35 powerman1 njlg: what if that upgrade contain updated templates with even more nice features? :)
21:36 njlg well, then find-and-replace is your friend =)
21:36 * sri doesn't understand why you would extract the built in templates at all
21:36 powerman1 sri: because they stop working after changing tag_start/end
21:36 sri then you're doing it wrong
21:37 sri http://mojolicio.us/perldoc/Mojolicious/Guid​es/Rendering#Customizing_the_template_syntax
21:38 powerman1 sri: yeah, that's what I did, except I didn't set 'name'. hmm. so, if I'll set 'name' and rename all my templates from *.ep to *.something everything should work
21:39 powerman1 make sense, thanks
21:39 sri don't ever change the ep syntax, use new names
21:39 sri it breaks all the built in stuff and templates shipping with plugins
21:43 sri btw
21:43 * sri would still like feedback for monotonic clock support, if anyone has been playing with it
21:49 powerman1 sri: I've used monotonic clock in my own epoll-based event loop before EV was released
21:49 cfedde joined #mojo
21:50 powerman1 at that time Time::HiRes doesn't support them, so I've to use Inline and syscall()
21:50 sri mojolicious supports it since 3.92, i'd like to hear if it works well for folks
21:50 powerman1 but nowadays this is handled by EV, so what's the point with playing with it?
21:51 cfedde Is there a way to change the logging level of a running hypnotoad?
21:51 powerman1 cfedde: $app->log->level('info') in startup()?
21:51 powerman1 or use env var. MOJO_LOG_LEVEL, if I remember correctly
21:52 cfedde will that catch with a kill --USR2 restart?
21:52 cfedde me goes to try
21:52 sri USR2 is already in use by hypnotoad
21:53 sri oh, you mean a restart
21:53 sri USR2 is a full fork/exec restart, you can upgrade perl wit it, so pretty much *everything* catches
21:53 cfedde of course it works...
21:55 cfedde apparently that U
21:55 cfedde apparently that USR2 restart is not built into hypnotoad.
21:55 sri of course it is
21:56 cfedde um. as a command like --stop
21:56 cfedde yes of course it understands USR2
21:57 cfedde not that kill -USR2 ... is all that tough.
21:58 sri http://mojolicio.us/perldoc/Mojol​icious/Guides/Cookbook#Hypnotoad
22:09 BeDa joined #mojo
22:30 kthakore powerman1: I also use javascript templates (underscore specifically) ... move your templates out of the source for *.html.*ep
22:30 kthakore err
22:30 kthakore *.html.ep
22:30 kthakore you can load templates with a $.get( ) call
22:31 kthakore or better is to store templates into a .js file with a hash and minify it.
22:31 kthakore then load normally using script
22:32 kthakore caching on most new browser will make it load fast for subscquent uses
22:34 powerman1 kthakore: I prefer to keep this way in mind as option for now. It's good to have a choice, possibility to keep js templates in .html.ep (or .html.tmpl) may be useful.
22:35 KindTwo joined #mojo
22:38 kthakore powerman1: totally agree with you. What js templating library are you using?
22:39 kthakore you can change the format for underscore settings
22:40 powerman1 my own. also can change delimiters, but keeping in mind how many js template engines uses the same, I decide to change mojo's delimiters. should win in long run.
22:43 kthakore ah ok
22:43 hesperaux joined #mojo
22:43 kthakore but the way I think about it, different languages should be on seperate files.
22:45 powerman1 kthakore: I tend to agree. But I'm thinking about possibility to render complex js templates on server.
22:46 powerman1 Not sure is it good idea, but it'll require js templates inside .html.ep
22:47 powerman1 I mean, render templates of js templates to normal js templates. :)
22:47 cfedde combining jQuery and underscore for client side templates has worked pretty well for me.  In that mode my server side pretty much just sprays json at the client.
22:48 cfedde though it's a bit of a brain twister to decide what goes in which VMC layer.
22:50 cfedde MVC even.
22:50 powerman1 btw, I found very useful to inject initial data generated by perl into javascript's var, like:
22:50 powerman1 var somedata = <%== encode_js_data $hashref %>;
22:51 cfedde I tend to do that with an ajax call to an end point.
22:51 powerman1 need custom helper to encode/escape, of course
23:04 good_news_everyone joined #mojo
23:04 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/1V5F0A
23:04 good_news_everyone mojo/master 506c99a Sebastian Riedel: better frame examples
23:04 good_news_everyone left #mojo
23:17 hrupp_ joined #mojo
23:36 rem_lex|pivo joined #mojo
23:40 rem_lex|pivo joined #mojo
23:56 good_news_everyone joined #mojo
23:56 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/q5QTjA
23:56 good_news_everyone mojo/master 1b966c6 Sebastian Riedel: more WebSocket tests
23:56 good_news_everyone left #mojo

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