Camelia, the Perl 6 bug

IRC log for #mojo, 2013-06-04

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

All times shown according to UTC.

Time Nick Message
00:46 shmuel joined #mojo
00:54 Liam`` joined #mojo
01:11 inokenty joined #mojo
01:25 whitebook joined #mojo
01:28 egopro joined #mojo
01:51 d4rkie joined #mojo
01:57 Meiermann joined #mojo
02:20 jberger joined #mojo
03:16 * jberger finds myself golfing the pastie clone
03:17 * jberger has never needed to use push with parens before :-P
03:21 preflex_ joined #mojo
03:42 Meiermann joined #mojo
03:52 asarch joined #mojo
03:57 Averna joined #mojo
04:13 egopro joined #mojo
04:18 arpadszasz joined #mojo
05:50 Britzel joined #mojo
05:52 sh4 joined #mojo
05:52 basiliscos joined #mojo
05:59 keedi joined #mojo
06:11 dod joined #mojo
06:11 denisboyun joined #mojo
06:23 suy joined #mojo
06:27 dpetrov_ joined #mojo
06:33 dpetrov_ joined #mojo
06:47 dod joined #mojo
06:51 dod joined #mojo
07:13 dod joined #mojo
07:58 jzawodn joined #mojo
08:07 rem_lex|pivo joined #mojo
08:11 Vandal joined #mojo
08:11 maxhq joined #mojo
08:15 arpadszasz_ joined #mojo
08:24 sivoais joined #mojo
08:25 Dandre hello,
08:26 Dandre Is there some REST application example written with mojo?
08:54 dod joined #mojo
08:54 fhelmber_ joined #mojo
09:21 kwa Dandre: Technically mojolicious is REST, it just so happens the default representation is HTML. Mojolicious makes it easy to create a REST app, however.
09:22 kwa Look at the function respond_to().
09:23 kwa Dandre: http://search.cpan.org/~sri/Mojoli​cious-4.11/lib/Mojolicious/Guides/​Rendering.pod#Content_negotiation
09:23 Dandre ok but can I do output in conformence to Conten Type header?
09:23 kwa You mean "Accept"?
09:23 Dandre yes sorry
09:24 kwa Yeah, that's exactly what the respond_to function is for. Check the link above. ^^
09:24 Dandre yes I'm reading your link
09:25 kwa Unfortunately it doesn't DWIM in bridges, under, hooks etc. so might need to employ a bit of hackery. But it works as expected in the controller at the end of the dispatch chain.
09:26 Dandre can I render depending on the .format wich overides the Accept:. For instance:
09:26 Dandre GET /hello.json or GET /hello.html ?
09:27 kwa Also { Accept => 'application/json' }
09:27 kwa It will also respond to /hello?format=json
09:28 kwa (The HTTP verb doesn't matter.)
09:29 Dandre nothing for /hello.json?
09:29 kwa Sure.
09:29 kwa and /hello.txt /hello.csv
09:29 Dandre ok
09:30 kwa The reserved 'format' stash variable is, and it will be used in respond_to.
09:30 kwa *is set
09:31 kwa I would advise you set a default format (any) else the request will hang if someone asks for a representation you've not accounted for.
09:31 kwa From the example: any  => {text => '', status => 204} is perfect.
09:31 Dandre ok so we must put a route like
09:31 Dandre get 'hello.:format' => {}
09:31 kwa No, just '/hello'.
09:32 Dandre ok will try
09:32 kwa The format is plucked from the query string, accept header, and resource extension.
09:32 kwa s/and/or/
09:32 kwa Good luck.
09:35 Dandre thanks
09:35 kwa Dandre: P.S. I'm not sure of the internals for parsing the Accept header. Using .json at the end of your route will guarentee the client will get what it expects.
09:35 kwa No probs.
09:35 arpadszasz joined #mojo
09:46 Dandre Can I dynamically set routes (for instance reading some config file)?
09:48 kwa Dandre: You can set and modify routes up until the first request, so you could easily read in a config to set the routes. Mojos routing is pretty powerful though, so you shouldn't need to do that. See: http://mojolicio.us/perldoc​/Mojolicious/Guides/Routing
09:49 fhelmbe__ joined #mojo
09:50 Dandre My concern is that I plan to accept some kind of plugins to my application that can add new resources to my REST App
09:51 kwa Mojolicious plugins can alter the route when registering.
09:52 Dandre ok
09:54 aleksey joined #mojo
10:03 whitebook joined #mojo
10:20 fhelmber_ joined #mojo
10:38 dsteinbrunner joined #mojo
10:52 denisboyun joined #mojo
10:55 fhelmbe__ joined #mojo
11:07 fhelmber_ joined #mojo
11:12 aleksey joined #mojo
11:12 sri joined #mojo
11:14 Take joined #mojo
11:16 denisboyun joined #mojo
11:29 fhelmbe__ joined #mojo
11:33 Take Good day
11:33 Take I'm having an somewhat strange problem with mojo and templates
11:34 Take I've got an simple template with two variables, but only last of them is at output
11:34 moritz please show your code (minimal example that shows your problem)
11:35 Take http://paste.debian.net/8391/
11:35 Take There's the template
11:35 Take And I've got an call $self->render( 'message' => 'foo', 'data' => 'bar' );
11:35 Take But at output I get only 'bar'
11:36 Take However, if I remove lines 2-4 from template then 'foo' is displayed correctly, so it seems that variables get passed trough correctly
11:42 * moritz wonders if either 'message' or 'data' is reserved
11:42 Take Don't know really
11:42 Take But, as said, if I leave only 'message' or 'data' to template they both show up correctly
11:42 Take But that combination doesn't
11:42 kwa http://search.cpan.org/~sri/Mojolicious-​4.11/lib/Mojolicious/Controller.pm#stash
11:42 kwa Nope.
11:44 moritz my %RESERVED = map { $_ => 1 } ( qw(action app cb controller data extends format handler json layout), qw(namespace partial path status template text)
11:44 moritz );
11:44 moritz seems that data is reserved
11:44 Take Hmh..
11:44 Take Ok.. let's see if it helps to change that
11:45 Take Well.. yes, it indeed helps
11:46 Take But that doesn't really explain the behaviour with reserved words
11:46 kwa Reserved stash variables can get clobbered at any point.
11:47 Take But that doesn't explain why the whole template misbehaved
11:48 Vandal Take, cuz data - is what to show instaed of template
11:50 Take It'd be nice to get an warning on those, but I suppose it'd be a bit difficult
11:50 Take However, that issue is now fixed, thank you all so much
11:58 kwa Take: Yeah it'd be hard to do that, especially as it's a feature that you can set default stash values like 'data' and 'template' for specific routes.
12:02 sri there can't be a warning... render(data => 'foo') does exactly what it's supposed to be
12:02 sri http://mojolicio.us/perldoc/Mojolici​ous/Guides/Rendering#Rendering_data
12:03 sri s/be/do/
12:07 fhelmber_ joined #mojo
12:13 ladnaV joined #mojo
12:20 ver joined #mojo
12:21 marvin joined #mojo
12:21 marvin hi guys
12:23 marvin could you show me how to re-use existing template, which puts output of $sth->fetchall_arrayref() into table? i'm having problems when i have two different results and two the same template layouts on the same page. i use % include 'path/foo' to display the template
12:24 marvin within the template i have % for my $case ( @{$cases_list} ) { ... } loop
12:25 SmokeMachine joined #mojo
12:32 fhelmber_ joined #mojo
12:41 SmokeMachine joined #mojo
12:43 whitebook joined #mojo
12:53 SmokeMachine joined #mojo
12:59 fhelmber_ joined #mojo
13:08 SmokeMachine joined #mojo
13:26 d4rkie joined #mojo
13:38 gryphon joined #mojo
13:39 depesz marvin: then you have to iterate over @{ $case } to output data.
13:43 sri http://www.skeletonscribe.net/2013/05/p​ractical-http-host-header-attacks.html # good thing url_for generates relative URLs :)
13:46 nicolaas joined #mojo
13:47 btyler joined #mojo
13:49 sri but i suppose applications could still be vulnerable
13:50 sri all it takes is a url_for->to_abs in a generated email
13:50 nicolaas_ joined #mojo
14:03 btyler_ joined #mojo
14:10 preaction_ joined #mojo
14:10 asarch joined #mojo
14:12 tomi-ru joined #mojo
14:40 denisboyun joined #mojo
14:44 arpadszasz joined #mojo
14:47 ynonp joined #mojo
14:48 gryphon joined #mojo
14:49 sh4 joined #mojo
14:50 libsysguy joined #mojo
14:51 jberger_ joined #mojo
15:14 denisboyun joined #mojo
15:19 sivoais joined #mojo
15:26 dod1 joined #mojo
15:27 mire joined #mojo
15:28 marvin depesz: thanks. what if i would like to reuse this template and input different $cases_list hash in the same layout? i include the template twice, but i don't know how to change $cases_list for the second time.
15:29 libsysguy1 joined #mojo
15:32 dod joined #mojo
15:36 ladnaV marvin, include 'foo', cases_list => 'bar'
15:36 d4rkie joined #mojo
15:36 marvin oooh super
15:36 ladnaV everything after comma will merge into stash
15:37 marvin awesome,
15:37 marvin let me try it
15:42 sri http://mojolicio.us/perldoc/Mojolicious/Gu​ides/Rendering#Including_partial_templates
15:43 marvin thx sri
15:43 Dandre is there some renderer that output a stash in xml format?
15:44 libsysguy1 <%= perl expression %> will xml excape a result
15:45 libsysguy1 but I don't think it will add tags and such
15:46 marvin ladnaV, sri. it works! thanks!
15:46 marvin you are great!
15:46 Dandre I have seen an xml serializer in Dancer Don't know what it does in detail though
16:01 delias joined #mojo
16:20 asarch joined #mojo
16:27 gork joined #mojo
16:29 tl joined #mojo
16:30 Kovensky joined #mojo
16:30 buu joined #mojo
16:30 bowtie joined #mojo
16:31 HtbaaPi_ joined #mojo
16:31 ajmrch joined #mojo
16:34 dod joined #mojo
16:37 Dandre I have a one file test application (Mojolicious::Lite based). I'like to try one plugin. Where should I put the plugins files?
16:50 sri do we have anyone here running hypnotoad on more than 4 cores?
16:53 sri or anyone who could? i wonder how the cpu usage and rps are running "wrk -c 100 -d 10 http://127.0.0.1:8080/" against "perl examples/fast.pl prefork -l http://*:8080 -m production -w 12"
16:53 sivoais joined #mojo
16:54 libsysguy I can later, I have a box with 16
16:54 libsysguy but I was just about to step out
16:55 libsysguy I don't have any perl stuff set up on that box yet
16:55 libsysguy :-/
16:55 fhelmber_ joined #mojo
16:55 sri libsysguy: which platform?
16:55 libsysguy ubuntu
16:55 dod joined #mojo
16:56 sri ah, that should be interesting
16:56 libsysguy heh
16:56 libsysguy headed out for lunch o/
16:56 sri \o
17:24 dod1 joined #mojo
17:27 sri guess i'll watch the p2 talk too
17:29 tianon sri: give me a sec and I'll test it here on 8 cores (gentoo)
17:30 sri \o/
17:31 sri i'm especially interested in how evenly distributed the load is on those cores
17:34 tianon http://pastie.org/8005811 - here's the wrk output, CPU usage on all 8 cores shot up to 100% for the entire duration of the test
17:34 tianon what other info can I gather or test to help? :)
17:34 sri thanks a lot :)
17:35 * sri was wondering if the accept mutex was getting in the way of scalability, but it's clearly not the case
17:35 sri tianon: mojo version?
17:35 tianon that was against mojo master from github :)
17:36 sri \o/
17:36 sri EV installed?
17:36 tianon nope, would you like a test with EV?
17:36 sri sure, but i don't think it will make any difference
17:36 tianon for my own development, I keep CPAN in local::lib, so that was a pretty core install :P
17:36 tianon no system Mojo, so no conflict with the github clone :)
17:38 tianon also makes it easy to run the examples :P
17:38 sri oh, is it 8 real cores or hyperthreads?
17:38 tianon 8 real cores - "AMD FX(tm)-8120 Eight-Core Processor"
17:39 sri ah
17:39 * sri has not seen an amd in ages :o
17:39 tianon home built tower, so amd is cheap <3
17:40 tianon ping me anytime you want gentoo, 8-core, or amd tests :)
17:40 sri tianon++
17:45 bc547 sri: if you want, I can test tomorrow or the day after on a dual intel hexacore (2 x 6 physical cores with hyperthreading)
17:45 whitebook joined #mojo
17:46 bc547 (that's 24 cores for the OS to use)
17:47 sri bc547: that would be appreciated (but make it -w 24)
17:48 dod joined #mojo
18:12 * jberger_ is also going to watch p2 talk
18:13 jberger_ FFI is very needed for PDL
18:14 tianon sri: fyi, just tested on my laptop ("Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz" - 8 logical cores), and got just ever so slightly lower overall results (slightly higher latencies), but roughly equivilant to my tower workhorse
18:14 tianon that's 4 cores with hyperthreading
18:14 tianon I can pastie the results if you're interested in the specific numbers
18:19 denisboyun joined #mojo
18:22 sri tianon: not necessary, thanks
18:22 sri just want to make sure it scales properly
18:23 tianon sri: ok, figured :)  seriously, let me know anytime you need testing (I try to watch the channel religiously, but feel free to ping me directly), and I'll do whatever you need :)
18:27 basiliscos joined #mojo
18:28 rem_lex| joined #mojo
18:40 bowtie_ joined #mojo
18:40 bowtie_ left #mojo
18:58 sri immutable strings... in perl... yea i don't see p2 going anywhere
18:59 jberger_ doesn't feel much like Perl then does it
18:59 * jberger_ wants an FFI :'-(
19:00 * sri likes FFI::Raw
19:01 jberger_ 49 pass 153 fail
19:01 jberger_ :/
19:02 sri yea, it needs more attention
19:22 dod1 joined #mojo
19:30 libsysguy joined #mojo
19:34 libsysguy sri did you find somebody with a big enough box to test on?
19:39 jberger joined #mojo
19:41 whitebook joined #mojo
19:45 libsysguy jberger I have been racking my brain and scouring the internet to find a way to make DBIx::Class non-blocking but I see no easy way :-/
19:46 jberger same here
19:46 jberger DBIC is too big to hack on
19:46 libsysguy well it makes me feel a bit better that greater minds than mine have attempted to think about the problem
19:46 sri libsysguy: yes i did :)
19:46 libsysguy and yes, I'd drown in code if I tried to hack at it
19:46 sri you can't make DBIC non-blocking
19:47 libsysguy sri cool, sorry I had to jet
19:47 jberger after watching the talk that sri posted on NoSQL
19:48 jberger I really like the idea of NoSQL, and since I like Mojo, I'm playing a lot with Mango lately, though as sri will tell you, its still very alpha, dont use it for production yet
19:48 libsysguy but if you have relational data, Mongo doesn't really fit
19:49 libsysguy also, if you want to use it for $work the licensing isn't really that great
19:49 sri has anyone of you ever seen a real non-blocking ORM?
19:50 jberger it would have to be really carefully designed
19:50 libsysguy isn't there one in python << could be wrong
19:50 jberger for things like CMSes relational doesn't seem as useful as documents
19:50 libsysguy true
19:50 tba joined #mojo
19:50 jberger but you're right, if your data is very relational its not what you want
19:51 libsysguy I'm working on a ticketing system
19:51 denisboyun_ joined #mojo
19:51 jberger the ticket doesn't model well as a document?
19:51 libsysguy I guess you could abstract out some of the outer bits and make it fit
19:52 libsysguy users linked to tickets
19:53 jberger there are still "foreign keys"
19:53 jberger the document id
19:53 tba silly question I know, but has much changed in rendering (specifically exceptions) in the last year or two? :)
19:53 sri mongodb does have soft relations
19:54 jberger tba many of the render_* methods have been removed
19:54 jberger things like render_text( ... ) should be render( text => ... ) now
19:54 tba it looks as though some exceptions don't get rendered, when using any renderer other than ep
19:54 libsysguy in regards to the licensing, I guess the commercial use is just for the trademarks, not the source
19:55 tba tracked it down to an extra nested render call which obliterates the exception html when using a renderer plugin
19:55 tba (but then the plugins haven't been updated in a year or more)
19:55 sri like {foo => 'bar', baz => {'$id' => oid(...), '$ref' => 'some_collection'}}
19:55 sri that embedded document references a document in the some_collection collection
19:55 sri nothing is enforced though
19:55 libsysguy I didn't know it had references, I thought you had to embed the other document
19:56 sri mongodb doesn't do anything with the reference, it's up to the specific client to resolve them
19:56 libsysguy well currently $work using MyISAM so there is no enforcement anyway
19:56 sri Mango doesn't do anything with DBRefs yet for example
19:59 tba should it be possible to call render_exception from inside a plugins _render method?
20:01 jberger moe is looking good
20:01 jberger p2 talk looked ... more conceptual
20:01 sri at this point rakudo with moarvm seems the most realistic :)
20:02 libsysguy p2 was Reni right?
20:02 sri tba: don't think so
20:02 jberger I didn't see the moarvm talk
20:02 jberger tba: yes
20:02 sri tba: convention is to just throw the exception
20:02 * tba grins
20:02 jberger oops,\
20:02 jberger libsysguy, yes
20:02 sri http://mojolicio.us/perldoc/Mojolicious/Guides/​Rendering#Adding_your_favorite_template_system
20:02 jberger tba: disregard, got confused who was asking what
20:03 sri at least that's what we say in the docs
20:03 tba sri: will try that now, was just looking at how Xslate and TT plugins do it, and both some exceptions
20:03 tba *both lose some exceptions
20:04 tba sri: genius!
20:04 tba looks as though all current renderer plugins use render exception and return 1, meaning either empty page with 200 status or 404 not found page
20:04 sri it changed a few times over the years
20:05 sri we got rid of a lot of evals, so it can since 2.x i believe just throw when something goes wrong
20:05 sri many renderer plugins are very old... 0.x possibly
20:05 tba tbh it looks far cleaner anyway, replaces 10 lines of code with 1.... :)
20:11 duncanthrax joined #mojo
20:17 _tba joined #mojo
20:30 inokenty joined #mojo
20:30 alester joined #mojo
20:34 whitebook joined #mojo
20:42 denisboyun joined #mojo
20:59 mire joined #mojo
21:02 MeierM joined #mojo
21:03 basiliscos1 joined #mojo
21:03 marty joined #mojo
21:10 perlite joined #mojo
21:13 tba sri: your start_tls patch worked brilliantly, the problems I had after that were solved by calling start_tls manually from stream->on(drain - would definitely be a nice feature in core :)
21:13 tba sri: (with a few modifications, will pastebin it)
21:14 sri chances for getting it into core are pretty small atm i'm afraid
21:15 sri at least as a feature
21:15 sri if it made the current code smaller, or easier to test it would be a possibility
21:16 tba not sure it makes code smaller
21:16 tba but it would open up IOLoop as a seriously useful tool for building non-HTTP clients and servers
21:17 sri that's currently not a project goal though
21:18 sri that said, i won't stand in the way of another core dev decides to champion the change
21:18 tba I realise that, but for a minor change and no implications for existing users it adds a huge amount of value - and I love IOLoop!!!
21:18 sri s/of/if/
21:20 sri jberger, marcus, tempire, crab: *poke*
21:20 jberger I'm not opposed
21:21 sri that's not championing it ;p
21:21 jberger I'm assuming this is something that cannot be done as an external module
21:21 sri of course it can
21:21 sri you could just as well write a Mojo::IOLoop::StartTLS module
21:23 sri we do have starttls on the client side for tls proxy connects, but on the server side the uses are very limited... as far as i know pretty much just SMTP
21:24 tba its used by IMAP, POP3, SMTP, FTP, XMPP, LDAP and NNTP
21:25 tba (probably many others too :))
21:25 sri not commonly used though
21:28 jberger well, I don't expect to be champion mostly because I wouldn't use it
21:28 * sri wouldn't use it either
21:28 tba imho, i dont really mind whether its in core or not, like you say I can just make a plugin (now I know its working)
21:28 jberger that said, I really like IOLoop as a tool outside just Mojolicious apps
21:29 basiliscos joined #mojo
21:29 jberger I grok steps and IOLoop for async now
21:29 sri like i said, i would be in favor if there's a real gain for core too
21:29 sri be it less code or better testing
21:30 sri ioloop is not general purpose after all
21:30 sri there will be no udp either
21:31 sri jberger: in the end there is nothing you can't build with the primitives from Mojo::Reactor ;p
21:33 sri i suppose if you're going for the less code approach, you could try to merge the starttls code from Mojo::IOLoop::Client and Mojo::IOLoop::Server into a shared module
21:33 jberger sri, then in that case, I agree, unless there is real benefit for the core (of some form), it sounds like a module
21:33 lukep joined #mojo
21:34 sri then it becomes mostly an API design problem
21:38 sri my $tls = Mojo::IOLoop::TLS->new($handle); $tls->on(finish => sub { my ($tls, $new_handle) = @_ }); $tls->handshake(client => 1, ....);
21:39 sri you get the idea
21:40 sri possibly a few tls support checks too, so you can check early... croak "..." unless Mojo::IOLoop::TLS->has_tls;
21:40 tba sri: your patch plus a few modifications - http://pastebin.com/3SkubtzK
21:41 tba and the TLS class idea sounds good
21:42 sri that's how you'd get my vote, more code reuse and in turn better tests
21:43 jberger what is the plural of mojolicious?
21:43 jberger stevan just asked
21:44 sri isn't mojolicious a verb? ;p
21:44 sri one mojolicious, two mojolicious, three mojolicious... sounds good though
21:44 * jberger declares it to be mojolicii
21:44 jberger :-)
21:44 sri :o
21:48 jberger rjbs just confirmed from the audience, signatures are coming!
21:49 sri :O
21:49 sri where do i need to watch?!
21:50 jberger in LBJ
21:50 jberger only a few minutes ago
21:50 sri looks like i missed all the good stuff :(
21:51 jberger with dvr can't you go back?
21:51 sri only if i had been watching i think
21:51 sri (and paused)
21:52 sri oh i can!
21:52 jberger I'm not 100% sure of that
21:52 sri \o/
21:52 jberger yeah!
21:53 jberger ~o/
21:53 jberger \o~
21:53 sri \o/
21:53 jberger find the bit where he is talking about signatures, at one point he asks out to rjbs
21:55 sri tba: btw. don't think i'll be able to give Mojo::IOLoop::TLS a try.... really really need to hack more on Mango
21:56 tba joined #mojo
21:56 sri should be a fun way to learn about TLS, sockets and event loops though
21:58 tba sri: np, i might give it a go if I have some time, but for now tls upgrade works so I'm happy :)
21:58 mdmonsen joined #mojo
21:59 mire joined #mojo
22:01 jnbek^dt joined #mojo
22:20 rem_lex|pivo joined #mojo
22:34 Averna joined #mojo
23:06 wesal joined #mojo
23:22 hotsnow joined #mojo
23:31 wesal left #mojo
23:32 gryphon joined #mojo
23:38 mdmonsen joined #mojo
23:51 whitebook joined #mojo

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