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

IRC log for #mojo, 2015-10-15

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

All times shown according to UTC.

Time Nick Message
00:00 asarch joined #mojo
00:00 jontaylor joined #mojo
00:00 sri do you have a javascript library that takes care of the id handling?
00:01 batman yes. but it's not yet bundled, since i'm testing it with convos
00:01 batman https://github.com/Nordaaker/convos/blob/batcode/assets/js/swagger2-client.js
00:01 sri it's request/response, mapped onto websockets, as far as i'm concerned it's a worse version of REST
00:01 sri because you don't get all the benefits of caching and the like
00:02 sri you even use http codes
00:02 batman that's the nice part: you don't have to use it if you want caching.
00:03 batman but for things like convos, you don't care about caching
00:04 sri fwiw, in the working group the WAMP subprotocol gets a lot of support
00:04 sri for this kinda stuff
00:04 sri https://github.com/wamp-proto/wamp-proto/blob/master/rfc/draft-oberstet-hybi-tavendo-wamp.txt
00:06 batman cool. need to look at it tomorrow
00:06 batman ..or later today :P
00:06 * batman need to get some Zzzz
00:07 sri nn
00:07 batman http://cdn.meme.am/instances/64690575.jpg
00:07 batman :)
00:52 d4rkie joined #mojo
01:05 genio Mojolicious::Lite makes mocking web servers so nice.  I miss it in projects not using mojo. :/
01:14 zivester joined #mojo
01:21 aborazmeh joined #mojo
01:34 Zoffix sri, interesting observation. I sense contemptuous attitude from Perl 5 folks towards Perl 6. :) Especially on Twitter.
01:35 Zoffix But if you mean RabidGravy's attitude, I wouldn't pay too much attention; they never coded Perl 5 and seem to feel some hostility toward the "strangers from P5 land" :)
01:43 sri Zoffix: it's an interesting dynamic
01:45 sri say those folks get a little too loud, i can see it turn away quite a few p5 folks
01:50 sri i guess polarizing is much better than nobody caring
01:57 sri Zoffix: are you actually using perl6?
01:57 sri would be interesting to see a performance comparison for a small web app
01:58 sri like a small crust app vs a small plack app
01:58 sri i've installed perl6 with homebrew... but panda seems not to work well, so i can't install stuff yet
01:59 Zoffix sri, not for anything that isn't "hobby"; I wrote https://github.com/zoffixznet/perl6-App-Nopaste and the two modules that support it, but that's it.
01:59 Zoffix I do think I'm in love with the language though.
02:00 Zoffix If only it weren't dog slow and not available on any real system :)
02:01 Zoffix This is beauty to me: https://github.com/zoffixznet/perl6-Pastebin-Gist/blob/master/lib/Pastebin/Gist.pm6
02:03 Zoffix I'm waiting for 2016 releases to make any real "performance", real-world comparisons
02:13 inokenty-w joined #mojo
02:17 noganex joined #mojo
02:17 sri Zoffix: give me some numbers!
02:18 sri the crust server is supposed to be a clone of starlet, so a direct comparison should be possible
02:21 sri just a "wrk -c 100 -d 10s" against a hello world :)
02:24 Zoffix I can't really.
02:24 Zoffix $ time perl6 -MInline::Perl5 -e 'use Mojo::DOM:from<Perl5>; say Mojo::DOM.new("<foo>bar</foo>").all_text'
02:24 Zoffix bar
02:24 Zoffix real0m4.049s
02:25 sri that doesn't say much, i imagine data conversions are pretty expensive
02:25 Zoffix But apparently it's something to do with `panda` not precompiling installed modules. Which is fine, but that makes me think.... what if I have a project that has an X amount of modules in it... do I gotta precompile it to get any real speed....
02:26 Zoffix $ time perl6 -MInline::Perl5 -e ''
02:26 Zoffix real0m3.365s
02:26 * Zoffix gpoes to bed
02:32 zivester joined #mojo
02:35 sri Zoffix: i don't care about startup time too much
02:35 sri what interests me is a direct comparison with a simple server
02:36 sri things like overall performance, and the latency cost of gc pauses
02:36 zivester joined #mojo
02:40 D4RK-PH0ENiX joined #mojo
03:01 melo1 joined #mojo
03:41 d4rkie joined #mojo
03:50 jberger sri: that wamp looks interesting
03:51 jberger I thought the gc ran in its own thread? Maybe I don't know what that means but I thought it was supposed to cut down on the pauses
04:35 arpadszasz joined #mojo
04:42 d4rkie joined #mojo
05:43 d4rkie joined #mojo
06:30 McA joined #mojo
06:40 davido_ joined #mojo
06:56 trone joined #mojo
07:00 panshin joined #mojo
07:14 eseyman joined #mojo
07:24 sugar joined #mojo
07:31 d4rkie joined #mojo
07:33 AndrewIsh joined #mojo
07:36 stephen joined #mojo
07:47 arthas joined #mojo
07:53 sugar_ joined #mojo
08:04 cpan_mojo App-docsisious-0.03 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/App-docsisious-0.03
08:07 batman sri: i don't see the big difference between my swagger websocket thing and wamp :/
08:08 batman it could be, because i don't simply restrict swagger spec to be for RESTful interfaces.
08:09 batman probably because most RESTful interfaces aren't really 100% restful :)
08:16 Vandal joined #mojo
08:19 ashimema wamp looks interesting
08:26 panshin joined #mojo
08:34 berov joined #mojo
08:40 jberger joined #mojo
08:45 henq joined #mojo
08:58 henq joined #mojo
09:08 henq joined #mojo
09:16 henq joined #mojo
09:20 d4rkie joined #mojo
09:22 ashimema I still need to investigate the swagger websocket stuff batman..
09:22 batman yeah. looking forward to feedback
09:22 ashimema but my gut feeling it that the swagger documentation specification isn't really all that good for websockets (or webhooks) yet.
09:23 ashimema I'd love to create an 'extended' swagger where I could specify not just restful paths but websocket 'channels' and webhook resources
09:24 ashimema but that's for another conversation.. likely not here ;)
09:24 ashimema I'll tkae a look in detail at your stuff soon thouhg.. promise :)
09:25 batman that would probably be wamp then.
09:25 henq joined #mojo
09:28 * ashimema also needs to read rather than skim wamp ;)
09:33 gaunt joined #mojo
09:39 sri batman: the point is that wamp is on its way to becoming an rfc by the working group that made websockets
09:45 meshl joined #mojo
09:49 panshin joined #mojo
09:53 batman sri: yeah, that's cool
09:53 batman what i like about my (hackish) solution is that i only need to write the spec and code once.
09:53 batman i'm so old fashion, that i want a fallback solution when the client doesn't support ws :/
09:55 batman unrelated... does a browser look at expire, when you're in an "active" window?
09:55 sri argh... another signal issue https://github.com/kraih/minion/issues/15#issuecomment-148294506
09:55 batman like if the cookie has expire five minutes in the future, but you keep the page open for 30 minutes will the cookie still be sent?
09:55 sri but this time it seems unfixable
09:56 batman sri: yeah. i think i need to install Minion to look at it :/
09:56 batman just don't have time atm
09:56 nic batman: My impression is chrome only checks if you go away from the tab and then return to it
09:57 batman nic: right. my impression is that it's the same way in ie and ff as well... just wasn't quite sure
09:59 Shtong joined #mojo
10:01 Shtong hey people; I'm a complete newbie to Mojolicious, and I didn't find in the docs a way to escapt JS strings in a templates (to secure stuff like var sommthing = "<%= $somevar %>"). Is there any existing helper I'm missing ?
10:01 Shtong escape*
10:02 Shtong bleh, and sorry for all the typos; it seems I'm not fully awake yet -_-
10:03 batman sri: why is it unfixable?
10:05 nic Shtong: Do you mean you're passing a perl expression ($somevar) to js?
10:06 nic Is it just you're having trouble including the value of a perl expression in a template (ie the js bit is irrelevant)?
10:07 Shtong I'm not having trouble including the value in the template
10:08 Shtong what I need is a way to escape the value (in other words replacing all " by \" for example)
10:08 Shtong to avoid javascript injection in my page
10:15 jontaylor joined #mojo
10:19 asarch joined #mojo
10:20 Zoffix Shtong, none that I know of, but you can make your own helper:  use JavaScript::Value::Escape; ... $c->helper( js_escape => sub { javascript_value_escape $_[1]; } );  ... then in your template you'd just use    js_escape 'your evil JS!'
10:20 Zoffix (I'm only assume that's the module you want; I never used it myself)
10:20 Zoffix s/e/ing/;
10:34 sri batman: because i need to revert the SIGCHLD change
10:40 sri and done https://github.com/kraih/minion/commit/e60201f255ea5a45a9f431c888535b4bd9603db0
10:40 sri batman: if you have a better idea, proposals are welcome
10:40 cpan_mojo Minion-2.05 by SRI https://metacpan.org/release/SRI/Minion-2.05
10:46 sri i have no idea what's going on, since nothing appears to mess with SIGCHLD, but the problem vanishes if put it back
10:47 sri hmm, perhaps EV messes with the signal when it is loaded
10:47 sri oh, i think i get it
10:48 sri EV takes over SIGCHLD when it is loaded, and reaps children, so our waitpid call never actually sees spawned processes stopping
10:49 sri unless we reset SIGCHLD
10:49 sri something like that has to be going on
10:59 sri my attempt at explaining the probelm https://github.com/kraih/minion/issues/15#issuecomment-148351609
11:00 sri batman: don't you have the same problem with the prefork server?
11:01 sri it also takes changes the CHLD signal
11:01 sri s/takes//
11:02 dvinciguerra joined #mojo
11:02 sri https://metacpan.org/pod/EV#PERL-SIGNALS
11:02 sri looks like this might be a bug
11:02 sri not that i would dare reporting it ;p
11:08 d4rkie joined #mojo
11:09 jberger Zoffix / Shtong: yes that's what you want. I use it for phantom
11:13 batman sri: sorry. $work messed up my day :(
11:14 * batman will have a look now
11:14 neilhwatson joined #mojo
11:24 Shtong alright thanks, i'll have a try with that
11:28 MartinR joined #mojo
11:31 sri batman: nice test case
11:31 batman http://www.ohmz.net/wp-content/uploads/HLIC/b2a55b684fd1864453364c24e05c3ae8.png
11:32 sri Oo
11:32 batman :D
11:32 marcusr o^O
11:34 sri batman: doesn't work for testing EV though
11:35 sri and i'm almost certain you should have the same problem with the prefork server
11:35 batman sri: guess i have to clone minion now :)
11:35 sri btw. it seems to not be 100% consistently failing, some jobs get finsihed and some don't
11:35 sri so it's most likely a race condition
11:39 batman sri: why isn't there any .perltidy in minion.git?
11:41 sri ok, i think i have another solution
11:42 sri i could handle waitpid returning -1 gracefully
11:42 sri guess that's bad too
11:43 sri hmm
11:43 sri since failed jobs could get lost
11:43 sri yea, it's bad
11:44 sri batman: i don't see how Mojo::Reactor::child would change anything
11:44 batman no, i think you're right :(
11:44 sri EV steals our exit status or EV doesn't work
11:45 sri (EV::child)
11:45 batman pretty sure it's the first
11:45 sri it's both
11:46 sri process management works or EV::child works, you can only have one
11:46 sri minion doesn't even use an event loop
11:47 sri you see, this is why i try to avoid signal handlers in Mojo::Reactor :)
11:47 batman hehe
11:47 sri it's a mess
11:48 nic What's a typical performance improvement by using EV (vs not using it)?
11:48 sri there is little performance gain these days
11:48 sri it's about scalability
11:49 sri we get epoll/kqueue through EV
11:49 nic ahh
11:49 marcusr in convos cpu spikes pretty quickly without ev
11:49 sri Mojo::Reactor::Poll has been pretty heavily optimized recently
11:50 sri but yea, scalability
11:50 sri once you have 100+ connections you need EV
11:59 irqq joined #mojo
12:02 elik joined #mojo
12:04 panshin joined #mojo
12:04 Shtong Zoffix: I'm having errors with this javascript escape module, do I have to install it separately?
12:05 nic yes
12:05 Shtong k thanks
12:05 nic it's a general module from cpan
12:05 sri batman: correct solution should be for EV to only watch signals if it has been asked to do so
12:06 nic Is it time for someone(TM) to look after a fork of EV?
12:06 batman sri: isn't that what's happening? i thought it only happened if EV::child() was called
12:06 sri your test case does not trigger the problem though, so there might be another variable in play
12:07 sri nope, the problem appears with a vanilla minion setup too
12:07 sri perl -Ilib -Mojo -E 'plugin minion => {Pg => "postgresql://tester:testing@/test"}; app->minion->add_task(foo => sub { sleep 3; say "FOO" }); app->start' minion worker
12:07 sri something as simple as that
12:08 batman why haven't this been discovered before?
12:08 batman before = until now
12:08 sri because nobody runs EV::child in minion jobs i imagine
12:09 batman sorry. i'm confused. why did you say "nope" then?
12:09 sri it has been discovered before... otherwise "local $ENV{CHLD} = 'DEFAULT';" wouldn't be in minion ;p
12:10 sri i don't understand
12:10 sri now you've confused me
12:10 batman one moment...
12:11 batman sri: this is how i read the backlog: https://ssl.thorsen.pm/paste/2c8a73324bea
12:12 sri yes
12:12 sri i mean no
12:12 sri (did not see the comment)
12:12 batman haha! yeah, now i understand eeeeeeeeverything ;)
12:12 sri you said that EV only watches signals if EV::child has been called
12:13 batman yes
12:13 sri that cannot be the case
12:13 sri because the problem appears in vanilla minion setus without "local $SIG{CHLD} = 'DEFAULT'"
12:13 sri +p
12:14 batman oh. right
12:14 sri setups where EV was never even started
12:14 batman batman$minus$minus
12:14 batman thanks
12:14 sri just loaded and left alone
12:15 sri guess it would be nice if we could make EV opt-in
12:15 sri would be a big breaking change though
12:16 batman sri: i'm wasting $work time and trying to make the test work... i hope you don't do anything drastic until i give up :)
12:17 sri no plans for anything
12:18 batman cool
12:31 MartinR %= stylesheet 'style.css' in lite app should work just like in full app right ?
12:32 MartinR I get either not_found or "Not allowed to load local resource" when I add absolute path
12:36 MartinR inlined works ok but it would be very much better to have it separated, even if it is lite app
12:37 nic MartinR: check app->home->rel_dir('public') is readable by the user running app
12:38 nic MartinR: Is 'stylesheet' a function/helper?
12:39 MartinR nic, stylesheet is just .css file which should be inluded like <link rel="stylesheet" href="style.css"> in html
12:39 MartinR looks like public dir helped
12:40 MartinR thanks ;)
12:41 nic MartinR: Have you gone through the tutorial or are you dipping in here & there?
12:42 meshl joined #mojo
12:43 MartinR I read it yes
12:44 mattastrophe joined #mojo
12:49 nic I'm just thinking you're asking a lot of questions that you shouldn't be stuck with if you've read the guides
12:54 ashimema I'm use Mojo::JSON::MaybeXS.. any hints on how to work out why JSON::XS is being used in preference to Cpanel::JSON::XS?
12:54 ashimema Sure I'm being bitten by: 'This module first checks to see if either Cpanel::JSON::XS or JSON::XS is already loaded, in which case it uses that module.'
12:54 ashimema but I have not idea how to work out whats loading JSON::XS first :(
12:55 jberger ashimema: just load Cpanel::JSON::XS before you load the Mojo module
12:55 ashimema and how would I go about that?
12:55 ashimema sorry.. I'm feeling very dumb today :(
12:56 ashimema what trigger the load
12:56 d4rkie joined #mojo
12:56 jberger ashimema: use
12:57 jberger perldoc -f use :-P
12:58 ashimema https://ssl.thorsen.pm/paste/d98bcd9edc8a
12:58 ashimema well.. that's currently the very top of my main app file
12:58 ashimema or would you load it in the script?
13:01 jberger that should be enough I would think
13:09 ashimema maybe I'm misreading this then..
13:10 ashimema I'm dumping out a structure from one of my controllers.. and it's yielding
13:10 ashimema JSON::XS::Boolean
13:10 ashimema hense my belief that I'm still somehow loading the wrong module somehow
13:12 ajr_ joined #mojo
13:21 batman sri: is there a way to stop Minion::Command::minion::worker, without SIGTERM?
13:25 nic ashimema: Try it on a non-bool
13:26 ashimema try what?
13:26 ashimema dumping out the structure.. ?
13:29 * ashimema keeps digging.. think it's further down the tree that things are getting wild somewhere
13:31 nic I'm just wondering if your scenario is specific to bools
13:32 jberger Grinnz: ping ^^
13:32 ashimema the bools are the eventual bug
13:32 ashimema I'm just trying to rule in or out some Mojo Plugins before continueing
13:33 ashimema basically.. my render to json it spitting out quoted strings instead of proper json booleana true and false
13:33 ashimema could be the swagger plugin
13:33 ashimema could by the json validation within it..
13:34 ashimema or could be my json bools in the controller to start with
13:34 ashimema hense my now idgging
13:34 ashimema digging
13:36 CandyAngel idgging? Is that when you try to cheat in Doom but can't remember the code?
13:43 ashimema haha
14:00 cpan_mojo Mojo-Webqq-1.5.7 by SJDY https://metacpan.org/release/SJDY/Mojo-Webqq-1.5.7
14:08 Grinnz ashimema, where are you using that package from?
14:08 Grinnz Mojo::JSON::MaybeXS must be loaded before anything which may load Mojolicious modules
14:08 ashimema Mojo::JSON::MaybeXS is right at the top of my main app file before startup etc
14:09 Grinnz and how are you running that app?
14:10 ashimema it's a mojo full app
14:10 ashimema so under morbo using the script
14:11 Grinnz note the example in the synopsis
14:11 ashimema which just run mojolicious::commands->start_app
14:11 ashimema the 'Preload for scripts'
14:12 ashimema that bit?
14:12 nic grrr.  thought I could use ip.jsontest.com for my json unit testing, but it's....   somewhat unreliable
14:13 Grinnz yes, morbo loads several parts of Mojolicious before the app is started
14:13 ashimema ah..
14:13 * ashimema has a light bulb moment!
14:13 ashimema I didn't understand that
14:13 ashimema thanks Grinnz!
14:14 ashimema and now it all works!
14:14 Grinnz \o/
14:15 * ashimema is feeling somewhat dim now :(
14:15 ashimema it's right there in th docs!
14:16 Grinnz fwiw, at work I use a custom script to start morbo and hypnotoad, and load Mojo::JSON::MaybeXS at the top
14:16 Grinnz (the included morbo/hypnotoad scripts are pretty simple)
14:17 ashimema i see
14:17 ashimema aim is to use toadfarm for production
14:18 henq joined #mojo
14:18 ashimema assume the env variable version is right for that case
14:18 Grinnz that's the simplest way yeah
14:18 ashimema cheers
14:19 * ashimema goes off to document that in big scary CAPITALS in the install documents here ;)
14:19 sri PERL5OPT=-MMojo::JSON::MaybeXS
14:19 sri we've talked about that before
14:21 meshl joined #mojo
14:21 sri or even perl -MMojo::JSON::MaybeXS `which morbo` script/myapp
14:21 cpan_mojo Mojo-IOLoop-ReadWriteFork-0.14 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-IOLoop-ReadWriteFork-0.14
14:22 Grinnz those are the synopsis examples now ;)
14:22 batman sri: ^^ you're welcome to release Minion with the reverted commit
14:22 gryphon joined #mojo
14:22 sri batman: i've done that 3 hours ago
14:23 batman oh. cool :)
14:23 sri so, did it affect the prefork daemon too?
14:24 sri because https://github.com/kraih/mojo/blob/master/lib/Mojo/Server/Prefork.pm#L157
14:25 batman i would assume so. didn't write a test for it though. pretty happy with the minion test i bundled.
14:25 sri oh, a minion specific test... that is interesting
14:26 sri ohoh, it is using the method that is most likely to change -.-
14:26 sri list_jobs is almost certain to change
14:27 sri do "my $id = app->minion->enqueue('rwf');"
14:27 batman haha. that's why i wanted feedback :)
14:27 batman aha. awesome
14:27 sri and then "my $job = app->minion->job($id);"
14:28 sri then just call $job->info to get the latest status
14:30 batman is $job->info->{result}, 42, 'exit_code from child'; ?
14:30 * sri nods
14:33 batman https://github.com/jhthorsen/mojo-ioloop-readwritefork/blob/master/t/minion.t#L32 <-- hope this makes more sense
14:34 sri i don't think you actually need an alarm for stopping
14:34 * batman has entered the minion land..
14:34 batman where will it end?
14:34 sri hooking into app->minion should work too
14:34 batman i don't know how to do that :(
14:35 batman care to elaborate ?
14:35 sri app->minion->on(worker => sub { shift->on(dequeue => sub { pop->on(finished => sub { kill 'TERM', $$ }) })  });
14:35 sri something like that
14:36 batman ah! sweet!
14:36 sri actually, replace $$ with $pid
14:36 sri you might be in the job process
14:37 sri and the shift should be a pop
14:39 batman it takes some time to run the test: about two seconds
14:40 batman maybe because of this in worker.pm? (($self->{max} <= keys %$jobs) || $self->{finished}) { sleep 1 }
14:40 sri likely
14:41 sri it also sleeps a little in ->dequeue with the file backend
14:42 sri up to 5 seconds actually
14:43 sri which i guess you can avoid with ->run(-j => 1)
14:43 batman works like a charm now :) https://github.com/jhthorsen/mojo-ioloop-readwritefork/blob/master/t/minion.t
14:43 sri \o/
14:44 batman thank you!
14:44 * batman hopes travis agree
14:44 d4rkie joined #mojo
14:50 batman boom!
14:52 cpan_mojo Mojo-IOLoop-ReadWriteFork-0.15 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-IOLoop-ReadWriteFork-0.15
15:07 panshin joined #mojo
15:07 d4rkie joined #mojo
15:32 sh4 joined #mojo
16:05 arthas_ joined #mojo
16:22 btyler_ hey sri - I just installed Crust without any significant trouble on HEAD of the various things, so it might just be that the homebrew rakudo is a bit creaky. the one test that failed was http-useragent hitting purl.org, which appears to be dead.
16:22 btyler_ anyways, happy to run some side by side benchmarks
16:28 sri btyler_: you have wrk?
16:31 sri plackup -s Starlet -p 8080 -e 'sub { [200, [], ["Hello World!"]] }'
16:31 sri wrk -c 100 -d 10s http://127.0.0.1:8080
16:31 sri that's the perl5 test
16:32 sri crustup -p 8080 -e '-> $env { 200, [], ["Hello World!"] }'
16:32 sri wrk -c 100 -d 10s http://127.0.0.1:8080
16:32 sri and that should be the perl6 test
16:38 btyler_ moment, crustup doesn't understand -p apparently
16:38 cpan_mojo App-docsisious-0.04 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/App-docsisious-0.04
16:40 PryMar56 joined #mojo
16:46 MartinR joined #mojo
16:48 MartinR What books are recommend for javascript ? But not from abc, rather intermediate level
16:49 sri btyler_: ok, then change the ports :)
16:50 btyler_ sri: sorry, yeah, got pulled into a conversation. starlet was ~1200 req/second and 190KB/sec
16:51 sri you could also look at the memory usage of the server
16:51 sri might be interesting
16:53 btyler_ hmm, something is getting wedged, wrk doesn't get any answers
16:53 btyler_ on crust
16:53 sri oh
16:53 sri and a browser does?
16:53 btyler_ when I was doing this with HTTP::Server::Async a few months ago, it could manage ~200 req/second
16:54 sri that is pretty poor
16:54 btyler_ sure
16:55 btyler_ ok, something is unhappy concurrency-wise
16:55 btyler_ if I reduce wrk to 1 connection/1 thread, it does ~75 req / second
16:55 sri the plackup test results in 1350rps on my box... so that would be 250 rps here i imagine
16:55 sri btyler_: oh my
16:56 btyler_ same thing on starlet is around 740 req/ second
16:56 btyler_ 1 connection/1 thread from work
16:56 btyler_ *wrl
16:56 btyler_ *wrk!
16:56 sri so an order of magnitude slower
16:56 sri wow
16:57 sri btyler++
16:57 btyler_ I'm not surprised that something wedged, moar's integration with libuv is still pretty immature
16:57 btyler_ but there aren't so many folks who are comfortable hacking on it, and there's only one of jnthn
16:58 btyler_ (like, chunks of the async socket support were pretty much written on a plane somewhere)
16:58 sri yea, every time i look at perl6 it's jnthn doing all the work
16:58 btyler_ I think like a lot of projects where there's a C/C++ runtime supporting an application platform with a scripting language, the # of people who can hack the scripting language vastly outnumbers the people who can hack the C/C++
16:59 btyler_ also I don't think brrt's recent JIT work has merged yet, although I'm not sure how much that'll impact socket server work
17:00 btyler_ but yeah, I really like a lot of p6 in terms of the language, I just wish I were coming to it after it'd been out for a year or two :)
17:02 sri more like 5 years
17:03 sri golang is pretty much a best case scenario for an up and coming language, and it's already 6 years old
17:17 genio All this talk of P6, I guess I'm going to have to break down and brew install rakudo-star
17:18 sri not much you can do with it yet
17:20 sri hmm, interesting take on project sponsorship https://github.com/hapijs/contrib/blob/master/Sponsorship.md
17:24 genio I guess undef is now nil ?   Use of Nil in string context  in block  at t/file.t:96
17:29 sri most modules i tried to install were broken
17:31 sri anybody wants to hack on this? https://github.com/kraih/mojo/issues/855
17:35 sri then i'll do it i guess
17:42 batman maybe this is really obvious, but how do you "loop" through an sync cursor?
17:42 batman tried to write down my question with code here: https://ssl.thorsen.pm/paste/7ce36684b50f
17:42 irqq joined #mojo
17:42 nic Anyone know a site that lets us http get json without an account?
17:43 nic and is reliable enough to use in unit tests?
17:43 batman nic: why can't you use Mojolicious::Lite ?
17:44 nic oh, that is an idea :)
17:44 nic thanks batman
17:44 good_news_everyon joined #mojo
17:44 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vC1h1
17:44 good_news_everyon mojo/master dca86b8 Sebastian Riedel: improve Mojo::DOM::CSS to support selectors with leading and trailing whitespace
17:44 good_news_everyon left #mojo
17:45 sri nic: also http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#JSON-web-services
17:47 nic thanks
17:49 batman sri: how about adding ->redo to Mojo::IOLoop::Delay, which can unshift the current step back to ->remaining() ?
17:49 batman nevermind
17:50 * batman looks angry on past batman
17:51 neilhwatson joined #mojo
17:58 ZoffixW joined #mojo
17:59 ZoffixW nic, also, there's http://httpbin.org/get :) The ::Lite approach is definitely better in this case, but keep http://httpbin.org/ in mind; it's very useful for debugging UAs :)
17:59 meshl joined #mojo
18:17 ZoffixW joined #mojo
18:18 ZoffixW What's a proper way to test flash messages after a redirect? :/  I got $t->post_ok( ... )->status_is(302); Should I do ->header_like() and test the redirect is to the right place and then do a ->get_ok() on the page I expect it to redirect to?
18:18 ZoffixW Seems a bit messy
18:19 ZoffixW .oO( who's Glenn ... https://metacpan.org/pod/Test::Mojo#or )
18:21 henq joined #mojo
18:24 ajr_ joined #mojo
18:35 ZoffixW Mojo::Upload is a bit awkward to use.
18:38 MartinR ZoffixW, what you mean ?
18:39 ZoffixW MartinR, I need something usable to give to Text::CSV (like a filehandle) and Mojo::Upload can be either a ::File or ::Memory asset, and only ::File supplies a ->handle
18:41 MartinR what about http://mojolicio.us/perldoc/Mojo/Asset/File#handle
18:41 ZoffixW MartinR, ?
18:42 ZoffixW MartinR, as I've stated. Only ::File provides that method. But ::Upload can be either ::File or ::Memory, depending on how big it is
18:42 ZoffixW "Can't locate object method "handle" via package "Mojo::Asset::Memory"
18:45 MartinR hmm I dunno
18:45 sri you would really want to write everything into a file just for that?
18:47 henq joined #mojo
18:48 * sri finds apis that only work with filehandles very awkward
18:50 ZoffixW http://fpaste.scsys.co.uk/500319
18:50 ZoffixW ¯\_(ツ)_/¯
18:50 sri that's just a fake handle, it won't work with all apis
18:50 ZoffixW I meant that's what I used for my particular problem right now :)
18:51 ZoffixW Kinda yucky. Maybe I should rethink my model
18:51 sri think a few years back i proposed $asset->to_file or so, to guarantee you get a Mojo::Asset::File
18:52 sri but of course that's very inefficient
18:52 ZoffixW Yeah, you made a good point. I wouldn't want to always write stuff to a file.
18:53 Grinnz_ sri: i thought something like that would be nice sometimes too
18:54 Grinnz_ right now i just create a new Asset::File and write the data to it, heh
18:54 Grinnz_ we unforuntately have a couple APIs that expect a filehandle only
18:55 sri it would literally just be sub to_file { Mojo::Asset::File->new->add_chunk(shift->slurp) }
18:56 Grinnz_ right exactly, but you could short circuit if it's already a file
18:58 sri guess you'd have to inherit end_range/start_range too
18:58 Grinnz_ hmm never used those
18:59 sri not knowingly
18:59 Grinnz_ heh
18:59 henq joined #mojo
18:59 sri it's used for resuming downloads
19:00 sri https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Static.pm#L100-L113
19:09 panshin joined #mojo
19:11 Trelane joined #mojo
19:20 romel joined #mojo
19:24 disputin joined #mojo
19:31 fvox joined #mojo
19:33 glauber joined #mojo
19:34 mantovani joined #mojo
19:37 sugar_ joined #mojo
19:38 genio I don't see a lot of useful p6 modules for me.  :/
19:41 genio and panda doesn't seem to do what the help says it should (list, etc)
19:46 trone joined #mojo
19:46 ajmrch joined #mojo
19:46 ZoffixW genio, you can use any P5 module in P6
19:47 ZoffixW `list` works for me
19:47 genio I was looking at this one: http://modules.perl6.org/
19:48 genio Method 'chars' not found for invocant of class 'Any'
19:48 ZoffixW genio, update your perl
19:48 ZoffixW *your rakudo
19:48 genio ah, I was using the one in HomeBrew
19:48 ZoffixW There were some breaking changes recently.
19:49 genio ugh.
19:49 ZoffixW ¯\_(ツ)_/¯ it's a Beta :)
19:49 genio nevermind.  brew uninstall here we go
19:50 genio aaaand, I'm back to my original opinion
19:51 ZoffixW genio, what was your original opinion?
19:55 genio ZoffixW: I believe someone in here recently went on about it a bit and I found myself mostly in line with their thoughts on it.  I'll quit my nonsense on this matter now though so as to not drudge up the whole thing in channel again.  If you're just wanting to get my viewpoint, feel free to ask me in a /msg
19:57 * sri is actually drifting back to not caring again
20:08 henq joined #mojo
20:28 Rafael joined #mojo
20:47 nic ZoffixW: thanks for httpbin.org mention; that's going to be really useful
21:02 jberger mojo get -v http://httpbin.org/status/418
21:06 jberger nicomen: nice find: http://irclog.perlgeek.de/mojo/2015-06-07#i_10712871
21:07 nicomen jberger: :-)
21:08 nicomen just regret I was too lazy/forgetful to research, but I guess I was too afraid to fail anyway
21:10 jberger fear cuts deeper than swords -- Syrio Forel
21:11 jberger speaking of which, on this re-read I'm finally going to use this http://boiledleather.com/post/25902554148/a-new-readerfriendly-combined-reading-order-for-a
21:12 jberger I made a playlist of my audiobook chapter files following that
21:12 jberger hopefully it works as well as promised
21:14 nicomen hehe
21:34 neilhwatson joined #mojo
21:48 irqq_ joined #mojo
21:52 irqq joined #mojo
21:53 melo joined #mojo
22:16 ZoffixMobile joined #mojo
22:19 ZoffixMobile Do you guys feel you're often duplicating tests in your apps? For example, I wrote a model and tests for it. Then I setup a Mojo web app that uses the model and I essentially write a Test::Mojo test that replicates almost the same test, but through a web UI. What's your approach to this issue?
22:23 henq joined #mojo
22:31 ZoffixMobile I suppose app tests could construe to be model tests as well, but that binds the model to the app :/... I'm still trying to figure out a TDD way to code things that isn't horribly inefficient.
22:47 lluad ZoffixMobile: Theoretically, I inject a stub in as the model when I'm testing the web ui.
22:47 lluad ZoffixMobile: In practice, there's quite a lot of duplication
22:48 sri i don't mind duplication in tests
22:49 ZoffixMobile Thanks. I just wanted to make sure I'm not doing it the Wong Way(tm) :)
22:49 lluad I'm more concerned about making the tests not fragile - so they're testing what needs to stay constant, rather than implementation details - than minimizing their overlap.
22:50 nicomen for me it depends a little, if my web page has heavy server side templating, it's more important to get the black box functional testing right, it means that if the end result is correct it implies that unit parts of models etc are actually working
22:51 nicomen however unit tests are simpler and faster to write, and are also more natural to create wihle developing or as a TDD
22:52 nicomen other times web sites and frontend are the responsibility of frontenders, or sometimes even heavy client side code that should have its own tests, but they surely wouldn't bother testing if the json I serve is right, but rather if their code transforming a json to something nice and correct works
22:55 yt7fms joined #mojo
22:56 ZoffixMobile Thanks.
22:57 Grinnz_ test early, test often... er
22:58 ZoffixMobile hehe
22:59 bd Grinnz: i always say, fail early, fail hard ;)
23:03 nicomen fail fast!
23:08 pink_mist fail always!
23:08 pink_mist no wait
23:18 dabudabu joined #mojo
23:21 Rafael left #mojo
23:28 sri btw. i've added support for leading/trailing whitespace in css selectors because of ->at(':not( div )')
23:29 sri we already have ->at(':nth-child( odd )')
23:36 yt7fms joined #mojo
23:39 Zoffix joined #mojo
23:45 Zoffix Sweet. sri++
23:53 Zoffix Shtong, yes. It's just a module I found on CPAN. You have to install it separately. It's not part of Mojo (not sure if this will fall on deaf ears, but we do have online log :P)
23:53 Zoffix Oh. Someone answered that person. Good.

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