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

IRC log for #mojo, 2015-12-22

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

All times shown according to UTC.

Time Nick Message
00:00 henq joined #mojo
00:04 hgichon joined #mojo
00:08 meshl joined #mojo
00:14 crux joined #mojo
00:32 sugar joined #mojo
00:39 lsm joined #mojo
01:20 cpan_mojo Mojolicious-Plugin-FormValidatorLazy-0.03 by JAMADAM https://metacpan.org/release/JAMADAM/Mojolicious-Plugin-FormValidatorLazy-0.03
01:23 lsm joined #mojo
01:26 lsm joined #mojo
01:46 lsm joined #mojo
02:06 witch joined #mojo
02:30 asarch joined #mojo
02:40 kaare joined #mojo
03:22 noganex joined #mojo
04:32 damaya joined #mojo
04:42 inokenty-w joined #mojo
04:48 irqq joined #mojo
05:34 melo joined #mojo
06:21 Vandal joined #mojo
07:51 cfedde joined #mojo
08:13 osfabibisi joined #mojo
08:19 eseyman joined #mojo
08:32 trone joined #mojo
08:49 crux joined #mojo
10:45 irqq joined #mojo
10:49 meshl joined #mojo
11:17 dvinciguerra joined #mojo
11:22 CandyAngel Does Mojolicious have a mascot sort of thing?
11:23 Adurah Austin Powers.
11:34 melo joined #mojo
11:56 irqq joined #mojo
12:05 neilhwatson joined #mojo
12:55 kaare joined #mojo
13:37 batman Adurah: is it?
13:37 batman I don't think so...
13:37 damaya joined #mojo
13:45 punter joined #mojo
14:12 jberger CandyAngel: the cloud
14:13 jberger Plus there is a strong undercurrent of futurama involved
14:17 Adurah If not Austin Powers, Deborah Kagan or that Boston Terrier.
14:23 damaya joined #mojo
14:23 dvinciguerra joined #mojo
14:28 sri fluffy the cloud
14:31 sri oh, an rfc for tuning your http servers :o https://tools.ietf.org/html/draft-stenberg-httpbis-tcp-01
14:34 CandyAngel jberger: sri: Okie, thankies
14:35 CandyAngel I'm totally not planning anything :)
14:35 CandyAngel You know, like.. totally.
14:37 sri so, you're saying that you're planning something?
14:40 CandyAngel I'm not planning on making a Mojolicious-themed dress, if that is what you are implying :|
14:43 sri that's suspiciously specific ;p
14:44 sri also, buy more t-shirts! :)
14:47 sri hmm, using fillinform these days seems a little crazy http://advent.perl.kr/2015/2015-12-22.html
14:47 sri actually parsing your template generated html, just to insert some form values, that's so expensive
14:50 CandyAngel And I wasn't asking what the mascot/logo was so I would know what to put on the back :P
14:53 jberger I always cringe when I see an example with the podrenderer plugin
15:10 CandyAngel sri: I don't wear tshirts and I don't even have a display thing for the ones I have (X3, Carmegeddon, Haunts) :(
15:11 CandyAngel But I think I can make a cool dress, have "Mojolicious" on the peaks/troughs (so if you pulled it flat, it would just be "random" shapes)
15:11 CandyAngel And have the cloud on the back :)
15:25 asarch joined #mojo
15:59 Vandal joined #mojo
16:01 voldemortensen joined #mojo
16:03 lluad joined #mojo
16:07 McA joined #mojo
16:20 mullagain joined #mojo
16:21 mullagain is there anything built into mojo to handle rest session id's?
16:21 mullagain well, just REST sessions in general
16:22 sri "REST session" is an oxymoron
16:24 jberger yo dawg, I heard you like representative state, so I put representative state in your representative state so you can ...
16:27 mullagain true, what I mean is handling login session ids
16:28 mullagain more of an authentication token
16:29 voldemortensen1 joined #mojo
16:29 mullagain which is how I traditionally handled login until I found mojo sessions
16:29 mullagain but I am assuming relying on cookies is a bad idea with REST :)
16:30 sri there's an entire guide http://mojolicio.us/perldoc/Mojolicious/Guides/Growing
16:32 jberger mullagain: I don't mind using a session cookie for auth
16:32 jberger there are other mechanisms (which are similar under the hood) like say JWT
16:33 lluad If it's REST for your own webapp, cookie auth can be fine. If it's a public REST API then something non-cookie-based can be more pleasant for the end user.
16:34 damaya joined #mojo
16:35 sri if your api uses https, even basic auth is fine
16:35 mullagain looks like i will have to handle both cookie and non-cookie based
16:36 sri although, if you expect api consumers to store credentials permanently, you want 3 legged auth with tokens
16:37 sri like oauth
16:38 mullagain yeah, i will just have to look for a token or session
16:38 jberger I love basic auth for internal use stuff too, so handy for debugging via command line mojo get
16:50 damaya joined #mojo
16:51 sri oh, there's an api spec in the works to make browser addons portable across browsers :o
16:52 Grinnz_ are google and mozilla involved?
16:52 sri yes
16:52 Grinnz_ interesting
16:53 sri https://wiki.mozilla.org/WebExtensions
16:53 jberger yay, another XUL
16:53 jberger I'd rather hear more about WebAssembly
17:32 disputin joined #mojo
17:43 gabiruh left #mojo
18:18 dvinciguerra joined #mojo
18:32 preaction why don't they just call it Gozer so it can eat our souls?
18:42 PryMar56 joined #mojo
18:48 mullagain joined #mojo
19:01 damaya joined #mojo
19:03 crux joined #mojo
19:17 damaya joined #mojo
19:43 neilhwatson joined #mojo
19:52 sue joined #mojo
20:00 meshl joined #mojo
20:03 krebbit joined #mojo
20:07 damaya joined #mojo
20:18 irqq joined #mojo
20:28 sue joined #mojo
20:29 damaya joined #mojo
20:46 sue joined #mojo
20:52 borkur joined #mojo
21:03 borkur joined #mojo
21:04 borkur joined #mojo
21:26 damaya joined #mojo
21:35 gryphon joined #mojo
21:35 asarch joined #mojo
21:38 asarch In a full stack project, where should I put under sub {}, on a controller module or in the application module?
21:39 bpmedley asarch : I have mine in startup().
21:39 asarch Thank you bpmedley
21:39 asarch Thank you very much :-)
21:43 shadowpaste "asarch" at 217.168.150.38 pasted "Can't load application from file "/home/asarch/doc_book/script/doc_book": syntax error at lib/DocBook.pm line 24, near "under sub "" (31 lines) at http://paste.scsys.co.uk/503373
21:43 asarch What's going on?
21:44 preaction asarch: "under" is a Mojolicious::Lite function. you want $r->under( '/' )-> ... see Mojolicious::Guides::Routing
21:44 asarch D'oh!
21:46 jberger yeah, under returns a new sub-route
21:46 jberger this is the only major difference between lite and full
21:47 jberger in lite there is a global router and "under" replaces it (group replaces it locally)
21:47 jberger which is why there is no analog to group in full
21:47 asarch Thank you
21:47 asarch Thank you very much :-)
21:47 jberger asarch if you understand that, you just leveled up
21:48 asarch Thank you!
21:48 asarch :-)
21:51 asarch Can you do?: $->under('/')->to('root#under');
21:51 asarch ?
21:52 asarch Or should I?: $r->under('/' => Root::under);
21:52 buu asarch: The former.
21:53 damaya joined #mojo
21:54 shadowpaste "asarch" at 217.168.150.38 pasted "?" (56 lines) at http://paste.scsys.co.uk/503374
21:54 asarch However, it doesn't work for me
21:55 buu What's the error?
21:55 asarch I even put a: print STDERR "Hello from under\n";
21:55 asarch There is no error at all
21:56 jberger asarch: you still have to return true
21:56 asarch O
21:56 asarch Ok
21:56 buu er
21:56 buu asarch: under defines a parent path, you still need to define a path under it
21:57 preaction isn't it the second arg to under() that defines the callback? not to()?
21:57 jberger and what buu said
21:57 buu my $p = $r->under("/foo"); $p->get("/bar")->
21:57 jberger preaction: this is using a controller action as the under handler
21:57 jberger its the same as any other route
21:58 asarch ...
21:58 asarch ?
21:58 jberger ->under($path => $cb) is just the same as ->under($path)->to(cb => $cb)
21:58 asarch I have:
21:59 asarch $r->get('/')->to('root#index');
21:59 asarch $r->under('/')->to('root#under');
21:59 asarch Is it wrong?
21:59 buu yes
21:59 asarch How should it be? :-(
21:59 buu my $p = $r->under("/foo"); $p->get("/bar")->
21:59 jberger asarch: which routes should be protected by the "under"?
22:00 asarch Well, I was thinking to ask the user login name and password immediately after they visit /
22:00 jberger asarch: you are building a route tree
22:01 jberger that doesn't sound like an under, that sounds like a regular action
22:01 asarch Oh :-(
22:01 jberger asarch: this is very much like the growing guide example though
22:01 asarch I thought it was like the: hook 'before' => sub {...} from Dancer
22:02 asarch Every time the user visits any controller, this hooks automatically runs 'before'
22:02 jberger http://mojolicio.us/perldoc/Mojolicious/Guides/Growing#Simplified-application-class
22:02 jberger asarch: Dancer has lots of globals
22:03 jberger Mojo hates globals (with the exception of the global router in lite)
22:03 asarch Oh
22:03 jberger under returns a new router from which you build the routes that the under is the parent
22:04 jberger in the example I linked you to (and you should reread top to bottom) $logged_in is a new router
22:04 jberger so /protected is under the under, but /logout is not
22:06 bpmedley asarch : https://bitbucket.org/snippets/bpmedley/8KjR8 <-- You might like this example
22:07 jberger bpmedley: that is essentially correct, however you just built asarch a redirect loop
22:07 bpmedley show
22:07 bpmedley Show me, pls
22:08 bpmedley Pls reload.  I had edited the controller, as well.
22:08 jberger when you visit /login, since you aren
22:08 bpmedley Pls reload the bitbucket
22:08 jberger aren't logged in
22:08 jberger ok, starting over
22:09 jberger '/login' is subject to the under
22:09 jberger and when you request the under, if you aren't logged in, you are redirected to /login
22:09 bpmedley did you reload the bitbucket?
22:09 bpmedley https://bitbucket.org/snippets/bpmedley/8KjR8#docbook_controller.pl-11
22:10 jberger that doesn't fix the redirect loop and it also doesn't do what asarch wanted which is to redirect from / if the user isn't logged in
22:11 jberger '/login' should have $r as its parent
22:11 jberger $r->any('/login')->to(...);
22:11 bpmedley jberger : Where is the loop, pls.  I'm running the code and not seeing one.
22:12 jberger because the under controller also doesn't return 0 to stop the dispatch
22:12 bpmedley Line 13 returns undef.
22:13 jberger it is possible that I'm seeing it wrong, but in essence my point is still correct
22:14 jberger you don't want /login under the "redirect to login" handler
22:14 bpmedley Moment
22:23 jberger bpmedley: the redirect is to '/login'
22:27 meshl joined #mojo
22:31 asarch What should I do?
22:32 jberger asarch: read Growing
22:32 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Growing
22:32 sri there's literally a guide for what you want
22:33 asarch Thank you
22:33 asarch Thank you very much guys :-)
22:34 asarch See you later
22:34 asarch Have a nice day :-)
22:38 bpmedley jberger : https://bitbucket.org/snippets/bpmedley/8KjR8 <-- For posterity, thx for the correction.  Does this look valid, accurate?
22:40 jberger bpmedley: the under redirect still redirects to /
22:41 bpmedley Sure; however, I believe you'll see that the under no longer applies to /, just /login, right?
22:45 jberger bpmedley: $login->get('/login')->to('root#login');
22:45 jberger you are flipping the whole goal here
22:45 jberger the under WAS supposed to apply to /
22:46 jberger and probably shouldn't apply to /login
22:46 bpmedley Hrmm, I see.  Dyslexia won.
22:46 jberger it happens
22:48 damaya joined #mojo
22:48 bpmedley Also, I should have articulated that I was trying to show a methodology for setting an "under" and should have changed my app logic to meet the real-world question.
22:49 bpmedley Perhaps that sentence is redundant.. :-P
22:53 jberger one or the other of those would have made it a bit clearer yes
22:54 jberger meanwhile I'm trying to make a single file full app and I find myself fighting the the class loader (since it doesn't need to load the files in this case)
22:54 jberger (this among the reasons why Lite is better for examples)
22:54 bpmedley Why do you want to create a single file full app?
22:54 jberger because these were full app questions
22:55 jberger and a single file because its easier to pastie
22:55 jberger (and then run)
22:55 jberger I guess I could do full app routing in a lite app, that does just as well
22:59 bpmedley Would be sweet to have an easy way to run and paste a full app.
23:00 jberger http://pastie.org/10648130
23:01 jberger close enough
23:09 damaya joined #mojo
23:25 damaya joined #mojo
23:34 damaya joined #mojo
23:41 damaya joined #mojo
23:49 damaya joined #mojo

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