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

IRC log for #mojo, 2016-12-03

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

All times shown according to UTC.

Time Nick Message
00:32 tchaves joined #mojo
00:53 polettix joined #mojo
00:56 aborazmeh joined #mojo
01:24 aborazmeh joined #mojo
03:23 noganex joined #mojo
05:04 dboehmer joined #mojo
05:59 itaipu joined #mojo
06:04 karjala When you create a Mojo::Log->new(...), is it kept open, or does it open and close whenever you write something to it?
06:04 karjala the file, I mean
06:08 karjala From what I see in the code, it opens with Append, and then locks & unlocks on each write
06:14 Adura joined #mojo
06:31 bobkare joined #mojo
06:49 polettix joined #mojo
07:20 Vandal15263 joined #mojo
07:26 ashimema joined #mojo
07:59 dod joined #mojo
08:04 dod joined #mojo
08:59 kerdes joined #mojo
08:59 kerdes hi,
08:59 kerdes I have a Mojo question
08:59 kerdes so if redirect page to another
09:00 kerdes $c = $c->redirect_to('named', foo => 'bar');
09:01 kerdes and I'd like to us the foo value
09:01 kerdes how can I get it ?
09:01 kerdes I tried $c->stash('foo'), but no successw
09:31 rshadow joined #mojo
10:03 kerdes joined #mojo
10:04 pink_mist if you redirect the useragent it'll make a new request, so any old stash data is lost
10:05 kerdes thats what I thougt
10:06 coolo kerdes: you can store it in the session or pass it as parameter
10:06 kerdes I have a form
10:06 kerdes so when the form post to my controller,
10:06 kerdes and the data is not valid,
10:07 kerdes I'd like to refill the form with the posted data
10:07 kerdes so yes, my second think was the session or cookie
10:07 kerdes but the parameter is looks a good choise as well
10:13 coolo kerdes: you can also avoid redirecting and just render the same template
10:13 coolo after the stashes
10:14 kerdes yes, but it has tons of data collection before the render
10:14 kerdes and
10:14 kerdes aI dont want to duplicate all that code..
10:14 pink_mist make it into a helper
10:14 kerdes maybe
10:14 sri the redirect normally happens after the validation was successsful
10:15 kerdes yes, but on that case, I dont need sending data back
10:15 sri the way you want it is very unusual and you'll run into many problems
10:16 kerdes sri: why? what is the unusual ?
10:16 kerdes I am validating on client side as well,
10:17 kerdes but I dont trust on the client side :D
10:17 kerdes so I do a second validation on the posted data
10:19 pink_mist not on the client side, no
10:20 kerdes oh I know where I missed
10:20 kerdes I did a separated controller :/
10:20 kerdes I should merge it to one
10:20 kerdes and make the route "any"
10:21 coolo sri: rails stores the form errors in the session in update and redirects to show. So it's not *sooo* unusual :)
10:23 sri coolo: you mean flash messages
10:23 coolo sri: no, validation errors as well
10:23 coolo http://crypt.codemancers.com/posts/2013-12-18-form-objects-validations/
10:25 sri coolo: i don't see it mentioned there
10:26 sri i mean, i've not used rails much recently, maybe they added the feature, but i don't see any docs for it
10:27 sri coolo: your link doesn't even contain the words session or redirect
10:27 coolo yes. I noticed the same :)
10:27 coolo so I take back what I said
10:27 sri ok :)
10:28 kerdes okey, so I am merging the two controller to one
10:28 kerdes how can I get the method that how the route called
10:28 kerdes get / post
10:28 rshadow joined #mojo
10:29 sri the blog example in Mojo::Pg covers pretty much how restful-ish form valiadtion with session and redirects is done in all state of the art frameworks https://github.com/kraih/mojo-pg/blob/master/examples/blog/lib/Blog/Controller/Posts.pm
10:29 coolo sri: I can't link to it, but if you look up validates in http://guides.rubyonrails.org/getting_started.html you actually find the truth
10:29 coolo if @article.save redirect_to @article else render 'new' end
10:30 coolo so basically what we're trying to explain kerdes
10:31 sri that doesn't store the article in the session
10:32 coolo sri: I already took it back :)
10:32 sri ah, ok, sounded like you found something ;p
10:39 kerdes instead of this
10:39 kerdes how can I check that my controller is called with get or post
10:39 kerdes if the route is any
10:41 kerdes if ($self->param('submit') )  ? or similar
10:42 coolo kerdes: you still create 2 routes and call common functions in them
10:42 sri kerdes: https://github.com/kraih/mojo-pg/blob/master/examples/blog/lib/Blog/Controller/Posts.pm
10:42 sri that example should cover all the normal stuff
10:43 pink_mist to answer the question you asked: $c->req->method
10:43 kerdes pink_mist: thank you!
10:43 sri https://github.com/kraih/mojo-pg/blob/master/examples/blog/lib/Blog.pm#L23
10:46 kerdes sri: I can see what you are linking, thx
10:47 kerdes but I asked this beside the form stuff
10:47 kerdes just came to my mind, what If I'd like to know the method
10:48 kerdes the correct answare was: $c->req->method  by pink_mist
10:53 good_news_everyon joined #mojo
10:53 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v1WlQ
10:53 good_news_everyon mojo/master 700e546 Sebastian Riedel: mention the method too
10:53 good_news_everyon left #mojo
10:53 sri i was about to link to http://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial#HTTP
10:53 sri but noticed the method is not actually mentioned ;p
10:54 sri guess it's rare you need it, but might as well cover the whole http request
10:54 kerdes thanks
10:55 polettix joined #mojo
11:02 rshadow joined #mojo
11:04 irqq_ joined #mojo
13:17 kerdes joined #mojo
14:31 tchaves joined #mojo
14:44 rshadow joined #mojo
14:53 lluad joined #mojo
15:00 kes joined #mojo
15:03 sri am i crazy or does chrome 55 actually use much less memory :O
15:04 genio They blacklisted my mac's GPU. so, I can't use chrome anymore
15:05 genio :( It feels like I'm being forced to buy a new machine even though this one still works great for everything else
15:30 kes Hi, Is there a way to use route name in $t->get_ok( 'named' )?
15:31 kes I have found only one way: http://stackoverflow.com/a/40949390/4632019
15:31 kes but it has too much typing...
15:40 sri then make your own Test::Mojo::Role module
15:49 gryphon joined #mojo
16:11 kes sri: thank you
16:17 polettix joined #mojo
16:21 thowe joined #mojo
16:32 disputin joined #mojo
16:51 PryMar56 joined #mojo
16:51 stryx` joined #mojo
16:51 dod joined #mojo
17:44 asarch joined #mojo
18:47 gryphon joined #mojo
19:06 Adura joined #mojo
20:49 Adura joined #mojo
20:50 Dandre joined #mojo
21:32 Craftsmanship joined #mojo
21:32 Craftsmanship So, am I supposed to accept old secrets?
21:33 Craftsmanship the idea is that I sign with ->[0] and accept things singed with any of them, right?
21:46 jberger Yes that is the general idea
21:47 jberger Gives a time lag for switching secrets and not killing active sessions
21:48 jberger You only need to accept the new ones for slightly longer than they would timeout anyway
21:48 jberger Sorry, only need to accept the OLD ones ...
21:50 Craftsmanship That's what I figured was the intended behaviour,
21:50 Craftsmanship I'm doing something semi-related, and i wanted it to behave in the same way as session cookies.
22:10 jberger I believe the term is called "perfect forward security"
22:11 jberger Ah, s/security/secrecy/, i was close
22:12 Craftsmanship makes key rotation less of a pain, i suppose.
22:13 jberger Yeah
23:04 polettix joined #mojo

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