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

IRC log for #mojo, 2015-05-12

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

All times shown according to UTC.

Time Nick Message
00:04 * tempire didn't ignore the issue
00:05 * tempire was mostly off the computer for the weekend
00:11 mattastrophe joined #mojo
00:41 GabrielVieira joined #mojo
00:43 lluad joined #mojo
01:06 klapperl joined #mojo
01:08 mattastrophe joined #mojo
01:10 Vertig0 joined #mojo
01:18 oetiker joined #mojo
01:40 hshong joined #mojo
02:08 noganex_ joined #mojo
02:50 zivester joined #mojo
04:01 melo joined #mojo
04:06 melo joined #mojo
04:17 davido__ joined #mojo
04:30 vmb joined #mojo
04:32 melo joined #mojo
04:33 melo joined #mojo
04:42 damaya joined #mojo
04:43 damaya Is it possible to pass a data structure into template, have form fields fill the values of the data structure, and pass it back on submit?
04:50 kaare joined #mojo
04:54 Snelius yes, it possible
04:58 damaya Thank you!
05:14 fhelmber_ joined #mojo
05:43 dod joined #mojo
05:47 dod joined #mojo
05:48 Lee joined #mojo
06:05 dod joined #mojo
06:15 bramirez joined #mojo
06:16 bwf joined #mojo
06:27 bwf joined #mojo
06:34 davido___ joined #mojo
06:50 stl joined #mojo
07:19 trone joined #mojo
07:30 dod joined #mojo
07:44 fhelmber_ joined #mojo
07:49 niczero Snelius: How would you do that?
07:50 niczero Serialise the structure and use js to update it from the form fields?
07:50 Vandal31341 joined #mojo
07:52 niczero Is it possible downforeveryoneorjustme.com can't check ipv6-only sites
08:11 bramirez joined #mojo
08:25 OmarOthman joined #mojo
08:28 niczero I'm having to forget about embedded apps for the time-being
08:28 niczero The hurdle is server-side sessions -- an investment I don't have time for right now
08:31 inokenty joined #mojo
08:35 melo joined #mojo
08:50 marcus o/
08:51 marcus I guess there is no need for us to vote anymore.
08:52 firnsy joined #mojo
08:55 OmarOthman left #mojo
09:10 bpmedley joined #mojo
09:13 Lee joined #mojo
09:33 niczero IMO the introduction of '//' was a small revolution for readability
09:34 niczero Being able to write ($a // '') =~ /stuff/ or ($a->privs // {})->{role}
09:43 Insane joined #mojo
10:21 AndrewIsh joined #mojo
10:33 mattastrophe joined #mojo
10:46 melo joined #mojo
10:57 mattastrophe joined #mojo
11:14 Kripton joined #mojo
11:33 dod joined #mojo
12:01 bpmedley_ joined #mojo
12:03 neilhwatson joined #mojo
12:18 dod joined #mojo
12:22 bramirez joined #mojo
12:24 zivester joined #mojo
12:30 dvinciguerra joined #mojo
12:38 dod joined #mojo
12:47 zackiv31 joined #mojo
12:53 ajr_ joined #mojo
12:54 mattastrophe joined #mojo
13:31 dod joined #mojo
13:34 sri we have a serious voting problem
13:34 sri i'd appreciate proposals for how to fix that
13:35 Insane whats up?
13:35 purl the sun!
13:42 asarch joined #mojo
13:48 zackiv31 joined #mojo
13:55 batman sri: i'm sick. so count me out :(
13:56 * genio pets purl
13:56 * purl pets genio back, harder
13:56 marcus I vote that purl has to leave the island.
13:56 Grinnz i vote that purl is in charge of merging all new changes
13:56 * genio pushes purl down the stairs
13:56 * purl dodges and laughs as genio loses balance and crashes down the stairs.
13:57 genio she's too smart for me
13:57 marcus purl: botsnack
13:57 purl :)
14:03 kyshtynbai joined #mojo
14:06 zackiv31 joined #mojo
14:06 hummeleBop joined #mojo
14:09 kyshtynbai Hi all. I've notices, that if I make a GET request to a file, (site.com/dir/file.jpg) and such file exists in publiv/dir, this file is passed to the client at once, and there are any log entries at the morbo's output. Can I change this behavior? What I want is to restrtict direct GET requests to some files/ I'm using Mojolicious::Lite
14:10 kyshtynbai s/there are any/there are no/
14:12 neilhwatson I think that logging is left to the application developer. So, yo have to build your own, but mojo probably has some examples in the docs.
14:12 GabrielVieira joined #mojo
14:14 neilhwatson http://mojolicio.us/perldoc/Mojo/Log
14:15 dvinciguerra joined #mojo
14:15 neilhwatson ANd I think you can restrict your gets by using a regex in  your route.
14:15 ZoffixWork joined #mojo
14:16 Grinnz kyshtynbai, the static router happens before any routing gets involved, this is why it doesnt get logged
14:16 Grinnz kyshtynbai, this makes sense to me, to keep the overhead low
14:16 Grinnz kyshtynbai, but if you want to restrict static routing, you can serve static files manually from a route
14:17 Grinnz "static router" probably wasnt the best choice of words
14:18 Grinnz i always have trouble finding this doc section...
14:18 kyshtynbai So, if the static files are processed before the routing is involved, I guess regexping a route will not help?
14:19 Grinnz kyshtynbai, you will want to add a route which will match that static file's path, and serve it yourself: https://metacpan.org/pod/Mojolicious::Guides::Rendering#Serving-static-files
14:19 kyshtynbai Thanks!
14:20 jberger kyshtynbai: http://mojolicio.us/perldoc/Mojolicious#HOOKS
14:20 ZoffixWork Hey, I'm trying to figure out how to do the following: a request through a websocket stuffs some data into a db that an external app monitors and in a few seconds updates the row I've just inserted. When that happens, I want to respond with my websocket to the browser what what that updated data is. Here's what I got so far: http://fpaste.scsys.co.uk/478504
14:20 Grinnz i.e. for one route i did something like /static/*path => serve file based on path parameter
14:20 jberger kyshtynbai: and probably http://mojolicio.us/perldoc/Mojolicious#before_dispatch
14:20 Grinnz hooks won't help with the static file serving
14:20 Grinnz oh that one could
14:20 ZoffixWork I can't sort out how do I do the db look up + response back once data updates bit. Looks like something that might involve __SUB__ but I can't seem to be both $c and db results in the same callback
14:20 jberger hook before_dispatch => sub { my $c = shift; $c->app->log($c->req->url) };
14:21 jberger oh, ->log->info(...)
14:22 sri http://mojolicio.us/perldoc/Mojolicious#after_static
14:22 Grinnz ZoffixWork, i don't understand what you're tring to use __SUB__ for there
14:23 ZoffixWork Grinnz, look up db again, to check whether the data updated.
14:23 jberger I was assuming kyshtynbai wanted logging on all requests, thus my choice of hook; sri's is what you want if you only want access logging on static files
14:23 ZoffixWork ... the check is currently missing from my example, because I couldn't figure out how to differentiate between websocket callback and db callback.
14:24 * ZoffixWork is about to try something weird now
14:24 Grinnz ZoffixWork, why do you need to check again? either it was updated by the insert or it wasnt
14:24 Grinnz ZoffixWork, i would think doing the $c->send as a callback from the insert query would be nicer, so that query doesn't block
14:25 sri ZoffixWork: postgres notifications
14:25 purl postgres notifications are complicated
14:25 Grinnz purl, no they aren't
14:25 purl Grinnz: sorry...
14:26 sri purl: no, postgres notifications are awesome
14:26 purl okay, sri.
14:26 Grinnz hehe
14:26 ZoffixWork I was about to be clever http://fpaste.scsys.co.uk/478506 but I'll take a look at postgres notifications :) Thanks
14:27 sri ZoffixWork: in Minion i actually use a trigger function to notify workers that a new job has been inserted https://github.com/kraih/minion/blob/master/lib/Minion/Backend/Pg.pm#L419
14:27 Grinnz ZoffixWork, oh, i missed " that an external app monitors and in a few seconds updates the row I've just inserted"
14:27 ZoffixWork Sweet. I'll take a look into that
14:27 Grinnz ZoffixWork, yeah, pub/sub would be ideal for that
14:28 ZoffixWork Thanks. Grinnz++ sri++
14:28 Grinnz subscribe to a channel, insert, then the external app can simply publish to that channel when done
14:29 sri if you were using Mojo::Pg, you could just use this to wait for notifications http://mojolicio.us/perldoc/Mojo/Pg#pubsub
14:29 ZoffixWork Hm, actually I lied a bit, now that I think of it.
14:30 ZoffixWork The "external app" actually simply does a GET to another route in a few second to this same app and that route updates the db
14:30 ZoffixWork I wasn't sure if that's relevant, since I don't know if there's a way to respond to my websocket from that other route
14:31 Grinnz ZoffixWork, not directly, but you can have the other route publish to Pg as well
14:31 Grinnz instead of the external app
14:31 ZoffixWork Alright. I'll try that.
14:31 sri bottom line, you want pubsub
14:31 Grinnz ^^
14:31 ZoffixWork :)
14:32 sri i'm sure you know the chat example by now, but here it is again https://github.com/kraih/mojo-pg/blob/master/examples/chat.pl
14:32 sri websocket pubsub that scales to many servers
14:36 Grinnz websockets + pubsub = event loop heaven
14:39 sri the ability to have trigger functions in postgres send notifications still amazes me
14:39 gryphon joined #mojo
14:41 * sri sooo can't wait for postgres 9.5 with upsert and skip locked
14:41 ZoffixWork Data isn't stored in the db in that chat example?
14:41 jberger upset++ \o/
14:41 ZoffixWork I'm staring at that code like it's some sorcery lol :)
14:42 sri nope, notifications are ephemeral
14:42 sri stored in shared memory until they have been delivered to all subscribers
14:42 ZoffixWork :O
14:43 jberger ZoffixWork: and remember, that's hypnotoad safe, in like 30ish lines of code <3
14:44 sri this would be the same example without the ability to scale past one process https://github.com/kraih/mojo/blob/master/examples/chat.pl
14:45 sri you're really just sending messages around
14:46 ZoffixWork jberger, yeah, it's pretty insane. I wrote a CGI web chat for $work about 7 years ago... Can't find the code any more, but it sure was more than 30 lines lol
14:51 ZoffixWork Found it. Perl code alone is 450 lines :P Granted it had "rooms" like on IRC, but that addition would be like a few more lines with Mojo still P
14:52 genio ugh.  I wrote something like that in the 90s.  I'm glad I don't have it around any longer to see how terrible it was
14:53 jberger ZoffixWork++, nice find!
14:57 Grinnz_ ZoffixWork: yeah pubsub makes this stuff so much simpler.
14:57 Grinnz_ even local pubsub like EventEmitter
14:58 mst Event::Distributor helps for that
15:02 AirDisa joined #mojo
15:03 dotan joined #mojo
15:07 kyshtynbai Guys, I know I'm dumb but I cannot understand one thing: if I have to restrict dispathing of a specific static file addressed via GET requet, how do I do it if the serving of static files is done before the routing takes place?
15:07 Ptolemarch joined #mojo
15:07 dotan joined #mojo
15:08 mst kyshtynbai: don't have it served as a plain static file
15:08 mst kyshtynbai: use an actual route to serve it
15:10 kyshtynbai mst: could you please provide an example of such a route? For instance, we have files located in public/images/secret.
15:11 mst ...
15:11 mst if it's secret
15:11 mst DO NOT PUT IT IN PUBLIC
15:13 sh4 joined #mojo
15:16 Grinnz_ lol
15:18 jberger mst: Event::Distributor looks fairly comparable to Mojo::EventEmitter, no?
15:19 Grinnz_ as is Beam::Emitter :P
15:19 jberger kyshtynbai: http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Serving-static-files
15:19 mst jberger: no, Mojo::EventEmitter is more Mojo's version of IO::Async::Notifier
15:19 purl okay, mst.
15:20 mst I think
15:20 Grinnz_ mst: no
15:20 Grinnz_ it's not an event loop thing
15:20 Dandre joined #mojo
15:20 Grinnz_ it's pubsub through an object
15:21 mst Grinnz_: IO::Async::Notifier provides exactly that, *and* tools to attach itself to an IO::Async::Loop
15:21 Grinnz_ mst: Notifier is quite a bit more complex, it seemed to me
15:22 mst the 'utility methods' are pretty much the same thing as EventEmitter
15:23 mst I think maybe one could argue that EventEmitter does kinda both
15:23 Grinnz_ Event::Distributor looks exactly like what EventEmitter does
15:24 Grinnz_ (in design)
15:24 mst I think Mojo objects subclass EventEmitter for both Ev::Dist style cases and IOA::Notifier style cases
15:25 Grinnz_ maybe
15:29 Dandre joined #mojo
15:31 ghandi|work joined #mojo
15:32 ghandi|work Hi there!
15:32 purl Hi there! is there a smart way to use inheritance of a db in dbic?
15:32 Grinnz_ purl: you're not supposed to be asking the questions
15:32 purl Grinnz_: huh?
15:32 ghandi|work Anybody got an example of streaming uploads in mojolicious? (NOT multipart like in the Mojo Cookbook).
15:32 Grinnz_ purl: forget Hi there!
15:32 purl Grinnz_, I didn't have anything matching hi there
15:32 mst no, purl, Hi there\! is <reply>
15:32 purl okay, mst.
15:32 mst Hi there!
15:32 * mst wins
15:35 kyshtynbai thanks. But as far as I understand, using reply->static will not allow filenames to be inserted into <img> tag in the template. I'm just writing a siple gallery - if session is set, it displays thumnails, if session is not set - it returns an error and redirects to login page. It works (I use under statements) but I still can address images directly.
15:35 mst kyshtynbai: why won't reply->static work?
15:36 mst I have no idea why you think <img> and reply->static care about each other at all
15:36 Grinnz_ kyshtynbai: all reply->static is doing is using a route to serve static files instead of the static router
15:36 mst right, it's the exact same code
15:36 mst try and avoid imagining extra problems that don't exist - programming is hard enough when you only have to deal with the real ones.
15:37 Grinnz_ kyshtynbai: as a side effect, routes can have unders, and other conditional logic
15:37 disputin joined #mojo
15:37 Grinnz_ kyshtynbai: but they're accessed as urls like any other route
15:51 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Custom-responses
15:57 sh4|2 joined #mojo
16:00 ajr_ joined #mojo
16:07 kyshtynbai Thanks. last dumb question for today (so do I promice). I would be very gratefull for a small example of using reply->static in combination with template).
16:08 Grinnz_ kyshtynbai: reply->static would not render a template, that is by definition not a static file
16:12 mst kyshtynbai: that question makes no sense
16:12 mst kyshtynbai: have your <img> tag point at the route you've declared
16:12 mst kyshtynbai: use reply->static in the route
16:12 mst kyshtynbai: there is no magic here.
16:13 kyshtynbai Wais
16:13 kyshtynbai wait
16:13 kyshtynbai I think I got it
16:13 kyshtynbai gonna try
16:13 ajr_ joined #mojo
16:16 ajr_ joined #mojo
16:25 kyshtynbai Thanks everyone! Now it works just as I wanted it to work!
16:41 ToApolytoXaos joined #mojo
16:48 ajr_ joined #mojo
16:56 Grinnz_ \o/
17:36 dod joined #mojo
17:40 trone joined #mojo
17:47 berov joined #mojo
17:47 trone joined #mojo
17:48 trone joined #mojo
17:54 sri Grinnz_: btw. i'm already bored again with diablo 3 :S
17:54 trone joined #mojo
17:56 trone joined #mojo
17:59 trone joined #mojo
18:01 trone joined #mojo
18:14 Grinnz_ heh
18:29 kyshtynbai What text editors do have a correct syntax highlite of mojo's .ep templates? I use vim with vim.mojo plugin, but it colors html and embedded perl a bit strange.
18:33 amon joined #mojo
18:37 GabrielV_ joined #mojo
18:40 lluad Sublime text has a plugin to support it, and I know you can do it with multimode in emacs.
18:41 lluad ( https://github.com/SublimeText/Mojolicious )
18:43 sri atom
18:45 kyshtynbai oh, they've made windows installer for atom
18:45 lluad Maybe I need to look at atom again.
18:46 kyshtynbai last time I checked it, there were only mac tarball(or how is it called on macos) and sources for windows
18:46 kyshtynbai and I could not compile int on win 7
18:46 AirDisa_ joined #mojo
18:49 kyshtynbai does atom supports editing via ssh? BTW, how do you guys usually deploy code to remote servers? Git/sfhp or...?
18:51 lluad I mostly use either git or rsync-over-ssh to deploy
18:53 punter joined #mojo
19:00 cfedde does atom have a reasonable perl mode
19:00 cfedde ?
19:01 cfedde some of our deployment se FPM to make RPM that are deployed using puppete.
19:01 cfedde via jenkins.
19:01 lluad cfedde: https://atom.io/packages/language-mojolicious makes it look more than reasonable :)
19:02 cfedde But there is way more EIP in our environment than I like.
19:02 * cfedde goes to retry atom.
19:10 cfedde that looks like it'll work ok.
19:23 lluad EIP?
19:23 purl EIP is probably Engineering In Place.  See also Big Ball of Mud. or Extremely Incompetent Programmers or Extended Instruction Pointer or Excellence In Podcasting
19:25 neilhwatson purl: you crack me up
19:25 purl neilhwatson: i'm not following you...
19:28 * cfedde pets perl
19:29 cfedde In my case EIP was expected to refer to the first second and third of the above.
19:30 * cfedde pets purl too.
19:30 * jberger pats purl
19:30 * purl bites!
19:31 genio She's a feisty old lady
19:39 jabberwok no bot should byte the hand that $rss->feed()s
19:39 * cfedde pushes purl down the stairs
19:39 * purl attaches herself to cfedde using suction and a ham straw
19:42 AirDisa_ joined #mojo
19:49 Repaster joined #mojo
19:49 melo joined #mojo
19:56 Grinnz_ Repaster: is now officially an instance of Bot::Maverick :P
20:13 Ptolemarch joined #mojo
20:35 melo joined #mojo
20:40 Grinnz_ hmm... i wish github had some way to say "render this .pm file with your POD rendering thingy"
20:40 Grinnz_ but not into another file, just for display
20:44 ajr_ joined #mojo
20:48 stokachu joined #mojo
20:51 jberger Grinnz_: sco has that
20:51 jberger I've asked about metacpan and they don't have one yet
20:51 Grinnz_ jberger: this isn't on cpan yet
20:52 jberger github, doubtful, their pod rendering is an afterthought it seems, though we are lucky to have even that
20:52 Grinnz_ jberger: on metacpan you can just go to the module pod page, if theres pod embedded
20:52 jberger Grinnz_: sco has a way to render pod before you upload the module
20:52 mattastrophe joined #mojo
20:52 Grinnz_ huh?
20:52 Grinnz_ if it's not uploaded why would sco be involved at all
20:52 jberger http://search.cpan.org/pod2html
20:52 purl http://search.cpan.org/pod2html is handy if you want to see what it looks like
20:52 jberger thanks purl
20:53 jberger botsnack
20:53 purl thanks jberger :)
20:53 Grinnz_ oh, it's just a one-off page?
20:53 jberger yeah
20:53 Grinnz_ cool
20:53 jberger in sco styling
20:53 Grinnz_ naturally heh
20:53 Grinnz_ i want something specifically in github though, the point was to not do extra work ;)
20:53 Grinnz_ ah well, wishful thinking
20:57 jabberwok .rmm (read my mind)
21:07 Ptolemarch joined #mojo
22:07 Zoffix joined #mojo
22:14 mattastrophe joined #mojo
22:22 punter joined #mojo
22:23 bc547 joined #mojo
22:34 trone joined #mojo
23:03 asarch joined #mojo
23:08 bpmedley joined #mojo
23:50 dvinciguerra joined #mojo
23:56 mattastrophe joined #mojo
23:57 inokenty joined #mojo

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