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

IRC log for #mojo, 2017-01-18

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

All times shown according to UTC.

Time Nick Message
00:20 sugar joined #mojo
00:47 aborazmeh joined #mojo
01:24 tardisx joined #mojo
01:46 sugar joined #mojo
01:50 tardisx joined #mojo
01:51 tardisx joined #mojo
01:52 tardisx joined #mojo
01:57 tardisx joined #mojo
02:37 zivester joined #mojo
03:18 bpmedley joined #mojo
03:29 jberger sri: do you still use linux capabilities to bind to <1024?
03:29 jberger or can you point me to resources to learn about doing so
03:37 jberger meh, maybe I'll just use nginx for this as usual
03:54 noganex joined #mojo
04:13 lluad joined #mojo
04:22 disputin joined #mojo
05:03 prajith joined #mojo
05:04 dboehmer_ joined #mojo
05:41 bpmedley jberger : Besides sudo, or root is there a fancy way to bind low number ports these days?
05:44 preaction there's some "capability" setting thing you can give programs
05:45 bpmedley Hrmm.. google.. setcap 'cap_net_bind_service=+ep' /path/to/program ?
05:45 bpmedley If so, that's really sweet..
05:46 inokenty-w joined #mojo
05:46 preaction maybe? setcap sounds familiar
05:46 preaction i don't have a linux box, so can't help there
05:46 preaction personally, i set up an apache reverse proxy as root, and then bind the apps to high ports with low privileges
05:46 lluad joined #mojo
05:46 bpmedley preaction : What OS do you use for serving all your stuff?
05:47 preaction openbsd if i have a choice
05:49 preaction hopefully if i have time before the CFP on YAPC::NA closes, i'll blog my deployment strategy and submit a talk
05:49 bpmedley That would be be an entertaining, enlightening talk..
05:52 preaction yeah. took a few false starts, but what i got now i'm really happy with. uses Rex, the apps themselves deploy completely without root (including daemon process supervision)
06:33 stryx` joined #mojo
07:02 dod joined #mojo
07:06 zach how do you refer to session information in an under route
07:07 zach in a route directly from the main app, self is app which has session, but in an under route it comes from a controller
07:08 preaction in every route, the first argument is the controller.
07:08 dod joined #mojo
07:09 preaction that said, you can get at the app from every controller using $c->app
07:09 zach ok, so I just have to be a little more explicit
07:10 preaction no, because as i mentioned: all routes get the controller as the first argument, even under routes
07:10 preaction it's likely $c->session, because a session is bound to a controller, not the app. binding it to the app would be weird
07:11 zach but it's not like that
07:11 zach i mean
07:11 zach look
07:11 zach $log->debug("Loading home page or user $self->session('username')");
07:12 preaction http://mojolicious.org/perldoc/Mojolicious/Sessions this doc seems to say it is
07:12 preaction $self there, is that an app or a controller? are you sure?
07:12 zach Loading home page or user Provisioner::Controller::Example=HASH(0x3c7d388)->session('username')
07:12 preaction that's a controller
07:12 zach I said it was referenced from a controller
07:13 preaction you said it came from the app
07:14 preaction [01:07:30]  <zach>in a route directly from the main app, self is app which has session, but in an under route it comes from a controller
07:14 preaction and then i corrected you: [01:08:46]  <preaction>in every route, the first argument is the controller.
07:14 preaction this, i think, is why they try to avoid $self in the mojolicious docs
07:14 janl joined #mojo
07:14 preaction well, i'm wrong about them avoiding $self, but i'm not wrong about it being a controller. because it is a controller
07:15 zach ok one sec
07:15 zach my $authorized = $r->under('/')->to('example#is_logged_in');
07:15 zach $authorized->get('/home')->name('restricted_area')->to('example#home');
07:16 zach the logged_in method says,     my $self = shift;
07:16 zach return 1 if $self->session('logged_in');
07:16 zach so, reference by $self is valid there
07:16 preaction if you're going to show code, put it in a paste site. don't put it here..
07:17 zach the point remains, in a sub referenced by that, how do i reference session?
07:18 preaction but also, does it work? because if you're just asking if it works, i can't really answer that
07:18 preaction you said that you're doing $self->session in your logged_in method (which i assume you mean is_logged_in)
07:18 preaction so, does it work?
07:19 zach yes, i was being short, the log in works, it then goes to the route it's supposed to and it calls the sub it's supposed to, but session is then somewhere else
07:20 zach I'm trying to have a layout with the username in it, pulled from session, with a user specific greeting, like, welcome to this site preaction
07:21 janl_ joined #mojo
07:29 Vandal joined #mojo
07:49 AndrewIsh joined #mojo
08:04 dod joined #mojo
08:09 bpmedley joined #mojo
08:14 kes joined #mojo
08:45 rshadow joined #mojo
08:55 sri batman: does assetpack have an env var that forces the cache to be cleared?
09:00 coolo sri: this looks promising: $self->_reset({unlink => 1}) if $ENV{MOJO_ASSETPACK_CLEANUP}
09:00 coolo but it's not documented
09:04 bpmedley http://24.199.194.123:3000/minion_ui <-- What do y'all think of this with the buttons and animated graphs?  The colors and screen sizing need work..
09:11 marty joined #mojo
09:38 good_news_everyon joined #mojo
09:38 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vMPp9
09:38 good_news_everyon mojo/master 1aa4ecc Sebastian Riedel: bump version
09:38 good_news_everyon left #mojo
09:39 sri batman: feature request!
09:45 kaare joined #mojo
10:10 ilbot2 joined #mojo
10:10 Topic for #mojo is now 🍩 nom nom | http://mojolicious.org | http://irclog.mojolicious.org | http://code-of-conduct.mojolicious.org
10:13 sugar joined #mojo
10:13 nic joined #mojo
10:19 ksmadsen joined #mojo
10:37 lluad joined #mojo
10:40 castaway .. running ::Command::daemon, is there an option for "reload on code file change" I'm missing?
10:52 rshadow joined #mojo
10:56 sugar joined #mojo
11:01 bobkare castaway: pretty sure only morbo does that
11:01 castaway ah, wonder if I have one of those
11:02 castaway having fun with respond_to now.. I have in controller: $c->respond_to(json .. {}, html => {}) yet a getJSON from javascript gets given the html variant.. :(
11:05 nic you can debug that with 'accepts'
11:06 castaway got an example?
11:06 nic the first thing to do is go through the docs
11:06 castaway did that then started reading the code ;)
11:06 nic and you missed 'morbo'?
11:07 castaway I didnt read ALLL the docs
11:07 castaway I'd be here all year
11:07 castaway .. I'm working on some stuff someone else set up.. and they proviided a script with daemon
11:07 nic fair enough.  better spend your time asking here, one keyword at a time
11:08 castaway if I was asking how it works.. Id understand your issue
11:08 castaway Im after why it doesnt when Im using code matching the doc
11:08 nic it's not my issue
11:08 castaway objection.. pick a word
11:10 nic you're not the first person to take over someone else's code and think you can do an ok job without reading the docs
11:10 nic and you won't be the last
11:11 castaway Im not sure why you're saying I havent read the doc, when I said that I had.. did I miss one? regardless, happy to go hunting on my own..
11:12 nic it's the goldfish effect: you told us that 4mins earlier
11:13 nic jberger, batman, et al: I have an app that kind-of best-fits SSE since the only thing you might want the client to send is heartbeats
11:14 nic Do you share the opinion that SSE is old-school and better to put everything on websockets?
11:14 bobkare castaway: iirc most browser initiated requests don't have very specific Accept headers, see the note in the respond_to documentation
11:14 nic Or do you see a point in pursuing SSE if the comms is really one-way?
11:16 castaway bobkare: hmm "Accept:application/json, */*; q=0.01" not specific enough?
11:16 bobkare */* is about as unspecific as it gets
11:17 castaway see your point
11:21 tchaves joined #mojo
11:25 TBSliver joined #mojo
12:02 castaway hm, so my actual bug was that my controller was being ignored/not routed to.. so it was just jumping straight to the template..
12:43 lluad joined #mojo
12:50 VVelox joined #mojo
13:11 sri curious case actually, i've always been wondering if we should have a debug log message for not routing to something and just rendering a template
13:12 sri but it doesn't come up as a problem very often
13:17 pink_mist I've run into the issue once or twice, especially in my early days of using Mojolicious
13:17 pink_mist I think it would be a good idea for a debug log message
13:23 gizmomathboy joined #mojo
13:33 castaway sri: well, it did say somehing like .. Controller "ADP::Soylent::Employees" does not exist
13:33 castaway ... somehow I just thought "rendering so that cant be it" ;)
13:36 castaway maybe a more shouty "SKIPPING CONTROLLER!" ? ;)
13:41 pink_mist perhaps "Controller %s does not exist. Rendering template directly."?
13:51 lluad joined #mojo
13:57 sugar joined #mojo
14:00 trone joined #mojo
14:16 Pyritic joined #mojo
14:30 gryphon joined #mojo
14:31 sri pink_mist: that's not always the case
14:31 sri it depends on auto rendering being enabled
14:32 pink_mist well, I meant in the cases where it is true :P
14:35 Pyritic joined #mojo
14:35 dikim joined #mojo
14:39 sri you don't know that yet at the time the controller is not found :)
14:43 sri you could report it here though https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Routes.pm#L189
14:43 sri based on $stash->{'mojo.routed'}
14:52 rshadow joined #mojo
15:07 genio https://github.com/coffeemug/defstartup/blob/master/_drafts/why-rethinkdb-failed.md :(
15:43 zivester joined #mojo
15:51 sugar joined #mojo
15:53 sh14 joined #mojo
16:03 disputin joined #mojo
16:05 disputin1 joined #mojo
16:06 disputin joined #mojo
16:06 zivester joined #mojo
16:11 gregf_ joined #mojo
16:13 Pyritic joined #mojo
16:31 Janos joined #mojo
17:09 rshadow joined #mojo
17:17 Petru joined #mojo
17:18 Petru Hi, where can I find some documentation on when the webapp updates the behaviour based on source code? I saved the code and it didn’t change its behavior until I’ve restarted it
17:19 pink_mist only if you run it under morbo and morbo is watching the file does that happen
17:20 Petru how can I watch for files?
17:20 Grinnz on development
17:21 pink_mist http://mojolicious.org/perldoc/Mojo/Server/Morbo#watch
17:21 Grinnz don't use morbo in productiomn
17:22 Petru why?
17:22 Grinnz it's a development server for this purpose
17:22 pink_mist also http://mojolicious.org/perldoc/morbo has a -w switch
17:22 Grinnz it's not designed for production workloads, and having a production webapp randomly restart is bad
17:24 Grinnz hypnotoad is the production webserver, it has preforking and hot restarting
17:25 dod joined #mojo
17:39 rshadow joined #mojo
17:46 Seth joined #mojo
17:55 Petru joined #mojo
18:16 dod joined #mojo
18:32 howitdo joined #mojo
19:10 stryx` joined #mojo
19:32 disputin joined #mojo
19:46 zach what's the functional difference between these two?
19:46 noganex joined #mojo
19:48 zach $self->stash( foo => $foo ); $self->render       and            $self->render( foo => $foo );
19:48 pink_mist nothing much
19:48 pink_mist they're both equivalent to $self->stahs(foo => $foo)->render;
19:48 pink_mist *stash
19:48 pink_mist sorry
19:50 zach ok
19:50 Pyritic joined #mojo
19:51 zach I have a sub that returns a hash that I want to iterate over to make some sort of HTML, I used a % foreach my $key (keys %hash) {    and all the values appear in the stash in the stack trace that mojo spits out, but it doesn't load the page and says it can't find the get route for that, but if i pull out that foreach loop it loads the same route without that hash fine, what could cause that?
19:54 sri %$hash
19:57 zach I don't understand
19:57 zach I didn't declare the hash as $
19:59 pink_mist how do you declare it then?
20:00 zach my %vapps = $vcd->list_vapps();
20:01 pink_mist and where do you declare that? in the template?
20:01 zach no, in the controller
20:01 pink_mist then how do you expect the template to get to it?
20:01 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Stash-data
20:01 zach I pass it is as a stash
20:01 pink_mist HOW?
20:01 pink_mist this is what I'm trying to get you to say
20:02 zach $self->render(vapps => %vapps);
20:02 pink_mist well that's absolutely wrong
20:02 pink_mist you can't pass a hash like that
20:02 pink_mist you need to make a reference to it
20:02 zach the trace shows all the keys :\
20:03 zach so that needs to be %$, and then in the template it becomes %$ as well?
20:03 pink_mist no, that needs to be \%vapps
20:03 pink_mist and in the template it becomes %$
20:03 zach ok
20:05 zach holy crap it worked
20:05 zach thanks
20:05 zach now i need to figure out how to make it look pretty
20:06 zach ohhhh, i just had ideas....
20:06 zach each one could be its own form...
20:10 Grinnz my $vapps_ref = \%vapps; $self->render(vapps => $vapps_ref); then keys %$vapps_ref; does that make sense?
20:10 Grinnz you don't need the intermediate variable, but just for expository purposes
20:11 Grinnz thats what's actually happening
20:11 Grinnz sorry, keys %$vapps (as the stash name is still vapps)
20:14 marty_ joined #mojo
20:15 zach :) thanks
20:15 zach I like my form idea, it really goes with my plan
20:15 zach I suck at decorating things, need to just do some bootstrap crap
21:20 perlpilot joined #mojo
22:09 disputin joined #mojo
22:09 sugar joined #mojo
22:34 PryMar56 joined #mojo
22:41 zivester joined #mojo
23:54 disputin1 joined #mojo

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