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

IRC log for #mojo, 2017-12-19

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

All times shown according to UTC.

Time Nick Message
00:40 CandyAngel This server coding is make me le sad
00:41 CandyAngel So sad, I can't english
00:42 jberger https://www.youtube.com/watch?v=Dc01V_mygzg
00:44 CandyAngel :P
00:59 genio joined #mojo
01:03 mohawk true story
01:05 aborazmeh joined #mojo
01:07 jberger SUIT UP!
01:20 CandyAngel Basically, I implemented the moving between the rooms.. and it kind of works, but not properly :P
01:20 CandyAngel Rather than seamlessly moving from one room to the next, you teleport away, then teleport back :|
01:22 CandyAngel Oh well.. will have another go tomorrow
01:22 CandyAngel Night everyone1
01:33 mohawk_pts have a good one
03:16 jberger hmmm, is there a typo in http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Making-your-application-installable
03:16 jberger is there a sibling method in Mojo::Home?
03:17 jberger bah
03:17 jberger nm
03:17 jberger sorry
03:23 mishantil joined #mojo
03:25 Grinnz srezic's broken smokers are starting to get real annoying http://www.cpantesters.org/cpan/report/5ac3ec6c-e3c5-11e7-9886-cee857f23fda
03:28 mishanti1 joined #mojo
03:34 Grinnz this one also doesnt make any sense http://www.cpantesters.org/cpan/report/5195e6e7-6c0a-1014-b6f2-4a4beeb41b89
04:30 Ya_ALLAH joined #mojo
04:30 Ya_ALLAH >>> youtube.com/watch?v=X8qL6cAI0zQ <<<
04:30 Ya_ALLAH left #mojo
04:41 Sebbe joined #mojo
05:33 jamesaxl joined #mojo
05:38 jberger https://twitter.com/joelaberger/status/942992444483866624
05:40 jberger scratch that, typo
05:40 jberger https://twitter.com/joelaberger/status/942992992645902337
05:41 Grinnz dunno if it's worth mentioning that the normal non-heuristic way to use it is just to use File::ShareDir in the code and Test::File::ShareDir in the tests
05:42 jberger that assumes that you don't actually run the application locally at all?
05:42 Grinnz right, i guess that's more complicated if you want to run it outside of tests
05:42 jberger kinda a non-starter (hehe) for me
05:42 Grinnz I've not distributed anything executable with a sharedir
05:43 jberger really, I have several
05:43 jberger s/,/?/
06:46 inokenty-w joined #mojo
06:46 Vandal joined #mojo
07:17 dod joined #mojo
07:22 jkp joined #mojo
08:07 dod1 joined #mojo
08:16 McA joined #mojo
08:20 AndrewIsh joined #mojo
08:30 trone joined #mojo
09:03 rcz Is there some simple way of adding "rules" to controller routes? Eg. some routes will run a login check before executing - (like middleware in php Laravel if anyone knows that)
09:07 mfontani you can group controllers "under" a route, and apply logic to that route
09:08 mfontani https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Routing.pod#Under
09:08 mfontani the "/blackjack" example seems similar to what you say you're looking for
09:08 rcz mfontani: Thank you, exactly what I was looking for
09:09 Ya_ALLAH_Ya_Muhmd joined #mojo
09:09 Ya_ALLAH_Ya_Muhmd youtube.com/watch?v=X8qL6cAI0zQ
09:09 Ya_ALLAH_Ya_Muhmd left #mojo
09:16 CHYC joined #mojo
09:27 jamesaxl joined #mojo
09:39 mohawk_pts joined #mojo
09:58 dod joined #mojo
10:41 itaipu joined #mojo
10:50 dustinm joined #mojo
10:52 itaipu joined #mojo
10:55 perlpilot_ joined #mojo
11:45 mohawk jberger, nice blog post! typo: "seveal"
11:49 mohawk jberger, i'd like there to be an openapi blog post that i can then follow up with converting to graphql
11:50 mohawk batman, do you mind if i copy and then edit your blogpost as discussed previously?
11:51 batman mohawk: yeah, a bit... i was thinking i would take a swing at it later tonight, if jberger still wants it
11:52 mohawk oh no!! less work for me? oh ok then ;-)
11:52 batman haha :D
11:52 batman i just looked over it and there are many things i want to improve.
11:52 mohawk jberger, do you still want it? (i'm bearing in mind it's early in day for him but he can see this when he connects)
11:53 mohawk batman, ha ha! no time like the present :-)
13:03 Leffe joined #mojo
13:08 Leffe joined #mojo
13:09 mkrull joined #mojo
13:16 cascardo joined #mojo
13:23 jberger I'm game for all of the above
13:23 CandyAngel Morning jberger
13:23 jberger One thing though, I've given one slot away already
13:23 mohawk morning dude
13:23 jberger o/
13:24 mohawk batman, that's your "go" signal :-)
13:24 mohawk jberger, what's the remaining slots and so on?
13:24 CandyAngel If it's mine, I don't mind giving it up for a more on-topic/better written post :P
13:24 jberger So with only 5 days left and 3 purposed contributed articles, there isn't much time left
13:24 CandyAngel I can submit mine later
13:25 jberger CandyAngel very kind of you, but if you want it, you were in line first
13:25 sri that's a nice problem to have :)
13:25 jberger sri it certainly is
13:25 sri (speaking as a former perl calendar cat herder)
13:25 mohawk if batman is willing, i could contribute the end of his openapi thing: "and now you can even also add a graphql endpoint (here's how)!"
13:26 mohawk and in fact, that might work well - batman, what do you think?
13:27 CandyAngel jberger: I'd imagine people would find mohawk's more useful
13:27 sri and don't forget, on the 26th mojolicious has its 7th birthday
13:30 tchaves joined #mojo
13:33 mohawk sri, you have to make a post for that :-)
13:33 mohawk CandyAngel, i'm actually concerned that mine might not justify a full post. it's up to batman of course
13:34 sri and it's almost been 1.5 years since our last major release :o
13:37 jberger sri shoot that reminds me
13:37 jberger I haven't gotten to fixing all my cpan modules for the delay change yet
13:38 jberger Can I get a heads up on when that goes?
13:38 jberger I've been a little busy as you know
13:50 CandyAngel mohawk: No worries. Aiming to finish my article tonight anyway.. just need to change the code so sri doesn't kill me :)
13:51 CandyAngel So we can just see how it goes
13:58 rcz I can't figure out how to use the config plugin. I placed a $moniker.conf (resolved to skywalker.conf) in my app's root, and I tried accessing it with $self->app->config->{key} and config 'key', but they're just undefined. Do I need to enable or initialize the plugin somehow?
13:59 ChmEarl joined #mojo
14:17 kes joined #mojo
14:27 kes hm... helper says 'button_to' but actually it is <input> tag. Would it be better to render right tag "<button/>"?
14:39 Leffe joined #mojo
14:50 gizmomathboy joined #mojo
14:52 jberger rcz do you actually load the plugin?
14:52 jberger (just checking to be sure)
14:52 jberger and are you sure that the application thinks its moniker is skywalker?
14:52 jberger can check with the eval command
14:55 sri considering that the plugin dies if it can't load the file that seems unlikely
14:55 jkp joined #mojo
15:07 Pyritic joined #mojo
15:20 Leffe joined #mojo
15:24 jabberwok joined #mojo
15:28 rcz jberger: probably not, I figured it was listed under default plugins and thus was loaded by default
15:31 jberger hmmmm, is there a list of the plugins loaded by default
15:31 jberger I think I recall there being something ...
15:31 * jberger looks
15:31 jberger ah
15:31 jberger http://mojolicious.org/perldoc/Mojolicious/Plugins#PLUGINS
15:32 jberger that's not a very prominent place to put it
15:32 jberger linked to from http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Adding-a-plugin-to-your-application which is almost the end of the guides
15:34 rcz I see. I misunderstood the docs. Those plugins are just plugins that ship with Mojo, they aren't enabled. I didn't come across $self->plugin('PluginName') anywhere though, but it works now! :)
15:49 geospeck joined #mojo
15:50 gryphon joined #mojo
16:39 sh14 joined #mojo
17:12 Grinnz yes only DefaultHelpers/TagHelpers and the renderers are loaded by default (and i guess HeaderCondition but that's rather specific to if you're using conditions)
17:15 dod joined #mojo
17:20 disputin joined #mojo
17:47 ghenry joined #mojo
19:08 itaipu joined #mojo
19:23 karjala_ joined #mojo
20:09 Leffe joined #mojo
20:27 berov joined #mojo
20:32 preaction how can i make a redirect from "/docs" to "/docs/"?
20:35 preaction whenever i try, it seems mojolicious always normalizes the url to "/docs", making an infinite loop
20:36 jberger $url = $c->req->url; $url->path->trailing_slash(1); $c->redirect_to($url)
20:36 jberger ?
20:37 Grinnz unless $c->req->url->path->trailing_slash
20:38 Leffe joined #mojo
20:39 jberger nothing wrong with setting it if it is already set, I don't think
20:40 jberger to make it a single line, tap!
20:40 jberger eh, maybe not
20:40 Grinnz jberger: to prevent infinite loops
20:40 jberger oh, I see what you mean
20:41 jberger you'd have to clone the url then too
20:41 jberger or capture the trailing slash state first
20:41 pink_mist do { $url->path->trailing_slash(1); $c->redirect_to($url); } unless $url->path->traling_slash;
20:42 jberger do/unless?! ewwwww
20:42 jberger (plus it would need a return in there too presumably)
20:42 pink_mist only as much as your version would, no?
20:43 jberger sure, though I wasn't solving that problem at the time
20:43 jberger Grinnz added the unless :-P
20:46 preaction https://gist.github.com/preaction/a240c2bcf38883afce95a47e8b5179b3 <- this still gives me "too many redirects"
20:48 pink_mist well you're not actually doing what was suggested
20:49 preaction well, i think i am, so perhaps you could point out how i am not
20:49 jberger preaction: use the actual object
20:49 pink_mist preaction: you're never setting ->trailing_slash to 1
20:50 jberger pink_mist: he's appending a '/' in the string
20:50 preaction pink_mist: i'm adding a literal trailing slash to the string
20:50 pink_mist I don't see how that's relevant
20:50 jberger pink_mist ?
20:50 purl i heard pink_mist was absolutely correct
20:50 pink_mist but ok
20:50 jberger can it purl
20:53 preaction okay, so i also can't add ?url=/v3 in the query string via redirect_to either
20:55 preaction https://gist.github.com/preaction/a240c2bcf38883afce95a47e8b5179b3 <- this works and only this works
21:00 preaction because the arguments to redirect_to() get passed to url_for() which sees a Mojo::URL object and returns it instead of creating a new one (and always setting the trailing slash to 0)
21:01 pink_mist see, I was right
21:03 preaction it doesn't matter if you're right if you're not being helpful
21:04 Grinnz i assumed thats the only reason he was telling you to make a Mojo::URL object
21:04 pink_mist I literally gave you half your solution, if you want to call me not helpful, that's up to you, but I think I was plenty helpful
21:05 preaction nobody said i _had_ to make a Mojo::URL object, and everything in the docs says i can use a string. in fact, since the docs never say i can use a Mojo::URL object, it made it seem like it'd simply be converted to a string
21:06 preaction your comment assumed that i was ignoring the advice given to me, instead of that i was using it
21:06 jberger pink_mist: who gave the solution?
21:07 pink_mist jberger: he didn't listen the first time, I pressed the issue
21:08 pink_mist jberger: and just because I wasn't first with giving it doesn't mean I never gave it
21:08 jberger I don't even know how to respond to that, but it is unseemly and I don't want to continue with it
21:09 preaction i thought i was asking "how do i correctly detect a redirect loop and stop it" because i had never thought that my redirect location could be wrong
21:09 preaction so trailing_slash is how to detect the loop. and then i did that. and then it still didn't work.
21:15 trone joined #mojo
21:17 Leffe joined #mojo
21:21 Leffe joined #mojo
21:30 Leffe joined #mojo
21:51 berov If I want to find if a helper is available is the following the proper way to check? $app->renderer->get_helper($method);
21:52 berov or how is best to do it?
22:01 disputin joined #mojo
22:07 sri we ave a perl puzzle for everyone https://github.com/kraih/mojo/pull/1171
22:07 sri keep the role code together in one block, and add less lines of code
22:07 sri i bet there's cleaner solutions than those two
22:08 sri i'm fine with the tests
22:09 Grinnz you could move the ROLES check down to the bottom block but then you still need to keep -role out of the load-a-base-module condition
22:14 sri well, technically jberger's solution only adds 2 lines, if you properly format the if (...) { eval "..." }
22:14 arcanez is there a guide for promises? or just `perldoc Mojo::Promise`?
22:15 sri some examples in the guides, no guide
22:15 jberger sri: putting the conditional and the eval on the same line makes 86 chars
22:16 sri switch the condition :p
22:17 Grinnz also you don't need "unless $flags[0] eq '-role';" anymore since that's already excluded from that branch
22:17 Grinnz oh, you dont have it in your patch, it just wasnt changed in the pr
22:18 Leffe joined #mojo
22:20 geospeck joined #mojo
22:22 sri arcanez: opened an issue for it https://github.com/kraih/mojo/issues/1172
22:22 jberger I might have it
22:25 disputin joined #mojo
22:28 jberger http://paste.debian.net/1001571/
22:28 Grinnz ooh, i like that better
22:29 jberger maybe the regex is going to be slow, maybe substr
22:29 Grinnz doubt there would be much difference with a regex as simple as that tbh
22:30 Grinnz thats about as optimal for the regex engine as possible
22:31 Grinnz it does need to check that $flags[0] is actually populated first, though
22:31 Grinnz oh, maybe not
22:31 Grinnz that was just because the -strict case undef'd it
22:31 Grinnz no it wasnt, thats the same elsif chain
22:32 Grinnz so i guess that was just checking that its not '' or '0'?
22:33 jberger http://paste.debian.net/1001573/
22:34 Grinnz honestly i think the logic reads better if you keep it as 'if' and invert the conditions
22:35 Grinnz then you can put $flags[0] && first
22:40 arcanez sri: I trawled the git commit history and saw that you added some examples, but it looks like something like Mojo::Redis2 would have to add support to use them
22:47 itaipu joined #mojo
22:50 jberger I don't think it needs a check for !!flags[0]
22:50 jberger the existing code would already warn for that
22:51 jberger so sri, do you like either of those?
22:57 karjala_ joined #mojo
23:04 Leffe joined #mojo
23:07 Grinnz jberger: use Mojo::Base undef; will throw an exception when it tries to call ->can on it
23:07 Grinnz also, code will not usually have warnings enabled yet
23:08 Grinnz i guess it would be the warnings in the Mojo::Base scope so nevermind
23:09 Grinnz also, use Mojo::Base '' will result in it trying to require '.pm'
23:10 Grinnz most other ways of loading a module would guard against that being attempted
23:48 SpringBoot joined #mojo
23:48 SpringBoot Spring Boot 2.0 is so much better than this  mojo...
23:49 Grinnz do you even know what mojolicious is?
23:51 SpringBoot it's a web framework
23:51 SpringBoot so I can compete it
23:51 Grinnz good luck with that
23:51 purl SOL loser!
23:53 SpringBoot enlighten me..Gods  of an ancient framework
23:53 Grinnz 'ancient', hah
23:54 Grinnz you havent heard of catalyst have you?
23:54 SpringBoot I did
23:55 pink_mist I don't even see spring boot on the techempower web framework benchmarks
23:55 pink_mist there's a spring
23:55 pink_mist is that what you mean?
23:56 pink_mist but spring is in java, so how is that relevant to a perl web framework?
23:57 sri meh, we've had better trolls
23:58 sri even in the catalyst days
23:58 SpringBoot Spring Boot is based on top of Spring and it has that  magic called "auto-configuration".
23:59 sri you just have to sign over your soul to larry ellison
23:59 pink_mist mojolicious beats spring in 4 out of 6 of the benchmarks
23:59 pink_mist so, so much for being "much better"
23:59 jberger but it is using Spring, so its Java, and I'm not interested. not a criticism, use whatever you like

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