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

IRC log for #mojo, 2015-04-15

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

All times shown according to UTC.

Time Nick Message
00:04 frederico joined #mojo
00:14 mattastrophe joined #mojo
00:27 theo joined #mojo
00:42 dvinciguerra joined #mojo
00:52 asarch joined #mojo
00:54 punter joined #mojo
01:00 Adura joined #mojo
01:02 Zoffix joined #mojo
01:05 mattastrophe joined #mojo
01:11 DaniBunny joined #mojo
01:37 klapperl_ joined #mojo
02:05 frederico joined #mojo
02:10 noganex_ joined #mojo
03:04 basic6_ joined #mojo
03:30 hshong joined #mojo
03:33 irq joined #mojo
04:04 ace joined #mojo
04:48 kaare joined #mojo
04:56 dvinciguerra joined #mojo
04:56 inokenty-w joined #mojo
05:54 vmbrasseur joined #mojo
06:14 ace joined #mojo
06:16 melo joined #mojo
06:18 bramirez joined #mojo
06:22 hshong joined #mojo
06:31 marcus sri: Do both talks? :)
07:04 ace joined #mojo
07:16 eseyman joined #mojo
07:17 AndrewIsh joined #mojo
07:24 irq joined #mojo
07:27 trone joined #mojo
07:33 bramirez joined #mojo
08:09 bramirez joined #mojo
08:31 Vandal joined #mojo
09:03 Shaeto joined #mojo
09:09 punter joined #mojo
09:43 irq joined #mojo
09:50 dparry joined #mojo
09:51 dparry mojo weirdness: changed $r->route(q{/(:dash)/(:metric_id)/edit})->to('edit#metric')->name('metric'); to $r->route(q{/(:dash)/(:metric_id)/edit})->to('edit#metric_edit')->name('metric_edit'); and the corresponding function name and restarted the daemon process and now get "None of these routes could generate a response for your GET request"... huh?
09:52 dparry anyone any ideas as to why that would not work?!
09:55 Zoffix Solar Flares!
09:55 Zoffix (sorry, couldn't resist :) )
09:56 Zoffix Something should show up in the routes table it generates when it gives the error
09:56 Zoffix See what it generated, perhaps?
09:56 Zoffix But I suspect you made a typo somewhere in the code :)
09:57 Zoffix Also, hello to booking.com the Perl shop that's always used as an example that Perl's not dead :D
09:58 Zoffix Do you have the template for metric_edit?
10:03 dparry oh, of course, thanks Zoffix!
10:03 Zoffix :)
10:04 * dparry being dense, move along here nothing to see
10:05 dparry I'd changed a couple of other routes that didn't involve templates (direct JSON render / POST with redirect) so forgot about that part of the equation...
10:48 fhelmber_ joined #mojo
11:10 neilhwatson joined #mojo
11:23 bramirez joined #mojo
11:42 cstamas joined #mojo
11:42 cstamas hi
11:42 purl salut, cstamas.
11:42 cstamas have anyone used kerberos with mojolicious?
11:46 punter joined #mojo
11:47 bramirez joined #mojo
11:57 bramirez joined #mojo
12:19 amon joined #mojo
12:24 OmarOthman joined #mojo
12:24 OmarOthman Hi All
12:24 OmarOthman Is there a way of gathering all the parameters in a route handler, including captures in the URL?
12:24 marcus OmarOthman: Hi Omar
12:25 OmarOthman I know about
12:25 OmarOthman my $params  = $self->req->params->to_hash;
12:25 OmarOthman But if the URL is
12:25 OmarOthman $r->get(q{/(:user_id)/dashboards/my/(:item_id)}, { item_id => 0 })
12:26 OmarOthman Shouldn't this call get me $user_id and $item_id as well in that hash (which is in my case empty)?
12:28 bramirez joined #mojo
12:36 jberger OmarOthman: those are in the stash
12:37 OmarOthman Is there a way of gathering all of them without specifying name-by-name?
12:38 jberger $c->stash
12:38 purl $c->stash is destroyed at end of request
12:44 OmarOthman Would it be an acceptable contribution to add a method called get_all_unreserved_keys (or whatever) that does what I need here? Basically avoiding this:
12:44 OmarOthman "Non-persistent data storage and exchange for the current request, application wide default values can be set with"defaults" in Mojolicious. Some stash values have a special meaning and are reserved, the full list is currently action,app, cb, controller, data, extends, format, handler, json, layout, namespace, path, status,template, text and variant. Note that all stash values with a mojo.* prefix are reserved for internal use."
12:56 mattastrophe joined #mojo
13:02 OmarOthman1 joined #mojo
13:02 vmbrasseur joined #mojo
13:04 vmb joined #mojo
13:05 OmarOthman1 left #mojo
13:06 OmarOthman joined #mojo
13:09 trone joined #mojo
13:14 trone_ joined #mojo
13:17 gryphon joined #mojo
14:00 batman OmarOthman: but why?
14:01 batman OmarOthman: maybe you want $c->match->stack->[-1] ?
14:01 batman https://metacpan.org/pod/Mojolicious::Controller#match
14:07 memowe joined #mojo
14:14 jberger batman: thanks, I knew there was a way to do that and I never remember it
14:14 batman no problem. wonder what OmarOthman thinks...
14:16 jberger its funny, I have never really thought of the path placeholder matches as query parameters and thus I've never needed to do anything like that
14:16 jberger and yet it seems that people do
14:16 batman i don't like looping over unknown params/stash/whatever
14:16 batman i want to know what i'm receiving and discard everything else
14:16 Grinnz well params there's a few use cases where its useful (say if you're getting 100 similarly named parameters)
14:17 Grinnz (but in that case sometimes i just have the javascript send a json blob instead)
14:17 Grinnz placeholders though.. i dont really see a use case
14:17 jberger Grinnz: params is different, but I usually know what route I'm in and thus what captures I expect
14:18 batman Grinnz: huh? in your case, you already know the param name...?
14:18 Grinnz there might be some logic that changes the names slightly
14:18 Grinnz idk, its been a while since i had that use case
14:18 batman that's awful imo
14:18 batman but... there's probably always an exception to the rule :)
14:19 Grinnz i mean like, you could get item_1 item_2 item_3 and not know how many there will be
14:19 Grinnz since query params have no concept of arrays
14:19 Grinnz some old javascript frameworks did that
14:19 Grinnz now they usually send item[] item[] item[] ...
14:20 batman i thought params were sent in the same order as defined in the markup.
14:20 Grinnz javascript, not markup...
14:20 btyler http://datatables.net/ for example
14:21 batman ok
14:21 btyler does a lot of "foo1, foo2, foo3"
14:21 Grinnz yes datatables was a tough one
14:21 batman at least there's a rule. that helps :)
14:21 btyler mostly rather nice, but that particular aspect is less so
14:21 btyler (DT, that is)
14:26 vmbrasse_ joined #mojo
14:29 melo joined #mojo
15:02 mattastrophe joined #mojo
15:12 asarch joined #mojo
15:19 sh4 joined #mojo
15:30 batman Win32 bug blocking Perl 5.22: https://twitter.com/rjbs/status/588357860490358784
15:36 vmb joined #mojo
15:41 OmarOthman joined #mojo
16:23 Oleg joined #mojo
16:40 jnbek joined #mojo
16:53 mattastrophe joined #mojo
16:56 bwf joined #mojo
16:57 sh4 joined #mojo
17:32 disputin joined #mojo
17:34 asarch convos daemon --listen http://*:8354: Can't locate object method "new" via package "Mojo::Loader" at /usr/local/share/perl5/Mojolicious/Plugin/LinkEmbedder.pm line 95.
17:37 jberger asarch: do you need to update LinkEmbedder?
17:40 asarch Yeah!
17:40 asarch Thank you jberger
17:40 asarch Thank you very much :-)
17:41 berov joined #mojo
17:52 batman sri, mishantil, hernan604, Grinnz: got some input on this: https://github.com/jhthorsen/mojolicious-plugin-assetpack/pull/47/files ?
17:53 irq joined #mojo
18:01 zz_Foxcool joined #mojo
18:04 vmbrasseur joined #mojo
18:30 hernan604 batman: nice. does ping and pong have any influence ?
18:42 batman nope.
18:42 batman they are only there to keep the ws alive
18:46 dtscode hey guys... im using Mojo::IRC to build an IRC bot, and it gives me dtscode!~dtscode@dtscode.io, which i store in $domain, but when i do $domain eq "dtscode!~dtscode\@dtscode.io" its never true. any help?
18:51 batman dtscode: obviously something is not what you tell us.
18:51 batman have you tried doing warn Data::Dumper::Dumper($irc) or something?
18:51 dtscode batman, i dont know what else to tell you. and no i havent
18:52 jberger dtscode: I would use Data::Printer and use it to p $domain
18:53 jberger I bet you have something else like maybe spaces that you aren't noticing
18:58 mattastrophe joined #mojo
19:00 hernan604 dtscode: use DDP; warn p $domain
19:06 kaare_ joined #mojo
19:12 odin22 joined #mojo
19:14 batman jberger: what's the status of cpan_mojo?
19:18 jberger batman: you're hosting it :-)
19:19 jberger but friendfeed is shut down
19:19 batman hehe... well, i was thinking about making a hack to make it work
19:19 batman but only if it's not working now
19:21 garu hernan604: just fyi, try to avoid "warn p", use just "p" instead. Doing "warn p" is likely not going to do what you want after Data::Printer's upcoming release :)
19:21 jberger batman: definitely not working
19:21 jberger miyagawa turned off his feed pusher
19:22 batman ok. i was thinking i could poll http://api.metacpan.org/v0/release/_search?q=status:latest&fields=name,status,date&sort=date:desc&size=100 every five minutes or something
19:23 jberger batman: that is essentially what replaces it
19:23 jberger let me find you something
19:23 jberger https://github.com/punytan/cpan_new
19:23 jberger that's the code for the cpan bot @cpan_new
19:24 jberger it used to use the same friendfeed, indeed that's how I found out about it
19:24 jberger https://github.com/punytan/cpan_new/blob/master/script/cpan_new.pl#L26-L44
19:24 jberger and that's the replacement
19:24 jberger poll metacpan every 30s
19:25 Grinnz_ XML::Simple /me grimaces
19:25 jberger but yeah, better to do it via the api
19:25 punter joined #mojo
19:25 jberger Grinnz_: agreed
19:25 batman XML::Simple--
19:25 batman right. you already said that :)
19:26 jberger no "via the api" was aimed at batman
19:26 batman i think i'll do something like this: https://github.com/CPAN-API/cpan-api/blob/master/docs/API-docs.md#downstream-dependencies
19:26 jberger batman: hahaha, nice!
19:26 batman ?
19:27 batman i don't get the funny part :/
19:27 jberger doing that and diff-ing the output to find new ones?
19:28 batman no. just make it even more complex to give me the exact results i need
19:28 jberger oh
19:28 jberger sure, that sounds useful
20:17 * batman will release the new assetpack update tomorrow, unless any feedback is given
21:01 McA2 joined #mojo
21:09 OmarOthman joined #mojo
21:12 * sri decides not to give feedback so assetpack gets released ;p
21:53 OmarOthman Grinnz, batman, btyler, jberger: Thank you guys for the discussion (sorry, I was in a meeting and then left)
21:53 OmarOthman batman: This is very close to what I need, though I really see the reserved words thing quite polluting to the output (there is "action" and "controller" there). This means that if someone accidentally uses a reserved word as a placeholder, he is doomed (though it might still be a fair point since you should read the docs anyway)...
21:53 OmarOthman So, the use case is a generic route handler that does some common stuff and then passes over to a more specific handler. It is very convenient to be able to distinguish those stash values that were placeholders so that these are passed to the specific handlers, which of course know exactly what placeholders to query.
21:53 OmarOthman jberger: Well, it depends on your preference and web framework of choice. I happen to use Dancer2 a bit more at work, so I'm used to having this handy functionality. In a Dancer2 route handler, you can write:
21:53 OmarOthman my $captures = delete $params->{'captures'};
21:53 Grinnz_ OmarOthman: using a reserved word as a stash value or placeholder is always a problem.
21:55 OmarOthman Grinnz_: Well, if you think about it, not necessarily. If you have a specific place in the stash (or a separate stash) for these, then theoretically you can use any name.
21:56 Grinnz_ OmarOthman: i am talking about how mojo works
21:56 OmarOthman OK, sure...
21:56 Grinnz_ OmarOthman: from my understanding, the reserved values are not separate so they can be conveniently used in templates
21:57 OmarOthman Cool, so I have my problem solved with batman's suggestion anyway
21:57 OmarOthman Thanks guys!
22:10 basic6 joined #mojo
22:16 sri OmarOthman: when proposing new functionality, it is customary around here to explain the exact use case
22:18 sri just proposing a specific method without context rarely succeeds
22:19 sri there actually used to be support for "my @names = $c->param;"
22:19 sri but it was removed because nobody could come up with a use case
22:23 OmarOthman sri: Sure, is there a paste bin that you guys use?
22:24 sri gist
22:24 OmarOthman If so, please update the topic to include it.
22:24 sri any is fine
22:32 OmarOthman https://gist.github.com/omar-m-othman/fcf2780845b381b4a7fd
22:43 Andreas3 joined #mojo
22:51 sri OmarOthman: i don't understand it
22:51 OmarOthman sri: So the point is that there are a lot of other items than "dashboards"
22:51 OmarOthman Whose URLs with contain different words...
22:52 OmarOthman Example: q{/(:user_id)/metrics/my/(:metric_id)}
22:52 sri like, nothing in that gist makes any sense to me
22:53 sri it's like you forgot half of the description
22:54 OmarOthman Well, long story short, it is useful for me to be able to separate the parameters that were sent to a specific route handler from the placeholders that were matched in the route itself
22:54 sri that's not a use case
22:55 OmarOthman The gist is supposed to narrate the use case
22:55 OmarOthman _common_rd is the generic route handler that proxies to the selected method
22:55 OmarOthman There are a lot of these
22:55 sri well, i tried
22:56 sri "i want this very specific data structure to send to somewhere" just doesn't tell me anything
22:56 OmarOthman And every one of these knows what to expect (dashboards_my_read for example knows that the URL has a $user_id and a $dashboard_id
22:58 OmarOthman Anyway, never mind. I can obviously send a reference to the entire stash and that will work too.
22:58 OmarOthman Or use batman's suggestion ($c->match->stack->[-1])
22:58 vmb joined #mojo
23:17 mattastrophe joined #mojo
23:56 asarch joined #mojo

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