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

IRC log for #mojo, 2014-12-22

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

All times shown according to UTC.

Time Nick Message
00:01 damaya skittles: http://mojolicio.us/perldoc/Mojolicious#before_render
00:02 damaya skittles: that will solve your issues with creating a hook before all routes
00:13 woz joined #mojo
00:25 damaya How do I grab params in a helper?
00:27 jberger damaya: hooks are probably not necessary in his case
00:28 jberger and ... with the param helper
00:28 damaya jberger, oh, he sent me a pmessage asking how to render a variable in the default template without specifying it in every route
00:29 jberger damaya: that's what defaults are for
00:29 jberger I've not yet ever needed a hook
00:29 damaya jberger, default templates?
00:30 jberger default stash value
00:30 damaya jberger, the variable is created in the route
00:31 damaya sub thing { my $self = shift; my $blah = ...; $self->render(blah => $blah); } and in default template: %= $blah
00:31 damaya I.e., the variable in the default template needs to be updated constantly.
00:34 upasana joined #mojo
00:36 upasana_ joined #mojo
00:36 jberger what does it matter that it is the default template?
00:38 jberger ok so if it needs to be a computed value, computed the sane way in each request
00:38 jberger same
00:38 jberger you could use a hook for that
00:39 jberger I would probably make a helper and call that from the template
00:40 damaya jberger, that's what I said
00:40 damaya I guess in template you can do %== helper(param 'name')
00:40 damaya not sure how to grab the param in helper without it being passed in... I imagine it's somewhere in $self.
00:40 jberger or the helper can just access the param
00:41 jberger the invocant to a helper when used during a request is the current controller
00:42 jberger that's only not true when called from the app, in which case it's a generated controller instance
00:43 jberger I would encourage you to always write the invocant to a helper as $c to make that more clear
00:43 damaya jberger, ahh yes, I do use $c :D
00:43 damaya I'm just used to saying $self
00:45 Grinnz $self is what you call it in methods of the controller class itself
00:45 jberger so in that case it should be fairly evident that you can call the param method inside a helper
00:46 jberger Grinnz: personally I use $c for all controller methods, but that might be taking things to an extreme
00:47 Grinnz you could use $self for helper methods too, since theyre always called on the controller... as long as you're consistent
00:48 Grinnz helper methods i use $c just to avoid confusion with $self from the application or plugin method that it's created in
00:49 jberger sure that's just style
01:15 skittles joined #mojo
01:17 linagee Is there a way to know if Mojo is using IO::Socket::IP or IO::Socket::SSL?
01:21 linagee (or which is prefers, or which module to look at to try and find out?)
01:23 linagee (I'm running Mojolicious 5.70) apparently, io::socket::ip isn't even on the docs anymore. hrm...
01:23 linagee so, maybe n/m...
01:39 jberger linagee: I believe that one is now a hard dependency
01:43 absolut_todd joined #mojo
01:45 linagee jberger: just trying to maximize my SSLlabs score. :) I'm at a B.
01:46 linagee It still says I'm CRIME vunerable. (updating some modules to see if I can make that go away.) It says "TLS compression: yes" (but I can't seem to find anything related. knowing that its going to be in IO::Socket::SSL helps.)
01:47 linagee One of the modules I didn't have was IO::Socket::Socks. Hoping putting that in makes the CRIME thing go away
01:47 jberger linagee: it would be using ssl if the scheme is https
01:48 jberger they won't care at all about socks
01:48 jberger I wouldn't think
01:48 linagee ah... makes sense.
01:48 linagee (If SOCKS = how I traditionally think of SOCKS. outbound proxy stuff. unless its something all crazy different.)
01:48 jberger you would need to get a cert
01:48 linagee check
01:49 linagee I also didn't have EV. no idea how that might have affected me. (slower performance?)
01:49 linagee also didn't have Net::DNS::Native
01:49 jberger EV might help performance, if properly constructed and configured
01:50 jberger ndn is probably not necessary
01:50 jberger it is very useful in a specific use case and rarely elsewise
01:50 linagee My DB connections got slow. not sure if the admin fooling with stuff or something related to where I'm running it. (MySQL DBD)
01:51 jberger can't help you there
01:51 linagee er wait. n/m. that's a DBIx::Class thing. :)
01:51 linagee lol
01:51 linagee also, it hurts when I do this. (then don't do that! ;) )
01:51 linagee thanks
02:03 klapperl joined #mojo
02:24 linagee ssllabs is driving me crazy. :( our godaddy cert requires a chain and for the life of me I can't figure out how to put it in there...
02:24 linagee not ca=.... not concatenating .crt files...
02:24 linagee my guess is some obscure IO::Socket::SSL thing that I have yet to discover
02:25 linagee (and that may or may not actually be exposed by the hypnotoad/Mojo constructor)
02:27 linagee apache calls this "SSLCertificateChainFile" and "SSLCertificateFile"
02:45 tempire linagee: these days most cheap ssl certs require 3 certs in the cert file
02:49 linagee thanks. :)
02:55 davido_ joined #mojo
02:56 jonquest joined #mojo
03:24 ___adam_ joined #mojo
03:31 woz joined #mojo
03:33 linagee cert issued fixed! (now to try and get "TLS compression: yes" (CRIME?) fixed)
03:54 hshong joined #mojo
03:54 noganex joined #mojo
04:02 linagee ack, enough of that. time to try and focus on the goal of the program, lol. :)
04:38 inokenty-w joined #mojo
04:39 skittles joined #mojo
04:43 woz joined #mojo
04:45 ignacio_ joined #mojo
04:54 irq joined #mojo
06:05 noganex joined #mojo
06:26 denis_boyun joined #mojo
06:30 rem_lex joined #mojo
06:31 woz joined #mojo
07:17 Lee joined #mojo
07:58 sugar joined #mojo
08:04 dod joined #mojo
08:08 eseyman joined #mojo
08:16 Vandal joined #mojo
08:20 woz joined #mojo
08:27 basiliscos joined #mojo
08:40 neyasov____ joined #mojo
08:44 Dandre left #mojo
08:47 irq joined #mojo
09:25 vytas joined #mojo
09:35 fhelmberger joined #mojo
09:39 amon joined #mojo
09:55 skittles joined #mojo
09:59 neyasov____ joined #mojo
10:04 sugar_ joined #mojo
10:09 woz joined #mojo
10:09 Dandre joined #mojo
10:26 nicomen $ mojo get mojolicio.us 'h1, h2, h3' 3 text
10:26 nicomen Mojo::Collection::AUTOLOAD (text) is DEPRECATED in favor of Mojo::Collection::map at /usr/share/perl5/Mojolicious/Command/get.pm line 102.
10:26 nicomen Getting Started
10:26 purl 1. Get a computer 2. Turn it on 3. Get a clue (this is the hard part) 4. Apply clue to problem at hand 5. Consume caffeine. 6. It has to work
11:01 cfedde joined #mojo
11:07 jnbek joined #mojo
11:12 sivoais joined #mojo
11:23 absolut_todd joined #mojo
11:25 nicomen just saw http://pl6anet.org - this is how it looks like to me: http://i.imgur.com/S4w4MXS.png
11:33 denis_boyun joined #mojo
11:35 absolut_todd joined #mojo
11:37 aleksey joined #mojo
11:41 absolut__ joined #mojo
11:57 woz joined #mojo
12:08 sugar__ joined #mojo
12:20 absolut_todd joined #mojo
12:39 absolut_todd joined #mojo
12:49 neilhwatson joined #mojo
12:52 absolut_todd joined #mojo
12:57 Eddy joined #mojo
13:16 absolut_todd joined #mojo
13:29 Kripton joined #mojo
13:33 McA joined #mojo
13:35 dvinciguerra joined #mojo
13:40 marty joined #mojo
13:40 ignacio_ joined #mojo
13:46 woz joined #mojo
13:49 skittles joined #mojo
14:20 bwf joined #mojo
14:24 neyasov joined #mojo
14:45 human39 joined #mojo
14:46 marty joined #mojo
14:51 neyasov_ joined #mojo
15:10 woz joined #mojo
15:13 skittles joined #mojo
15:31 sh4 joined #mojo
15:36 zivester joined #mojo
15:38 neyasov__ joined #mojo
16:01 dvinciguerra joined #mojo
16:01 dod joined #mojo
16:04 marty_ joined #mojo
16:10 marty joined #mojo
16:15 sugar joined #mojo
16:30 ryozi joined #mojo
16:40 sugar_ joined #mojo
16:56 Ptolemarch joined #mojo
16:58 denis_boyun joined #mojo
17:10 Ptolemarch joined #mojo
17:11 neyasov__ joined #mojo
17:20 denis_boyun joined #mojo
18:29 mib_9fkili joined #mojo
19:06 woz joined #mojo
19:07 disputin joined #mojo
19:11 doby joined #mojo
19:57 basiliscos1 joined #mojo
20:11 punter joined #mojo
20:36 denis_boyun_ joined #mojo
20:38 denny- joined #mojo
20:43 irq joined #mojo
20:50 denis_boyun joined #mojo
20:53 zivester joined #mojo
20:59 denis_boyun_ joined #mojo
21:03 marty_ joined #mojo
21:06 denis_boyun joined #mojo
21:19 Gedge_ joined #mojo
21:19 disputin joined #mojo
21:19 denis_boyun_ joined #mojo
21:21 neyasov__ joined #mojo
21:21 denis_boyun__ joined #mojo
21:23 denis_boyun joined #mojo
21:27 denis_boyun_ joined #mojo
21:36 denis_boyun joined #mojo
21:42 denis_boyun_ joined #mojo
21:48 neyasov joined #mojo
21:49 denis_boyun joined #mojo
22:00 denis_boyun_ joined #mojo
22:06 woz joined #mojo
22:25 marty joined #mojo
22:36 dvinciguerra joined #mojo
22:40 chansen joined #mojo
22:42 neyasov_ joined #mojo
23:24 tempire man
23:24 aramaki joined #mojo
23:24 tempire I'm so glad I learned sql a billion years ago.
23:24 aramaki ohai
23:24 tempire This stuff is genuis
23:24 tempire genius, even
23:25 aramaki quick newb question?
23:25 aramaki how to access helpers from a module, say models?
23:26 tempire Helpers are accessible from $c
23:26 tempire If you're saying that you want to access them from within a model module...don't.
23:27 tempire Pass the information to the model from the controller action.
23:27 aramaki hmm, I was following the growing guide
23:27 aramaki and got a users model, where I do stuff with users
23:27 aramaki now I loaded the db plugin, registered in startup and want to use the db helper from the model
23:28 aramaki I can access the helper in the main app
23:28 tempire What do you mean by the model, then?
23:28 tempire Usually the helper is the model, and the model has some db object within itself
23:29 aramaki right
23:29 aramaki the model is a helper
23:30 aramaki I was thinking of registering the db helper in startup and reusing it in the whole app
23:30 tempire You want to use the db helper elsewhere, outside of your model object?
23:31 aramaki $self->helper(users => sub { state $users = MyApp::Model::Users->new });
23:31 aramaki from the startup function
23:31 aramaki I also have  $self->plugin('database', {  13             dsn      => 'dbi:SQLite:dbname=.....
23:31 aramaki in there
23:31 aramaki how to access the db helper from the users model?
23:32 tempire You don't. Pass the db object into the model object.
23:32 tempire MyApp::Model::Users->new(db => $db)
23:32 aramaki ok, I should pass it on instantiation?
23:32 aramaki right
23:32 aramaki that should work
23:34 aramaki though it feels kinda weird, it would seem that there should be a way to access global helpers and stuff from other objects with the proper path/route
23:34 tempire You don't want that.
23:35 tempire You want to pass objects down in one place, having a unidirectional flow of information.
23:35 tempire Always a unidirectional flow of information.
23:35 tempire Anything else leads to chaos.
23:35 aramaki right
23:36 aramaki I've been reading the resources at http://mojolicio.us/perldoc/Mojolicious/Guides/
23:37 aramaki and was wondering are there any others, for beginners? the growing one is nice but it doesn't continue and leaved me still wondering about a lot of mojo stuff
23:38 tempire there are the mojocasts
23:38 tempire also the mojoexample
23:38 tempire both are a little old, but mostly relevant
23:39 aramaki I'd like to get an overall sense for mojo idioms, especially as this is my first framework
23:39 aramaki concepts etc...
23:39 aramaki I'll take a look
23:55 woz joined #mojo
23:58 aramaki and thanks for the help!

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