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

IRC log for #mojo, 2016-10-14

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

All times shown according to UTC.

Time Nick Message
00:04 mishanti1 Perl 5.24.0, installed with plenv as root. The issue is that perldoc drops privileges, thereafter not being able to read the required files that was just created as part of the installation.
00:07 mishanti1 So the real reason is that root compiled perl into his $HOME, perldoc drops privs, and nobody/nogroup can't read anything under /root.
00:08 Grinnz weird, lots of people have homedirs that aren't globally readable, and install modules into local::libs
00:08 Grinnz you'd think this would be a problem for that too?
00:08 Grinnz or it only happens when run as root
00:14 pink_mist well only as root is it actually _possible_ to change uid
00:16 mishanti1 Yeah, as a notmal user this is not an issue. It is also not an issue if invoking perldoc belonging to a perl that is somewhere world-readable.
00:16 mishanti1 s/notmal/normal/
00:43 Grinnz so i guess the takeaway is, don't install perls in root's homedir :P
00:43 Grinnz that's what /opt and /usr/local are for
00:50 mishanti1 Yeah. Reason it was placed there this time was simplicity (doh!). Was doing some provisioning of some vagrant boxes and needed to run some commands as root and have perl available.
00:51 mishanti1 Did absolutely _not_ foresee the issues I ran into.
00:51 mishanti1 Oh well. One lives and learns.
01:57 dave so...if I want to call a helper who's name is in $foo, how do I do that?
02:02 umask001 joined #mojo
02:04 orev joined #mojo
02:35 aborazmeh joined #mojo
02:46 noganex_ joined #mojo
02:55 mib_9xoohw joined #mojo
02:56 mib_9xoohw Hi Guys,
02:56 purl Hi Guys, is there a way how to execute some code right after default value is populated? happy-barney2's current solution: http://paste.scsys.co.uk/461639
02:57 mib_9xoohw In templates, is it possible to pass multi-line arguments e.g. currently I do stuff like: %== helper_name "\$('#paper').addClass('animated zoomIn');"
02:57 mib_9xoohw I would like to be able to do:
02:57 mib_9xoohw %== helper_name "
02:57 mib_9xoohw \$('#paper').addClass('animated zoomIn');
02:58 mib_9xoohw "
02:58 mib_9xoohw a bit like q=q{ multiline string here }
03:04 mattp has anyone ever seen broken pipe errors / dropped connections under high load with nginx proxypass?
03:05 mattp im seeing the app report 200 in the access log & nginx log, but getting dropped connection via AnyEvent::HTTP . not exactly sure whats shitting the bed
03:05 mattp when run serially it doesnt happen, but with high concurrency it barfs intermittently
03:10 mib_9xoohw mattp: did you set limits high enough
03:11 mattp mib_9xoohw: which limits are you referring to/
03:11 mib_9xoohw (I assume you're using linux)
03:12 mib_9xoohw i.e. ulimit
03:12 mattp oh, ulimit on the client?
03:12 mib_9xoohw I assume server
03:13 mattp im just running defaults, but its a good idea to check. ill check tomorrow mib_9xoohw thanks
03:14 mattp mib_9xoohw: last time I got annoyed by mojo::template I looked at the source, its only 280 loc
03:15 mib_9xoohw I'll try that
03:17 mib_9xoohw well' they most of fixed some bugs, cos its now 702 loc; v6.57)
03:18 mattp are you counting pod? :)
03:18 mattp https://metacpan.org/source/SRI/Mojolicious-7.08/lib/Mojo/Template.pm
03:19 mib_9xoohw cat Template.pm |wc -l 702
03:19 mib_9xoohw I see, pod :)
03:21 mib_9xoohw 297 lines, :)
03:22 mattp mib_9xoohw: I .. think it looks like it should do the right thing based on the multiline handling for expressions. im not sure just from eyeballing though sorry :)
03:25 mib_9xoohw do you know if you can execute code during the compile process e.g. %== helper "$DB::single=1 string " or something like that ?
03:29 mib_9xoohw :) you actually can, I put % $DB::single=1; on the line before, and it debugs in the template
03:34 jberger purl: forget Hi Guys,
03:34 purl jberger: I forgot hi guys,
03:35 mattp mib_9xoohw: ya, its just perl
03:36 jberger mib_9xoohw: you can use <%== ... %> for multi line things
03:37 jberger dave: you can use a string variable as a method
03:37 jberger $c->$foo()
03:38 mib_9xoohw so currently, I do %== helper name "params"
03:38 mib_9xoohw "params" I want to be multiline - and preferiably not have to escape it
03:40 jberger Try the tag interpolation form
03:43 mib_9xoohw do you have a link for that - (prob default helpers)
03:43 disputin joined #mojo
03:45 jberger Hunh?
03:45 jberger <%== ... %>
03:45 jberger Rather than
03:45 purl i think Rather than is => 'ro'
03:45 jberger %== ...
03:46 jberger The latter is the single line form
03:46 mib_9xoohw so do I <%== helper_name ... %>
03:46 jberger Yeah
03:46 jberger It is documented in ep
03:46 mib_9xoohw I'm getting syntax error on that
03:47 jberger I mean, replace the ... with something else :p
03:48 mib_9xoohw yep
03:48 mib_9xoohw it seems to be working now
03:51 mib_9xoohw does not work for multiple lines if they contains certain chars, I think " or $
03:51 mib_9xoohw I was kinda hoping it would work like <%== herlpername q{} %> if you know what I mean
03:52 jberger It has to be a valid perl statement but it should work otherwise
03:52 mib_9xoohw So the lines between <%== %> must be valid perl ?
03:52 jberger Yes
03:54 mib_9xoohw ok that worked them , just included q{ multi line stuff here} and it passed all that as a single string to my helper :), Thanks dude
03:54 jberger No problem
03:54 mib_9xoohw That's been a bug bear of mine for a long time :)
03:55 jberger Btw if you don't want the return value of the helper to be escaped you can have it return a Mojo::ByteStream object
03:56 mib_9xoohw Its even better than I was hoping because I dont need to escape it either, so I could e.g. just a few lines of javascript
03:56 jberger Rather than using the == form every time
03:57 mib_9xoohw I remember reading about that I think it was b('blah') or something
04:00 mib_9xoohw OK, I'm off to play with my new toy
05:04 prajith joined #mojo
05:25 dod joined #mojo
05:30 suede joined #mojo
05:30 dod joined #mojo
05:35 lluad joined #mojo
05:41 prajith joined #mojo
05:43 inokenty-w joined #mojo
05:50 dod joined #mojo
05:56 dod joined #mojo
06:04 polettix joined #mojo
06:36 lluad joined #mojo
06:53 mbudde joined #mojo
07:09 osfabibisi joined #mojo
08:06 osfabibisi joined #mojo
08:06 osfabibisi joined #mojo
08:14 osfabibisi joined #mojo
08:38 trone joined #mojo
08:44 rshadow joined #mojo
09:07 juikuen joined #mojo
09:41 Lee batman: i'm having problem with Mojolicious::Plugin::Authentication and Toadfarm - know anything about that?
09:41 batman no.
09:41 Lee :(
09:41 batman i also have no idea what "having problem" means :(
09:41 Lee seems to crash the child process if returning anything from the validate_user helper
09:42 * Lee digs deeper
09:42 batman can you repruce it with the "Mount" plugin?
09:42 batman *reproduce
09:43 Lee i can't reproduce it on my dev box - same versions mojo, plugins, perl, etc
09:43 Lee friday afternoon fun for me :D
09:43 batman i've never used M::P::Authentication. not sure what it solves :/
09:57 Vandal joined #mojo
10:07 khamsin joined #mojo
10:09 martin joined #mojo
10:32 Lee not much really, but it's already in this app i'm updating
10:52 asarch joined #mojo
11:00 itaipu joined #mojo
11:16 tchaves joined #mojo
11:24 tchaves joined #mojo
11:33 itaipu joined #mojo
11:41 blonewolfs joined #mojo
11:57 itaipu joined #mojo
12:15 Lee joined #mojo
12:42 gizmomathboy joined #mojo
13:13 juikuen joined #mojo
13:23 blonewolfs i'd like to use a variable to supply the data on the right side of => to the template tag select_field.  is this possible?
13:23 martin joined #mojo
13:31 itaipu joined #mojo
13:43 pink_mist have you read the guides? because they quite clearly cover this
13:43 ramortegui joined #mojo
14:48 noganex joined #mojo
14:56 sri really liking kde 5.8, much more intuitive than gnome
14:57 sri whoever designs the breeze theme has good taste
15:19 coolo mr. robot does :)
15:21 vicash coolo: mr robot is a gnome user. Tyrell is the KDE guy
15:22 coolo vicash: sorry, I stopped at 3rd episode for obvious reasons :)
15:32 disputin joined #mojo
15:40 zivester joined #mojo
15:45 ivi joined #mojo
15:57 PopeF0 joined #mojo
16:22 dod joined #mojo
16:24 itaipu joined #mojo
16:27 disputin joined #mojo
17:39 rshadow joined #mojo
18:02 kaare joined #mojo
18:15 PryMar56 joined #mojo
18:50 itaipu joined #mojo
18:58 orev in general, "obvious reasons" are usually only obvious to the person saying that
18:59 jberger I think coolo is trying not to be a spoiler
18:59 jberger which is appreciated
18:59 orev ah, ok
19:00 orev when moulder and scully showed up is was a real surprise
19:00 jberger 🎶 I hope The Smoking Man's in this one ♬
19:01 sri <spoiler>coolo is a kde developer</spoiler>
19:07 sri when i installed gnome on the work laptop he was standing behind me grumbling ;p
19:08 jberger so episode 3 is when Tyrell switches to Gnome also?
19:10 lucas0100 joined #mojo
19:10 lucas0100 Hello there, I'm new to Perl development and I'm using Mojolicious
19:11 lucas0100 so, I've made an object with the Mojo::mysql and made a helper with it
19:11 lucas0100 but I'm struggling to make a query in a controller
19:12 lucas0100 since it says that 'array' is not a defined method for Mojo::mysql
19:12 lucas0100 can someone help me?
19:15 jberger array is a method on the results object
19:15 jberger Mojo::mysql (and the other Mojo-flavored base classes) are connection pools
19:16 jberger so first you have to get a db from the pool (my $db = $mysql->db) then make a query (my $res = $db->query('SELECT ...')) then do stuff like ->array on $res
19:16 jberger that should all be in the documentation
19:21 asarch joined #mojo
19:24 disputin joined #mojo
19:35 suede i have to say, mojolicious::lite looks a lot more appealing to me than regular mojolicious (i'm used to frameworks like Flask)
19:35 suede but it's undeniable that "real" mojolicious is exponentially more powerful
19:35 suede at least as far as i can tell, when it comes to routing
19:36 preaction they're the same thing though. the lite mojolicious can do everything non-lite can. it just looks different, is all
19:38 suede preaction: oh, i didn't realize that
19:38 suede well i suppose i'll get familiar with both and decide which one i like more
19:38 jberger suede: like preaction says they are the same thing, the difference is organizational, which is really useful as the application gets bigger
19:39 jberger also, it is very possible to "Grow" the application from lite to full
19:39 jberger in fact, there's a whole guide on it in the docs
19:39 preaction yeah. i generally choose Lite for simple examples / proof-of-concepts, and then "Full" for anything real
19:39 suede jberger: Flask solves the problem of scaling an apps organization through Blueprints
19:40 jberger suede: I don't know what that is, but on a quick look, perhaps mounting of applications within a parent application would be closest
19:40 suede jberger: that's pretty much what it is, just with routes and not entire applications
19:40 jberger but I don't think that that is the best idea
19:41 suede yeah, it doesn't seem very appropriate
19:41 jberger I think you'd find that putting the controller actions in separate classes and having a centralized router (which is the full app model in mojo) is just as clean and much more readable
19:42 jberger but, you can decide that for yourself as you go
19:42 jberger like preaction I really only use lite for toy/demo apps these days
19:42 jberger but that's not to say that lite isn't fully featured, I just like the structure better
19:43 preaction i find it less weird to test modules than to test lite scripts
19:43 jberger that too
19:49 sri this is so weird, i just can't seem to find a way to ssh into a linux running in vmware
19:49 spicyjack workstation/fusion or esx?
19:50 spicyjack same host/remote host?
19:50 PopeF joined #mojo
19:50 sri fusion
19:51 sri tried nat and bridge, nat even with port forwarding configured
19:51 spicyjack does the linux host have iptables turned on/configured?
19:51 spicyjack can you ssh to localhost in the VM?
19:52 spicyjack you can also just run nc on the linux host, in order to test nat/bridge
19:52 spicyjack nc -l rather
19:52 spicyjack as long as iptables... well...
19:52 sri in the vm i can ssh to localhost and the ip of the virtual interface
19:53 spicyjack is the virtual interface pingable?
19:53 spicyjack from the host, rather
19:55 sri yea, but i think that doesn't mean much, since the vmware nat system has a magical ping feature
19:55 spicyjack are you restarting the virtual networking after your config file changes?
19:56 sri of course
19:56 spicyjack really stupid question, do you have bridging/nat set in the network settings for that vm?
19:56 spicyjack just going through the checklist as it were
19:57 sri yes
19:58 spicyjack you can get out from that vm to other remote hosts?
19:59 sri yea
20:00 spicyjack then it should be working
20:00 spicyjack as you say
20:02 sri iptables look clean too
20:03 spicyjack can you telnet from the host across the bridged/natted port to the ssh daemon and get the SSH daemon header?
20:03 sri https://gist.github.com/anonymous/7aacd8367b9717a9c63687e264bec0da
20:05 spicyjack sri: it's more fun to see the output of iptables-save, as iptables -L doesn't show interfaces, unfortunately
20:05 spicyjack sri: I'm guessing line #4 in that gist is the localhost interface?
20:06 sri https://gist.github.com/anonymous/18c5c7895128ca0a246c2a3210930118
20:06 spicyjack er, loopback interface, rather
20:07 spicyjack I don't see a --ctstate NEW for TCP connections
20:09 spicyjack -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
20:09 spicyjack plus any other ports you want to accept connections on
20:12 khfeng joined #mojo
20:14 sri afraid that didn't work either :(
20:15 spicyjack can you flush all of the rules and change the default action to ACCEPT in order to test connectivity?
20:15 spicyjack or do you know connectivity works, and you're now working on firewall rules?
20:18 sri flushed everything, no change
20:24 sri oh, i got in
20:24 sri it's somehow about privileged ports
20:25 spicyjack that's wonky
20:25 sri switched the sshd to 8022 and suddenly i can connect
20:25 spicyjack are you running sshd by hand as a user?
20:25 sri nope
20:25 sri systemd
20:26 spicyjack you should be able to SSH to the normal port on the vm's IP
20:27 spicyjack do you have firewall rules enabled on the host?
20:27 spicyjack in System Preferences?
20:27 spicyjack I'm not sure how the two network stacks layer on top of each other though
20:28 sri never changed any firewall rules in macos, but that might be it
20:28 spicyjack there's a "Block all incoming connections" checkbox...
20:28 spicyjack but if you have host SSH turned on, that port is opened so you can shell in
20:32 sri yea, that's it
20:32 spicyjack you should be able to add firewall exceptions on the same screen there
20:33 sri didn't find a block all incoming connections checkbox, but if i activate ssh in macos, it lets port 22 through to the vm
20:33 spicyjack I'm guessing you don't have host SSH turned on then
20:33 spicyjack what version of macos?
20:33 sri sierra
20:34 spicyjack okay, I'm still on el cap, so I still have that checkbox
20:34 sri thanks
20:34 spicyjack it's not there in the "Firewall Options" dialog, at the top?
20:35 spicyjack Sys Prefs -> Security & Privacy -> Firewall -> Firewall Options
20:35 sri nope, firewall is off
20:35 spicyjack what version of VMware are you using?
20:35 sri 8.5
20:36 spicyjack I know they just did that 8.5 thing, that's supposed to work with Sierra
20:36 spicyjack sri: n/p
20:36 sri guess it kinda works ;p
20:40 spicyjack oh, yes, of course
20:41 spicyjack vmware can't listen on port 22 of your host, because SSH may already be listening there
20:41 spicyjack can't reopen a port another process already has open
20:41 spicyjack what was the NAT mapping you had set up?
20:42 spicyjack that's only for NAT though, you should still be able to hit port 22 on the virtual host's IP
20:46 itaipu joined #mojo
21:04 sri sorry for going off topic btw.
21:05 sri everything was set to default, and that now works
21:06 sri just had to activate the ssh server in macos, now it lets me reach port 22 on the vm address directly as well
21:08 rshadow joined #mojo
21:17 spicyjack sri: shh, I won't tell if you don't
23:23 spicyjack for the 'routes' command, is it normal to have all of the parts of a route concatented together?
23:23 spicyjack example: /group/:group/projects  GET   groupgroupprojects
23:24 spicyjack sorry, that was example output from 'routes'
23:33 Grinnz https://metacpan.org/pod/Mojolicious::Guides::Routing#Named-routes
23:33 suede I'm using Mojo::Pg, is there a command line tool to do my migrations?
23:33 Grinnz that's the route name, which is autogenerated
23:33 suede i'm really not into doing migrations in-app
23:33 suede and i can't seem to find any documentation
23:34 Grinnz you could make a command for your app that does it
23:34 spicyjack Grinnz: yeah, I didn't realize that it was being used as a route name
23:34 spicyjack Grinnz: thanks
23:35 Grinnz https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Adding-commands-to-Mojolicious
23:37 Grinnz https://metacpan.org/source/SRI/Mojo-Pg-2.30/examples/blog/lib/Blog.pm#L20-21 is basically all that command would need to do, assuming your app has a pg helper or similar

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