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

IRC log for #mojo, 2016-01-15

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

All times shown according to UTC.

Time Nick Message
00:00 sri i guess full circle visible wins
00:07 melo2 joined #mojo
00:15 melo joined #mojo
00:21 melo joined #mojo
00:29 sri hope i don't get kicked off the site right away... i added a shitty version of the basic logo just to test the stickermule process
00:29 sri the site is not great
00:30 melo1 joined #mojo
00:31 sri you have to upload the image in photoshop format, and give the exact size for the final sticker in inches :S
00:35 sri went with this one for now https://imgur.com/EA4Ml4q
00:37 disputin joined #mojo
00:38 disputin joined #mojo
00:52 kablamo joined #mojo
00:57 good_news_everyon joined #mojo
00:57 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://github.com/kraih/mojo/commit/68b9ab4100cbf11d18de71db07ad5a4da6da7f63
00:57 good_news_everyon mojo/master 68b9ab4 Sebastian Riedel: improve check method in Mojolicious::Validator::Validation to die more gracefully if a check is missing
00:57 good_news_everyon left #mojo
01:01 vanHoesel joined #mojo
01:06 lsm joined #mojo
01:09 melo joined #mojo
01:10 zivester joined #mojo
01:13 melo1 joined #mojo
01:40 disputin joined #mojo
01:48 melo joined #mojo
02:18 melo joined #mojo
02:25 binlei joined #mojo
02:32 melo joined #mojo
02:46 melo joined #mojo
02:57 KindOne joined #mojo
02:59 sri oh, that one got approved fast
02:59 sri width is 6.4" though, that's a bit big
03:00 sri think i'll request resizing to 4"
03:20 binlei joined #mojo
03:33 sri so, i guess bitcoin is over :o https://medium.com/@octskyward/the-resolution-of-the-bitcoin-experiment-dabb30201f7#.rr2r3vcp8
03:44 cfedde must not click link....
03:52 noganex_ joined #mojo
03:53 melo joined #mojo
04:23 c--_ joined #mojo
04:55 melo joined #mojo
04:59 mtj joined #mojo
05:11 jberger sri: wow
05:11 jberger I'm glad I don't own any of that mess
05:12 jberger It's there anywhere I can short BTC?
05:20 melo joined #mojo
05:21 binlei joined #mojo
05:28 inokenty-w joined #mojo
05:31 Shaeto joined #mojo
05:49 sri guess i'm screwed with my 0.0x BTC ;p
05:50 Adura There's means of shorting them, sure.
05:51 * sri has no idea how to turn the raptor and pirate cloud into stickers yet
06:20 genio joined #mojo
06:26 infinitygone joined #mojo
06:27 infinitygone left #mojo
06:29 binlei joined #mojo
06:34 sri batman: btw. i don't agree about die not being very mojolicious, there's so many cases where we actually do
06:34 sri especially if stuff is missing, like plugins, commands...
06:35 sri it is true that we pretty much never check function/method arguments
06:35 sri but that's mostly because it's so crazy expensive to do it consistently
06:36 sri if perl had cheap and optional type annotations built-in, you bet i would use them everywhere!
06:38 batman sri: yeah, you're right.
06:44 batman You could just skip the test here as well and let it die with "can't call...on undefined value"
06:55 cpan_mojo App-mojopaste-0.18 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/App-mojopaste-0.18
07:00 sri maybe you're right, and those friendly errors are too much
07:01 binlei joined #mojo
07:06 good_news_everyon joined #mojo
07:06 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://github.com/kraih/mojo/commit/bdbb85c24e5e61472fb43168619ab1f0b47a5183
07:06 good_news_everyon mojo/master bdbb85c Sebastian Riedel: die a little less friendly
07:06 good_news_everyon left #mojo
07:06 sri they should die though
07:11 dod joined #mojo
07:12 batman :)
07:17 dod joined #mojo
07:21 sri the first sticker is up!
07:21 sri https://www.stickermule.com/marketplace/10014-mojolicious-night-sky
07:27 sri 4" x 1.39" should be reasonable
07:40 binlei joined #mojo
07:52 osfabibisi joined #mojo
08:00 binlei joined #mojo
08:08 binlei joined #mojo
08:11 Vandal joined #mojo
08:14 jzawodn joined #mojo
08:22 AndrewIsh joined #mojo
08:32 trone joined #mojo
08:36 odc joined #mojo
08:49 Jonis sri: failraptor would make an awesome sticker :D
08:54 binlei joined #mojo
09:11 berov joined #mojo
09:14 kes joined #mojo
09:33 jontaylor joined #mojo
09:50 binlei joined #mojo
10:13 punter joined #mojo
10:47 berov1 joined #mojo
11:04 melo joined #mojo
11:27 kaare joined #mojo
11:28 ZoffixWin joined #mojo
11:30 jwang joined #mojo
11:43 HtbaaPi joined #mojo
12:01 neilhwatson joined #mojo
12:28 melo joined #mojo
12:30 Shaeto left #mojo
12:48 sue joined #mojo
13:04 ajr_ joined #mojo
13:31 bpmedley joined #mojo
13:34 binlei joined #mojo
14:17 asarch joined #mojo
14:18 zivester joined #mojo
14:23 vicash hello. what is the advantage of using the %= csrf_field  in a form ?  How does this differ from the various CSRF defending Mojo plugins ?
14:24 ashimema probably a daft question and will highlight my ignorance.. but whats the difference between using a 'before_dispatch' hook and an 'after_dispatch' hook vs's using an 'around_dispatch' hook?
14:25 ashimema was reading this for inspiration: https://github.com/cybersiddhu/Mojolicious-Plugin-Caching/blob/master/lib/Mojolicious/Plugin/Cache/Action.pm and wondered this question
14:25 bpmedley ashimema : https://metacpan.org/pod/Mojolicious#after_dispatch <-- Have you seen these in the documentation?
14:26 ashimema indeed.. been reading that page..
14:26 ashimema but am still kinda confused ;)
14:28 bpmedley My understanding is that after_dispatch will run after the current controller is done.
14:29 binlei hello, does anyone know how to emit a hash?
14:30 bpmedley ashimema : May be easer to work with a smallish example.  What do you need the hook(s) to do?
14:30 binlei I got this
14:30 binlei HASH(0x7fa613005728)
14:30 bpmedley binlei : You may need to use references - that's a guess without seeing your code.
14:32 binlei ok append a %, it works
14:32 ashimema it's more of a learning exercise at the moment.  I'm basically attempting to add a bit of caching to one of my more expensive routes.
14:34 ashimema in this case.. it's one of the swagger created routes (using the swagger2 plugin) and I'm wanting to catch the request after it's been validated by the swagger piece.. render without hitting the controller (and thus the validator) if the response is cached.. or hit the controller and cache the reponse before rendering it if there's not a cache yet
14:35 batman vicash: it works together with $c->validation
14:36 batman It = csrf
14:37 sue joined #mojo
14:38 batman vicash: https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Rendering.pod#Cross-site-request-forgery
14:38 vicash thanks batman
14:39 batman You're welcome:)
14:40 bpmedley ashimema : Why not just use the Mojolicious::Plugin::Cache::Action.pm code as a guide?  Why do you need around_dispatch?
14:42 ashimema mostly I'm getting slightly confused by the interplay between the swagger stuff and this plugin ;)
14:42 ashimema and.. I've probably mis-designed my api a little for that plugin to work out of the box ;)
14:43 ashimema the particular request I want to cache needs path + params + a header to be able to distinguish it
14:44 ashimema gonna go write myself some tiny test scripts.. would be good for me to get my head around (no pun intended) around,before and after hooks anyways ;)
14:45 bpmedley ashimema : I see, you want to use https://metacpan.org/pod/distribution/Swagger2/lib/Swagger2/Guides/ProtectedApi.pod#Around-action-hook with a cache?
14:47 ashimema :)
14:47 ashimema exactly
14:47 ashimema I'm already using the hook for authentication/authorization and adding of some headers
14:47 ashimema so it seemed the logical choice
14:48 bpmedley Are you only caching JSON?
14:48 ashimema it's kinda feeling like it's more of a 'before'
14:48 ashimema yes, just json
14:53 ashimema Aha..
14:54 ashimema I am daft.. I now see exactly why I was falling myself into thinking the swagger around action hook was a before not an around.
14:55 ashimema I was calling 'return $next->($c)' which of course 'returns' the routine on $next->($c) completion.. so my code after calling $next->($c) was never going to run..
14:55 ashimema hence in effect turning the around into a before!
15:02 vanHoesel joined #mojo
15:03 bpmedley ashimema : Cool, glad it works for you
15:05 ashimema well..
15:05 ashimema my understanding is moving forward at least ;)
15:07 bowtie joined #mojo
15:08 ashimema I'm still slightly confused.. is the call to $next->($c) async in general?
15:08 Grinnz no, if there's an async action it will return with the callback still in the event loop
15:09 ashimema time for another test script to help my understanding here then
15:10 ashimema currently.. i'm dumping a warn in before and after my $next->($c).. those are both firing before the call to the controller
15:10 ashimema all.
15:11 ashimema this is only wrapping the swagger validation of the request object
15:11 ashimema not what I thought.. I thought it was wrapping the whole sequence.. i.e validate_request->controller->validate_response
15:12 ashimema thankyou so much everybody.. you've been great help :)
15:14 Grinnz not sure how swagger works, but if its validation is an async action, that sounds right
15:24 ashimema yup: https://github.com/jhthorsen/swagger2/blob/master/lib/Mojolicious/Plugin/Swagger2.pm#L192-L199
15:24 ashimema I think that proves itself to me now
15:24 ashimema So.. was all my total misunderstanding of what x-mojo-around-action meant
15:24 Alexando joined #mojo
15:37 disputin joined #mojo
15:37 bpmedley joined #mojo
15:38 disputin joined #mojo
15:40 mtths joined #mojo
15:41 berov joined #mojo
15:41 disputin joined #mojo
15:41 berov left #mojo
15:44 berov joined #mojo
15:51 GabrielVieira joined #mojo
16:18 sri Jonis: maybe, but i think i'll turn the normal perl5 raptor into a sticker next
16:31 zivester joined #mojo
16:52 Kogurr joined #mojo
16:55 good_news_everyon joined #mojo
16:55 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://github.com/kraih/mojo/commit/633e657e59c7052eb60ec9405e4351e2c9791894
16:55 good_news_everyon mojo/master 633e657 Sebastian Riedel: mention all arguments
16:55 good_news_everyon left #mojo
16:59 punter joined #mojo
17:02 good_news_everyon joined #mojo
17:02 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://github.com/kraih/mojo/commit/c1b77d6ad67d53b820d69685c8840bfdcff65082
17:02 good_news_everyon mojo/master c1b77d6 Sebastian Riedel: render something too
17:02 good_news_everyon left #mojo
17:03 bowtie joined #mojo
17:14 dod joined #mojo
17:20 disputin joined #mojo
17:32 punter_ joined #mojo
17:34 batman around_action hook has completed way before render() if render() is called from $c->delay(...), right..?
17:36 punter__ joined #mojo
17:48 bowtie joined #mojo
17:49 batman sri: should before_routes be called even if $res->code is set? https://github.com/kraih/mojo/blob/master/lib/Mojolicious.pm#L109
17:49 PryMar56 joined #mojo
17:49 sri batman: dunno
17:49 ajr_ joined #mojo
17:53 batman i wonder if it should just return after before_dispatch if $tx->res->code is set
18:19 sri batman: don't think i actually care
18:19 batman :)
18:28 Alexando joined #mojo
18:33 cstamas joined #mojo
18:35 Alexando I think I'm a little confused.  Is there a way to load a different controller from within a controller action?  e.g. $r->get('/')->to('controller#foobar');, then in sub foobar { ... some logic .. simulate_route->to('othercont#othersub'); }
18:38 genio I'm not quite sure why you'd need to load a completely separate controller.  What's your end goal and will a normal redirect not work for you?
18:40 Alexando I'd rather not present the redirect to the user.  Example scenario: / will either show Login#default if no session, or Profile#default if a valid session exists
18:40 Alexando Which obviously will work under /login and /profile respectively
18:41 Alexando But I'd prefer to keep / as / without redirecting elsewhere
18:42 sri that's not RESTful, so we don't support it natively
18:43 Alexando Is there a way to do that, though?
18:43 sri many
18:43 Alexando Any good examples you can provide, please?
18:44 sri to me it's all just hacks
18:44 Grinnz_ usually it's best to extract the common code to a helper or module function
18:45 Grinnz_ a helper gets the controller parameter by default, and a module function can too
18:48 Alexando by module, you mean a typical Perl package, yeah?
18:49 Grinnz_ right.. up to you how to set it up
18:50 Alexando Are you referencing something specific to Mojo, or just in general?
18:51 Grinnz_ helpers are a mojo thing; module functions are general
18:51 Alexando So, REST arguments aside, what would you recommend as the best approach to handle this use case?
18:52 Grinnz_ whatever helps you organize the code better in the long run
18:52 Grinnz_ note helpers can be defined in startup, in a plugin you load from startup, etc...
18:55 zivester joined #mojo
18:55 trone joined #mojo
18:58 sri lol, only 3 stickers sold
18:58 sri maybe i'll wait with more ;p
19:18 cstamas joined #mojo
19:23 bowtie_ joined #mojo
19:25 jberger sri: hold your horses, I haven't even had time to make an account
19:25 jberger :-P
19:26 jberger also I was actually thinking of waiting to get a spread
19:50 neilhwatson joined #mojo
19:50 sri ;p
19:51 sri maybe someone here cares about this? https://github.com/kraih/minion/issues/20
20:02 bowtie joined #mojo
20:17 mad_hatter joined #mojo
20:17 mad_hatter hey folks...is there a way to present robots.txt without passing it to mojolicious?
20:18 Grinnz_ put it in public/ or have your reverse proxy serve it statically
20:30 punter joined #mojo
20:39 kyshtynbai joined #mojo
20:46 dod joined #mojo
21:12 bowtie_ joined #mojo
21:22 punter joined #mojo
21:27 sri this would have been a really nice perl6 sticker http://38.media.tumblr.com/98643f635bf5e6e35697d7f5bb122f1d/tumblr_inline_miajuxmvBr1qz4rgp.png
21:42 sri guess the perl5 sticker could look something like this https://imgur.com/WZdpuSL
21:43 jberger <bikeshed>could the 5 be more ... attached ... than that</bikeshed>
21:43 jberger I don't mean spacing, I mean cutaway
21:43 jberger generally, and even with the cutaway, that's awesome
21:44 jberger the serifs are a little odd maybe
21:44 punter joined #mojo
21:45 sri the serifs are awesome
21:45 cstamas_ joined #mojo
21:47 sri jberger: what do you mean with more attached?
21:48 jberger the serifs are growing on me
21:49 jberger hmm, and maybe I'm changing my mind ont the cutaway too
21:49 sri the typeface is called "the mix", the serifs are a classic
21:49 jberger i didn't see how deep the cut goes in between the "r" and the "l"
22:01 zivester joined #mojo
22:02 sri maybe i'll just try submitting the base image without the background and let them figure it out :)
22:14 sri you know what, i don't care how much of those stickers will sell, i love it :)
22:15 sri (the mojolicious night sky one)
22:16 sri hope the print quality is as good as they make it look
22:23 punter I think I discovered a bug: If I shutdown hypnotad while there are still Mojo::IOLoop->next_tick subs in the queue, hypnotoad will shutdown before they are executed. Is that a bug?
22:25 sri shut down how?
22:25 punter hypnotoad -s app.pl
22:26 jberger punter: if I had a 3 hour timer, should it wait for that?
22:26 jberger next_tick is just a 0s timer
22:26 sri ah right, timers don't count for graceful shutdown, only open connections
22:27 jberger sri if you add the perl5 sticker I'll put in an order
22:27 punter I use next_tick as a "cleanup phase". Cleanup is kindof important
22:28 jberger I was waiting to get a few once there were a few to choose from, but even those two are worth it
22:28 sri hmm, this is what stickermule made of it https://imgur.com/lMEgiXp
22:29 jberger that's actually closer to what I was asking for
22:29 jberger though that's gone further than I would have said
22:30 sri really? you like that more?
22:31 cstamas joined #mojo
22:31 sri i mean, it is a small sticker... 4" x 1.45"
22:31 jberger I mean, they took it too far
22:31 jberger I'd wish there was a little more cut in between the l and the 5
22:32 jberger but less than your original
22:32 jberger total bikeshedding I admit
22:32 Grinnz_ time to get the scissors
22:32 jberger Grinnz_: no running with scissors!
22:33 Grinnz_ http://24.media.tumblr.com/tumblr_m0bwlfhSh91qg8cumo1_250.gif
22:34 orev joined #mojo
22:36 sri hmm, my impartial reviewers say it's ok, no need to cut off more
22:37 cstamas joined #mojo
22:39 sri honestly, i'm not sure how they could cut off something there
22:40 sri i mean, you can't just make a cut like this https://imgur.com/FUdNZvM
22:40 Grinnz_ too bad
22:40 sri corners on both side (l and 5) are sharp
22:42 sri side note, i love affinity designer, best vector editor i've used yet
22:43 sri jberger, Grinnz: or do you have any ideas for how to make a cut there?
22:45 cstamas joined #mojo
22:46 jberger no idea, I've never used any tools like that
22:46 kaare joined #mojo
22:47 sri allright, i'll approve that one :)
22:48 sri https://www.stickermule.com/marketplace/10030-perl-raptor
22:48 kaare joined #mojo
22:51 sri oh, i can't add more stickers
22:51 sri so that will have to be it for now
22:51 Grinnz_ whaat
22:52 Grinnz_ they limit you to 2?
22:52 sri i had 3 tries, and wasted the first for a test (without knowing)
22:52 Grinnz_ huh
22:52 sri guess i have to sell more to get more slots
22:54 jberger what would happen if you wasted three on testing?
22:56 disputin joined #mojo
22:57 sri no stickers i guess ;p
22:57 disputin joined #mojo
22:57 Grinnz_ new account lol
22:59 sri https://www.stickermule.com/user/1070707933/stickers
23:00 sri whole thing is a little clunky, you also can't have multiple sizes
23:01 jberger sri: there's a few more sold for ya
23:02 sri \o/
23:03 sri those likes are actually valuable it seems, they make you rise in the marketplace rankings
23:46 jberger Maybe people could sign in (you can use Google if you want) and simply like those stickers, nudge nudge
23:46 jberger Maybe that would open more slots for more stickers?
23:48 sri dunno, looked through the FAQ, but couldn't find anything
23:55 jberger Gahhhh the subtle p6 jibs keep coming
23:55 jberger I'm doing my best
23:59 sri lol

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