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

IRC log for #mojo, 2015-07-18

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

All times shown according to UTC.

Time Nick Message
00:00 mattastrophe joined #mojo
01:28 jzawodn joined #mojo
01:29 sri jzawodn: you forgot the slides
01:41 jberger jzawodn how did the talk go?
01:54 deserted joined #mojo
01:56 jberger ok I need help with a plugin name
01:56 jberger I have a command that I use at $work that lets me run simple ad-hoc sql queries via dbi against our database
01:56 jberger but of course that can't be genericized into just a command
01:57 jberger I'm going to have a plugin that lets you define how to get a dbh handle from your app
01:57 jberger but also it is necessarily DBI
01:57 jberger so does this name sound right while not stealing a more useful name?
01:57 jberger Mojolicious::Plugin::SQLCommand
01:57 jberger ?
01:58 jberger that's what I'm going to call it as I extract if from our codebase anyway and then perhaps people can help me think of a better one once I can show it off
02:00 deserted jberger, are you meaning you can pass raw SQL queries to it?
02:00 jberger yeah
02:01 deserted jberger, SQLRaw no good for you? SQLCommand sounds more like you're working with the server itself rather than running queries
02:01 jberger the "I just want to run this one off SQL and I don't want to have to type 'perl script/app eval -V 'app->dbh->selectall_arrayref("SELECT SOMETHING", { Slice => {})' every time"
02:02 preaction jberger: ysql?
02:02 jberger instead it will be "perl script/app sql 'SELECT SOMETHING'"
02:02 jberger preaction: dammit, you might be right
02:02 preaction http://metacpan.org/pod/ysql
02:03 preaction that project has surely taken a back-seat to the blog, but i still use it when i need to run adhoc sql queries
02:03 jberger maybe you are the reason I had the idea, but it was subconcious enough to forget the details
02:03 preaction heh, i hate when that happens ;)
02:04 jberger the difference might be that I want to use a dbh helper that is already available from the app rather than having to pass in configuration
02:04 jberger (or use another config file)
02:04 preaction yeah, that'd be a difference ;)
02:04 jberger are the ysql guts modular enough to delegate to it?
02:05 preaction not... as such... that's the crucial feature i want but haven't been able to get to
02:05 jberger well, let me get to a certain point with what I'm doing and then I'll ping you
02:05 preaction it'd be awesome to do: ysql( $dbh, 'SELECT * FROM foo' )->print
02:06 preaction that's back when i was playing with overload and how perl warns if you don't overload the right things
02:08 jberger preaction: you could wrap it in a Mojo::ByteStream and then do ->say
02:08 noganex joined #mojo
02:08 jberger or a similar blessed scalar really
02:08 preaction i was thinking IO::Async, but yeah
02:09 preaction but getting ysql( ... ) | *STDOUT; working didn't seem possible without Perl warning at least once
02:10 sri ./myapp.pl eval -v 'app->pg->db->query("select * from foo")->text'
02:12 jberger sri: if only I were using Pg and Mojo::Pg
02:14 jberger ok so this is the code: https://github.com/jberger/Mojolicious-Plugin-SQLCommand/blob/master/lib/Mojolicious/Plugin/SQLCommand/sql.pm
02:14 jberger but it has to be a plugin so that I can have a chance to add the "get handle" mechanism without having to be opinionated: https://github.com/jberger/Mojolicious-Plugin-SQLCommand/blob/master/lib/Mojolicious/Plugin/SQLCommand.pm
02:17 jberger deserted: sorry I didn't respond to you, I guess I see that point, but in my mind it is a plugin that adds a mojolicious command
02:17 jberger much in the way that Mojolicious::Plugin::Minion adds a minion command to your app
02:28 jberger preaction: ping
02:33 preaction looks good to me. though would JSON be a good idea? then you could pipe into jq()
02:34 preaction also, why distinguish --all?
02:34 preaction if you only want one, SELECT TOP 1 or SELECT ... LIMIT 1
02:34 mtj- joined #mojo
02:35 jberger perhaps you are right, just always do the all form
02:37 preaction oh, if you did the prepare(), execute(), fetch() way, you wouldn't need a -d form either. fetch() would just return nothing for INSERT/UPDATE queries
02:40 jberger would I still get rows affected?
02:50 mtj- joined #mojo
03:16 preaction $sth->rows ,yes
03:20 jberger but that still requires knowing if I was doing select or otherwise
04:03 arpadszasz joined #mojo
04:16 trone joined #mojo
04:53 kaare joined #mojo
05:04 * jberger just accidentally agar.io for 2 hours
05:04 jberger oops
05:04 jberger oh well nn
05:08 * sri decides to give up programming and become a professional hearthstone player
05:27 preaction all $sth have ->rows. 0 is a possibility
05:27 preaction so if you do actually get the sth, then you can do everything without caring
05:28 preaction https://github.com/preaction/ETL-Yertl/blob/master/lib/ETL/Yertl/Command/ysql.pm#L147 <- i don't do anything but make the sth, execute, and fetch
05:28 Craftsmanship joined #mojo
05:54 Craftsmanship joined #mojo
05:57 chansen joined #mojo
05:58 irqq joined #mojo
06:21 cpan_mojo Mojo-Redis2-0.24 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-Redis2-0.24
06:43 irqq_ joined #mojo
07:26 dotandimet joined #mojo
08:09 Vandal joined #mojo
08:30 dotandimet joined #mojo
08:39 berov1 joined #mojo
08:46 amon joined #mojo
08:46 mattastrophe1 joined #mojo
08:51 trone_ joined #mojo
09:28 dod joined #mojo
09:35 dod joined #mojo
09:43 jberger joined #mojo
09:51 dotandimet joined #mojo
10:51 dotandimet joined #mojo
11:05 Craftsmanship joined #mojo
11:35 Craftsmanship is there any reason to not just let templates on disk auto-route?
11:46 punter joined #mojo
11:51 kaare_ joined #mojo
12:29 sh4 joined #mojo
12:31 absolut_todd joined #mojo
12:40 frederico joined #mojo
12:41 mattastrophe joined #mojo
12:49 dod joined #mojo
12:52 trone joined #mojo
13:12 jberger joined #mojo
13:47 berov1 joined #mojo
13:53 trone joined #mojo
14:30 dod joined #mojo
14:38 cpan_mojo Etherpad-1.2.12.0 by LDIDRY https://metacpan.org/release/LDIDRY/Etherpad-1.2.12.0
15:14 PotatoGim^Home joined #mojo
15:19 zivester joined #mojo
15:26 oetiker joined #mojo
15:31 PryMar56 joined #mojo
15:59 Averna joined #mojo
16:08 Averna left #mojo
16:11 kaare_ joined #mojo
17:11 thowe I'm surprised at how much code I can remove in moving this to Mojo
17:14 dotandimet joined #mojo
17:20 dexteruk joined #mojo
17:24 batman mst: not sure if you've seen this thread: http://twitter.com/substack/status/621818964885176320
17:24 batman (About flux)
17:25 mst batman: the replies point out how confused he is quite nicely
17:26 mst it is a pattern. facebook shared their implementation of that pattern, and specifically said it's just a pattern
17:26 mst however the discipline of the pattern is really useful
17:26 mst I've seen what happens to react apps that use 'just an event emitter'
17:27 mst it ... isn't pretty
17:29 mst also, redux is really nice, just they're in the middle of renaming everything for 1.0
17:29 dod joined #mojo
17:32 dotandimet1 joined #mojo
17:35 mattastrophe joined #mojo
17:36 Kogurr joined #mojo
17:44 dotandimet joined #mojo
17:51 trone joined #mojo
17:57 pink_mist I ... I'm not sure what to think anymore! https://i.imgur.com/OM7OUYX.jpg
17:59 mattastrophe joined #mojo
18:02 jberger pink_mist: stop being so closed minded!
18:02 jberger purl: Bender?
18:02 purl Bender hit on jberger or on Freenode. or a poor judge of character
18:02 Bender jberger: Call me a psycho bitch, but my brains are arousing weapons.
18:04 Bender pink_mist: Has anyone ever told you that never in my most retarded dreams did I think I'd have a chance to drool over a teenager like you?
18:05 pink_mist 0_o
18:05 mst I think it likes you.
18:05 Bender pink_mist: Caress me if I'm wrong, but don't I know you?
18:06 * pink_mist bites Bender's shiny metal ass
18:07 dotandimet joined #mojo
18:30 Perlbotics joined #mojo
18:33 Perlbotics left #mojo
18:44 dod joined #mojo
18:46 brainbuz joined #mojo
19:06 dotandimet joined #mojo
19:17 batman mst: then I guess there's something I've missed.
19:18 batman Anyhow. Substack isn't just "anybody". At least not to me.
19:18 batman I think he has done some very clever things, so I appreciate his input.
19:19 batman Especially when I agree, hehe
19:19 mst batman: well, no, he's a freenode #perl regular of old and very good at making stuff work
19:19 batman Anyway... I'm not up to a discussion now. Just sharing point of views.
19:20 mst batman: but he'd very much missed the point there
19:20 batman I see.
19:20 mst batman: that's actually my biggest worry about react+flux - getting people to understand the damn thing :)
19:20 mst basically, there's at least one 'aha' moment in there
19:20 mst ala monads, or resultset chaining
19:21 mst and while things that involve 'aha' moments are, once you've got them, one of the best things ever
19:21 mst it's worth minimising the number required to use something
19:21 batman I had an "aha" moment when I watched the talk on how Facebook decign their apps. About how the flow of information goes.
19:22 mst right, and I don't think substack's got as far as grasping that so is getting hung up on the implementation details
19:22 batman But that doesn't really reflect (no pun inteded) back to flux.
19:22 mst hrm?
19:23 mst but all flux *is* is a flow-of-information pattern
19:23 batman But it's also the name of an implementation.
19:24 mst facebook's boilerplate heavy implementation is, so far as I can see, a "we're not sure how to generalise/abstract this yet so we're going to wait rather than do it wrong" thing
19:24 mst relay is going to be the sugar layer, in effect
19:25 batman If that's the status now, then I will shit up an look at it again.
19:25 lb it's in flux?
19:25 mst hence why there are multiple other implementations that are evolving the ideas
19:25 mst notably redux, which is mentioned in that thread
19:25 batman It wasn't the way when I looked at it a year ago...
19:25 mst facebook -always- said it was a pattern
19:26 sri try #react?
19:26 batman But then again... "A year" in JavaScript is like a lifetime in other languages ;)
19:26 mst right, and there's been at least a dozen fluxish things written since
19:26 mst of which redux makes the event sourcing style much more explicit
19:26 batman sri: I will shut up now.
19:27 batman mst: I have to run.
19:27 mst it's worth a bit more of a dig; the ideas are useful even if you don't like any of the implementations
19:27 batman This is very interesting, but beer is calling ;)
19:27 mst aye. later.
19:28 batman Yeah +1 on that! I <3 the ideas.
19:28 mst batman: https://medium.com/@dan_abramov/the-evolution-of-flux-frameworks-6c16ad26bb31
19:28 mst batman: that might help give you some context
19:28 batman Bookmarked!
19:29 mst then our work here is done. go drink :D
19:29 yt7fms joined #mojo
19:29 batman Thanks. I hope I will be back stronger. Faster. Harder.
19:30 sri seriously, what's the mojolicious connection here?
19:31 batman sri: Awesomeness.
19:31 purl awesomeness is measured in the metric convention (hobbs)
19:31 sri i for one have zero interest in react
19:31 mst that it's a technology one might use in combination with mojo
19:31 mst just like we have conversations about postgresql in here sometimes
19:32 sri which is on topic because of Mojo::Pg
19:32 sri official spin-off project
19:33 batman sri: I really don't see how generic discussions about web hurts as long as it doesn't disrupt other ongoing discussions.
19:34 sri your discussion was about using something called flux with react, it't not even about perl
19:34 sri i don't mind it if it's short
19:34 mst if somebody'd started a specifically mojo conversation I'd've dropped it, but since the channel was quiet, discussing related technologies doesn't seem like a big deal
19:34 sri but you just kept going
19:34 batman sri: right. That's why we stopped :)
19:35 batman mst: +1
19:35 purl 1
19:35 sri if random garbage is on topic here, i'll have to stop reading the backlog again
19:35 mst I was trying to explain something to batman. you know as well as I do that's not always the briefest of conversations.
19:36 yt7fms HI all! Q: I have mojo routes and an ajax function for one of them. That one is under "under" and it checks if session is active, if not, it redirects to "login" route. Everything works, except if I delete a cookie from a browser and trigger ajax req. Server does return a HTTP302, and than HTTP200 for login route, but browser does not render it. This might not be the Q bound for Mojolicious, but I dont know, thought to give it a shot :) SO
19:36 yt7fms rry in advance if perhaps off-topic.
19:36 mst if the request is from javascript, surely you'll get the 200 login page back as your response in javascript
19:37 meredith If I'm reading you right, you want the AJAX request to kick the whole page over to login when they're not authenticated?
19:37 mst and the browser won't do anything with it, because you're supposed to be doing something with it
19:37 meredith ^  You'll need your JS to look for an error or follow a redirect.
19:38 sri maybe time for me to actually take a break again
19:38 trone joined #mojo
19:39 yt7fms meredith, yeah, that is the goal. Thought that mojo could somehow force redirect. mst, thought so myself, but, just to be sure.
19:40 mst yt7fms: well, no, because the redirect is of the http request - that 200 might've been a JSON result or something, or an HTML fragment for the javascript to use
19:43 yt7fms mst, yeah, I need to catch that first 302 from mojo before 200.
19:43 mst yt7fms: or ... don't do loginwalling that way
19:43 mst yt7fms: have it return 'not authorised' for JSON API endpoints
19:46 yt7fms mst, without the redirect from mojo if I understand correctly. Just to stop at "401 not authorised"? Another "under" directive for those routes specific for ajax.
19:47 mst right. I never 302 on not-logged-in - I 401 for an API, and do http://shadow.cat/blog/matt-s-trout/humane-login-screens/ for HTML
19:49 yt7fms Right! Thank You very much! I'm on to reading that link.
19:50 mst it's a slightly odd approach at first sight but it works really nicely
19:58 mattastrophe joined #mojo
20:13 irqq_ joined #mojo
20:13 mattastrophe joined #mojo
20:37 initialo joined #mojo
20:39 inokenty joined #mojo
21:18 jberger joined #mojo
21:18 * jberger has no power
21:19 * jberger thanks odin for cellphone internet
21:37 jberger_ joined #mojo
21:37 jberger joined #mojo
21:49 zivester joined #mojo
22:30 jnbek joined #mojo
22:35 melcher joined #mojo
22:39 sivoais joined #mojo
22:46 mattastrophe joined #mojo
23:16 jberger https://instagram.com/p/5S4LiWsTFa/
23:17 preaction BA-NA-NA?
23:25 zivester joined #mojo
23:28 jberger BANANA!
23:28 purl i guess banana is at http://www.dole5aday.com/bobby/main_menu_bobby.html or a useful tool in many situations or Build Absolutely Nothing Anywhere Near Anything or not an effective weapon or at http://www.bananasite.com/banana/ or http://cad-comic.com/comics/20070901.jpg or http://www.ethomaz.com/?p=52 or  Build Absolutely Nothing Anywhere Near Anything (or Anyone).
23:28 jberger Wow that needs some cleanup ^^
23:30 bpmedley joined #mojo
23:34 absolut_todd joined #mojo
23:59 jontaylor joined #mojo

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