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

IRC log for #mojo, 2016-08-15

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

All times shown according to UTC.

Time Nick Message
00:24 Pierre joined #mojo
00:47 ayokh75_ joined #mojo
00:57 Pierre joined #mojo
01:57 Pierre joined #mojo
02:00 meshl joined #mojo
02:03 Pierre joined #mojo
02:13 zivester joined #mojo
02:18 noganex joined #mojo
02:20 ayokh75 joined #mojo
02:21 Pierre joined #mojo
02:31 Pierre joined #mojo
03:30 ivi joined #mojo
05:04 Pierre joined #mojo
05:23 Pierre joined #mojo
05:41 Pierre joined #mojo
05:59 che-quest joined #mojo
05:59 Pierre joined #mojo
06:17 Pierre joined #mojo
06:23 ashimema joined #mojo
06:27 dvinciguerra joined #mojo
06:28 Pierre joined #mojo
06:59 Vandal joined #mojo
07:00 ivi joined #mojo
07:00 batman so... i want to expose every controller/action i have over a websocket. has anyone done this before? my idea is simply to make sure all the methods are unique across the controller classes and then make on MyApp::Controller::Events class that inherit from all of the other controllers.
07:01 batman the reason for the "events" controller is that i want to do something like this: $c->on(json => sub { my ($c, $data) = @_; my $method = $data->{method}; $self->$method($data); }) (but with input validation of course)
07:02 batman so how stupid is that..? does anyone have another idea?
07:06 tyldis_ joined #mojo
07:13 tyldis joined #mojo
07:16 sri sounds like the websocket multiplexing feature we were considering for core
07:16 sri you know, like channels in phoenix framework
07:21 AndrewIsh joined #mojo
07:29 tyldis_ joined #mojo
07:33 Guest-questX joined #mojo
07:34 tyldis joined #mojo
07:39 Pierre joined #mojo
07:49 osfabibisi joined #mojo
07:55 Pierre joined #mojo
07:57 batman But how do you dispatch to the correct controller class?
07:58 batman im not sure if it even makes sense... I'm considering converting all my actions to helpers
07:59 batman Making the actions three lines of code, where I just call the helpers...
08:11 cpan_mojo Mojolicious-Plugin-LocaleTextDomainOO-0.01 by CLICKTX https://metacpan.org/release/CLICKTX/Mojolicious-Plugin-LocaleTextDomainOO-0.01
08:18 dod joined #mojo
08:23 dod joined #mojo
08:33 good_news_everyon joined #mojo
08:33 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v6gmp
08:33 good_news_everyon mojo/master 70c177d Sebastian Riedel: explain the arguments of the route generation methods and functions
08:33 good_news_everyon left #mojo
08:33 sri jberger: that might be of interest to you
08:33 sri batman: you wouldn't because that's silly
08:34 sri it would add a new controller-ish concept for websockets
08:34 sri like MyApp::Channel::Foo
08:34 sri with arbitrary methods you're allowed to call through the websocket
08:35 sri and a few special methods for when you connect and disconnect
08:36 sri batman: btw. it would be really nice right now to have a one-liner to update the mojo docs on mojolicious.org to see how those doc changes look live ;p
08:36 sri *hint hint*
08:37 sri *nudge nudge*
08:51 cpan_mojo Mojolicious-Plugin-LocaleTextDomainOO-0.02 by CLICKTX https://metacpan.org/release/CLICKTX/Mojolicious-Plugin-LocaleTextDomainOO-0.02
08:57 stephan48
09:05 * sri can't believe just how bad suicide squad was
09:06 sri batman vs superman was at least somewhat entertaining, but this one was just awful in every way
09:07 pink_mist I thought basically the opposite
09:07 sri :o
09:08 pink_mist sq was entertaining, while bvs was anything but
09:09 pink_mist err, ss
09:09 pink_mist heh "suicide quad" :P
09:13 Pierre joined #mojo
09:22 batman sri: do you have a link to where I can get ideas on how to implement the Channel:: thing?
09:23 batman about the oneliner: unfortunately I'm in meetings now... Will let you know when I can fix that script.
09:27 kermit joined #mojo
09:39 tyldis_ joined #mojo
09:46 sri batman: http://www.phoenixframework.org/docs/channels
09:47 Pierre joined #mojo
09:49 sri if i had more time channels is one of the things i would love to work on
09:50 sri channels, forkcall, http/2 and minion ui
09:51 sri so many cool things that will never get written :/
09:57 cpan_mojo Mojolicious-Plugin-LocaleTextDomainOO-0.03 by CLICKTX https://metacpan.org/release/CLICKTX/Mojolicious-Plugin-LocaleTextDomainOO-0.03
09:58 cuechan joined #mojo
10:05 batman jberger: dd you start to look at channels?
10:05 batman sri: i'll try to find time tonight or tomorrow... it's very interesting for convos
10:21 shoorick left #mojo
11:18 tchaves joined #mojo
11:23 kid51 joined #mojo
11:24 tchaves joined #mojo
11:33 cafe joined #mojo
11:39 Pierre joined #mojo
12:04 Finn joined #mojo
12:04 Finn Sorry to bother, what would be the equivalent of a PHP "<?php
12:11 anparker Finn: http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Embedded-Perl
12:14 Finn Ah sorry it seems it didnt fully paste in. Was meant to copy in a simple move_uploaded_file() like in PHP for an image upload, since I am using phonegap to make an app.
12:15 Finn http://zacvineyard.com/blog/2011/03/upload-a-file-to-a-remote-server-with-phonegap an example of the PHP script in action with the kind of code used
12:17 Finn Currently my Mojo code is being used to query parameters (custom text fields written in a form), then write them into a database with these text fields and the filename. I just need to the code actually moving the uploaded file to the server, but the Mojo::Upload documentation doesn't seem to explicitly instruct how.
12:19 Finn http://pastebin.com/dtDUJzYD both of the scripts being used at current if it helps. Thank you :)
12:19 Kripton joined #mojo
12:21 anparker http://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial#File-uploads
12:22 anparker you can call $example->move_to('/path/here')
12:23 dvinciguerra joined #mojo
12:24 tl joined #mojo
12:26 Finn Thank you very much!
12:32 jberger sri: excellent!
12:32 * purl plays air guitar
12:32 jberger batman: i have a multiplex plugin almost ready on github
12:32 jberger It's on my todo list for this week as i will need it for $work soon
12:33 batman jberger: care to share some links?
12:33 * jberger just woke up, one sec
12:34 jberger https://github.com/jberger/Mojolicious-Plugin-Multiplex
12:36 batman jberger: is that based on phoenix' channels?
12:37 * batman haven't looked yet
12:37 jberger No, it is based on a proposal by sockjs group
12:37 purl okay, jberger.
12:37 gizmomathboy joined #mojo
12:38 jberger purl: forget it
12:38 purl jberger: I forgot it
12:38 zivester joined #mojo
12:38 marty joined #mojo
12:39 batman jberger: thanks
12:40 jberger batman: read this first maybe
12:40 jberger https://www.rabbitmq.com/blog/2012/02/23/how-to-compose-apps-using-websockets/
12:54 neilhwatson joined #mojo
13:04 perlpilot joined #mojo
13:07 hertzhaft joined #mojo
13:10 hertzhaft cafe: concerning the question you had about the error message ending in ", <DATA> line 2231"
13:11 hertzhaft that's because Mojo::Util is loaded when you have Mojo::Controller as a base class
13:11 hertzhaft it has a very long DATA section (2231 lines)
13:19 hertzhaft sorry, Mojolicious::Controller
13:20 cafe oh thanks, hertzhaft!
13:21 hertzhaft if an error occurs while reading your own data section, perl will tell you the error location
13:21 cafe so whenever Mojo::Util is loaded, the error messages will contain  ", <DATA> line 2231" ?
13:22 hertzhaft I guess that occurs because that was the last data section read by your script before the error happend
13:23 hertzhaft the message doesn't seem very useful in this place, since the Mojo::Util DATA section was read without errors
13:24 cafe actually I don't even have a data section on this particular controller... I just noticed that behavior when my editor stopped reporting the correct line for compilation errors
13:24 cafe maybe I'll just fix its line parsing regex :)
13:25 hertzhaft if you print out %INC you'll see Mojo::Util was loaded
13:25 cafe yeah.. I've repoduced the same behavior on a .pl script, use'ing Mojo::Util
13:25 hertzhaft :-)
13:27 cafe btw.. I'm new to Mojo.. (1 month) and this is the first time it annoyed me.. :) Its being a pleasure! Thank you all :)
13:27 hertzhaft oh, now I understand why that message causes a problem
13:31 cafe heeheh.. spent quite a time chasing that yesterday.. lol
13:31 cafe welcome to the __DATA__ lovers world
13:32 jberger hertzhaft: That's interesting
13:32 jberger I wonder if p5p could try to remove that
13:33 hertzhaft I think perl error messages mention the last open filehandle
13:34 cafe jberger, I've learned a good bit of Mojolicious by reading Galileo source, thanks for that :)
13:34 cafe its amazing how easy it is to do things like the setup command
13:35 hertzhaft perlvar says, ${^LAST_FH} is also the handle used when Perl appends ", <STDIN> line 1" to an error or warning message
13:38 jabberwok left #mojo
13:42 tyldis_ joined #mojo
13:50 asarch joined #mojo
14:16 hertzhaft BEGIN { open F, '<', '/dev/null'; () = <F>; } gets rid of the <DATA> line in the error message :-)
14:18 cafe :D
14:18 cafe let's patch Mojo::Util! heheh
14:23 AirDisa joined #mojo
14:24 robinsmidsrod joined #mojo
14:35 jberger cafe: I'm happy to hear that!
14:36 jberger that setup command is one of my favorites
14:43 cafe :)
14:47 nic https://gist.github.com/niczero/1b9c7f816cc5b121644653277a5d74d4
14:47 nic I guess I'm doing something bonkers, but I was expecting url_with to accumulate query params, so that $second would have both a=A and b=B
14:47 nic Anyone spot what I'm doing wrong?
14:49 jberger nic: http://mojolicious.org/perldoc/Mojo/URL#query
14:49 Grinnz https://metacpan.org/pod/Mojo::URL#query see first example block
14:50 jberger you don't want the replace form or ->query
14:50 jberger s/or/of/
14:50 jberger you want the merge form
14:50 nic oh lol.  completely forgot all that {} [] gubbins
14:50 nic thanks guys
14:50 jberger you don't need to use those if you do ->query->merge(...)
14:51 jberger the {} [] () forms are to aid in chaining
14:51 nic I (normally) use the symbols, but I'm supposed to remember that they're the opposite to what you'd exepct :D
14:52 nic I'll try out using ->merge explicitly, might help the readers as well as my memory :)
14:53 nic very nice, that's a win
14:54 jberger the difference of course is that ->query->merge(...) returns a Mojo::Parameters object
14:54 jberger so you can't do:
14:55 jberger my $url = $c->url_with->query->merge(...);
14:55 zivester joined #mojo
14:55 nic thanks for that note, v useful
14:56 nic I'm a little puzzled how it stringifies to the expected url in that case
15:00 nic oh, I think I see; ->merge doesn't do what I want; ok, back to symbols :)
15:02 umask001 joined #mojo
15:02 jberger sri: the fix to ", at <DATA> line 2231" addendum in the error message is to add a "close DATA" here https://github.com/kraih/mojo/blob/master/lib/Mojo/Util.pm#L38
15:02 jberger do you want me to just do that or should I PR?
15:02 tl joined #mojo
15:02 * jberger is a little skittish after moving too fast on the documentation changes the other day
15:03 jberger nic: you can just do my $url = $c->url_for; $url->query->merge(...);
15:12 jberger TIL: in github, when viewing a code page, you can hit "y" to change the page's url from the generic code page url to a url that points to the page at the current commit
15:13 jberger very nice for using in discussion of code as it exists currently
15:14 nic that's cool
15:18 good_news_everyon joined #mojo
15:18 good_news_everyon [mojo] jberger created data-line-in-error (+1 new commit): https://git.io/v6gpy
15:18 good_news_everyon mojo/data-line-in-error 75b2b9a Joel Berger: close DATA to prevent strange addendum in subsequent error messages
15:18 good_news_everyon left #mojo
15:20 sri jberger: how odd, is that close best practice?
15:20 jberger sri: I just asked in #p5p and three people suggested that almost immediately
15:20 Grinnz_ sri: since it's a global handle it won't close itself, i guess
15:21 jberger sri: opened a PR
15:21 jberger seemed safest
15:21 Grinnz_ .oO(why is DATA so weird...)
15:22 jberger Grinnz_: because DATA is a weird concept
15:22 Grinnz_ true
15:23 pink_mist yeah, I've heard loads of people recommend closing the DATA filehandle
15:25 jberger interesting to note that Mojo::Loader's DATA handle loader doesn't use *DATA
15:25 jberger just fyi
15:25 jberger it only LOOKS that way to the casual observer
15:26 jberger (ok, well it kinda does)
15:29 pink_mist surely it uses the ::DATA handles of the package namespaces it's been told to look in? =)
15:29 jberger ok, I misremembered
15:30 jberger it uses the DATA handle, but it doesn't use the autoseek behavior
15:30 jberger which is much less interesting
15:30 jberger (I thought I remembered it opening a handle to the file in $INC{$module_path})
15:34 Bean joined #mojo
15:35 cafe joined #mojo
15:59 VVelox joined #mojo
16:31 PryMar56 joined #mojo
16:32 Grinnz_ jberger: looks like Mojo::Loader adds it to the error message too after data_section has been called
16:32 Grinnz_ $ perl -MMojo::Loader=data_section -MMojo::SQLite::Database -E'say data_section("Mojo::SQLite::Database", "pubsub"); die foo'
16:33 Grinnz_ but i'm not sure if closing those handles would be safe, they might interfere with something else accessing DATA in the same process?
16:36 Grinnz_ yeah, it does :/
16:39 Grinnz_ https://gist.github.com/Grinnz/f43868279fe553891fe6e3d038193bc7
16:40 Grinnz_ so i'd say it's safe for Mojo::Util where nothing else should ever be reading that section, but not for Mojo::Loader
16:43 dod joined #mojo
16:48 Grinnz_ also lol @ DATA thinking it's at "line 1048" after it's been read twice
16:52 sri Grinnz: starting to hate rated matches in overwatch
16:52 Grinnz_ i'm just glad there's only 7 more days of coin flips
16:52 sri if you play solo the rating basically means nothing
16:54 sri two out of three matches now everybody ignores the objectives and goes dueling with all offensive heroes
16:54 Grinnz_ it's heavily influenced by the luck of your teammates and opponents yes
16:54 Grinnz_ but playing in a group doesn't make it any more correct, just more controllable :P
16:54 Grinnz_ the nature of trying to determine individual skill in a 6v6 game sadly
16:55 sri at rank 35 they are pants on head bad
16:55 Grinnz_ mmmmhm
16:56 Grinnz_ i assume its even worse on EU because people talk less due to language differences
16:56 sri yea, that too, i'm so tired of the french swearing on voice chat
16:58 sri understand now why you see twitch streamers only play in groups of at least 3
16:59 Grinnz_ groups of 3-4 is the sweet spot
16:59 Grinnz_ enough control over the group's tactics, but not facing against other premades of 6
16:59 sri hope this doesn't kill the game, losing in rated takes so much time for no reward
17:02 Grinnz_ i think they mentioned they were looking into a quickplay mode with 1 hero limit, that would be neat so i could quickplay without the stupid 6 dva teams
17:03 Grinnz_ ah yes http://us.battle.net/forums/en/overwatch/topic/20747686209#post-16
17:14 sri guess i'll try the us server
17:22 meshl joined #mojo
17:57 abra joined #mojo
18:13 ptolemarch joined #mojo
18:33 mcsnolte joined #mojo
18:48 Bean_ joined #mojo
18:53 Grinnz sri, https://www.youtube.com/watch?v=Nqh8tnHhIjg interesting info on how season 2 will work
18:56 bwf joined #mojo
18:57 dod joined #mojo
19:12 Grinnz https://www.reddit.com/r/Overwatch/comments/4xum52/developer_update_upcoming_season_2_changes/d6ill6y summary of video
19:15 sri Grinnz: just played a few matches on us, and it's soooo much better
19:15 sri guess eu has a huge language problem
19:16 Grinnz there are exceptions but the games that go well are more often the ones with positive communication
19:17 sri i mean, you've got way more edge lords, but people actually understanding the game seems worth it ;p
19:17 Grinnz a good reaper is helpful anyway ;)
19:17 mauke die die die;
19:17 Grinnz but yeah theres always the guys who are cussing out whoever they think is to blame too
19:18 Grinnz thats when you just block them and do your best and accept the loss
19:19 Grinnz just be glad you're not playing on console, they have it even worse
19:20 Grinnz there is no text chat, and no in game method to block or report players
19:20 sri ouch
19:21 sri guess tracer might actually be my main hero, so much fun
19:22 Grinnz i played her a lot starting out, havent much lately but i should
19:23 sri also like genji, but he seems a little overpowered
19:24 Grinnz i read a pretty good description of genji's position, if the genji is higher skill than the opponents he can dominate but if he is lower skill he is basically useless
19:25 Grinnz because he dies so easily and his tools are tricky to make work
19:26 sri even a beginner can get pretty far with hopping around and holding the right mouse button though :)
21:11 marty joined #mojo
22:12 daemonic joined #mojo
22:14 bpmedley_ joined #mojo
22:32 sri Grinnz/jberger: so, closing DATA in Mojo::Util makes no sense because the warnings will come from Mojo::Loader then?
22:32 Grinnz_ only if data_section is used; the warnings come from Mojo::Util by simply having the module loaded
22:33 sri i take that as a yes ;p
22:41 sri anyway, i'm -1 until the Mojo::Loader question has been resolved
22:41 sri whole thing seems very sketchy
22:42 sri re #988, think i'll give it a +1 if the implementation is clean https://github.com/kraih/mojo/issues/988
22:42 sri like one line of new code, that seems worth it
22:42 sri if it's less code than now i'll definitely give it a +1 ;p
23:20 zivester joined #mojo

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