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

IRC log for #mojo, 2015-08-13

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

All times shown according to UTC.

Time Nick Message
00:11 genio I found a way to kill atom. :/
00:13 genio apparently working on a win10 workstation via samba share on a mac is no bueno.  linux samba shares and other windows shares are not problematic
00:14 Grinnz I consider it an accomplishment just to get samba working between two OSes to begin with
00:14 Adura Who put Win10 on a "workstation"?
00:15 nicomen 68 MB deb package
00:15 nicomen wtf?
00:15 genio I usually don't have any problems dealing with shares.  Windows Explorer doesn't give any indication of a problem when navigating all through the share
00:15 nicomen does it include emacs too?
00:16 nicomen and an OS?
00:16 Grinnz nicomen, no no, emacs is what you install the deb to
00:16 nicomen everytime I'm trying atom, I end up trying padre, and going back to nano/geany
00:17 genio I like geany well enough.  I'm on Windows, so I guess I could see if I can work within Notepad++.
00:17 meshl joined #mojo
00:17 Grinnz i just X-forward gedit from the server
00:31 bwf joined #mojo
00:35 genio odd. Sublime Text v2 and v3 also have problems seeing changes on that samba share (although they don't crash)
00:36 absolut_todd joined #mojo
00:44 augensalat joined #mojo
01:03 mst PopeFelix: enough. I bet the split was a hubfail because $provider failed
01:04 genio Mojo is the word of the day! http://imgur.com/bXwylru
01:16 good_news_everyon joined #mojo
01:16 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v3abw
01:16 good_news_everyon mojo/master 761e525 Sebastian Riedel: Perl 5.22 is out already
01:16 good_news_everyon left #mojo
01:18 good_news_everyon joined #mojo
01:18 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v3abh
01:18 good_news_everyon mojo/master 4681e1f Sebastian Riedel: we support the last two releases of Perl
01:18 good_news_everyon left #mojo
01:27 Grinnz joined #mojo
01:28 sri neat, mojolicious has been shrinking by 9 lines since 6.0
01:30 sri and by 205 lines between 5.0 and 6.0
01:31 sri and by 2608 lines between 1.0 and 6.0 :o
01:31 genio now that's surprising.
01:31 mst not really
01:32 mst brilliant, but not surprising
01:32 mst the compat policy has allowed sri and the rest of the core team to distill Mojo down over time
01:32 mst it's amazing work, but I'm not surprised
01:33 mst for all my disagreements with sri, I expected nothing less
01:33 nicomen compat policy?
01:33 mst sri++ # nicely done
01:33 genio staying compatible with later versions of Perl and being able to drop ancient stuff
01:33 nicomen I would say the clean and well-thoughtly written code had much to do with it
01:34 mst yes, but the willingness to break older code is what's kept the underlying system clean
01:34 mst it's a trade-off
01:34 nicomen isn't mojo compatible with perl 5.10.1 or so?
01:34 mst nicomen: I mean 5.0 versus 6.0 etc.
01:34 nicomen oh right
01:34 nicomen then I see what you mean
01:34 mst library compatibility, not perl interpreter compatibility
01:35 genio ah, my bad
01:35 mst I often work quite hard to keep compat with old APIs, and end up paying the price in terms of retained older code
01:35 mst it's a trade-off
01:35 nicomen although it's not huge incompat, so still I think the effort in minimzing code is much more than not caring as much as other about major version backward compatiblity
01:35 mst Mojo takes the other side of said trade-off, and does it beautifully
01:36 mst sure. though the people upset because they can't sell blood diamonds anymore disagree.
01:37 nicomen speaking of where are the killie7 campaigns for perl588 and basically everything more than 10 years old
01:37 mst I still support 5.8.1 happily
01:37 mst once I have my current deployment code working
01:38 mst I'll be releasing code that requires 5.22
01:38 mst "if this isn't easy enough for you to want it, file a bug against my deployment code" will apply, basically
01:39 sri nicomen: installable on 5.10.1, not optimized
01:40 genio EL 5 is all but out of the window.  So, 5.10 is a reasonable stopping point.  If EL7 ever catches on and kicks EL6 to the curb, you can bump up to 5.14
01:40 Grinnz unfortunately i don't expect that for a few more years at least :/
01:40 nicomen right right, in my world that is squeeze, that's two debian stable versions ago. That is more than enough.
01:41 mst I still have users on 5.8 who'll send test reports. that's enough for me.
01:41 mst if I run out, I'll stop caring
01:41 mst not actively trying, just also not actively breaking
01:43 sri crazy how rails is like 150k lines of code
01:45 * sri still remembers when the ruby community was making fun of java for being verbose
01:47 mst sri: InactiveRipcord
01:52 sri :)
01:55 PryMar56 joined #mojo
01:55 sri been looking into actioncable again, and it's still a mess https://github.com/rails/actioncable
01:56 preaction i think i just ODed on buzzwords in the first paragraph...
01:57 sri you actually run two separate web servers for your rails app
01:58 absolut_todd joined #mojo
01:59 sri they couldn't even get reloading working :)
02:05 absolut_todd joined #mojo
02:06 hshong joined #mojo
02:07 preaction jberger: when using Test::Mojo::Role::Phantom, how do i skip the phantomjs tests if phantomjs is not installed on the tester?
02:07 sri damn, they actually require one database conenction per user
02:07 sri that explains the hard dependency on redis
02:08 sri every user goes into a thread
02:08 mst ... ... ...
02:08 preaction jberger: oh... you can't install the module without phantomjs... how should i use it on cpan then? just as a recommends?
02:09 mst recommends + Test::Requires ?
02:11 preaction yeah, that looks like a likely path
02:13 sri i have a feeling that the rails team is terrified of elixir and phoenix framework
02:14 sri otherwise they would be ashamed to release that thing
02:15 preaction shame? when has a developer ever felt shame?
02:18 nicomen preaction: every day
02:21 mst every time I call $rs->search and have to care about the wantarray() I put in there in DBIx::Class 0.01 :/
02:21 sri http://i.imgur.com/0KQJx.jpg
02:26 sri really lenovo? really?! http://www.theregister.co.uk/2015/08/12/lenovo_firmware_nasty/
02:30 preaction wow...
02:31 lluad Not too surprising, they've been swirling the bowl for a few years, but it's impressively blatant.
02:31 SmokeMachine joined #mojo
02:31 genio that's just, well, I can't think of words that aren't expletives
02:32 SmokeMachine Hi! If I have a Mojo::Transaction::HTTP, what's the best way to write a chunk? (the equivalent of the Controller's write_chunk)
02:32 mst I'm currently sat at a Thinkpad Tablet 2; it suffers none of this fail and is still awesome
02:33 SmokeMachine I tried server_write, but it doesn't fell like working...
02:33 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Streaming-request
02:34 mst SmokeMachine: $tx->res->content->write_chunk or so, perhaps
02:34 noganex_ joined #mojo
02:36 mst SmokeMachine: Controller's write_chunk is just sugar for doing that
02:36 SmokeMachine mst: that's it! Thank you very much!
02:36 mst sri: response, not request
02:36 sri that sounds odd, when do you have a transaction but no controller?
02:36 SmokeMachine sri: thanks
02:38 SmokeMachine sri: I'm  saving the transaction on a array and on another request I send data for every transaction
02:38 SmokeMachine any better approach?
02:38 sri yes, pubsub
02:39 sri same architecture works for long polling too https://github.com/kraih/mojo/blob/master/examples/chat.pl
02:40 sri and it scales when you use a postgres/redis/... backend https://github.com/kraih/mojo-pg/blob/master/examples/chat.pl
02:42 SmokeMachine do you mean the event emitter?
02:42 SmokeMachine that looks great!
02:42 sri yes, it's a placeholder for a pubsub database backend
02:43 sri (for when you need more than one server process)
02:46 Grinnz just gotta come up with a way to pubsub through a sqlite "database" somehow :P
02:48 sri well, you can always write into a table and poll for updates ;p
02:48 Grinnz heh, that's a little *too* ghetto
02:48 Grinnz i think there's a remote possibility of being able to do it with DBD::SQLite's query hooks though
02:50 Grinnz https://metacpan.org/pod/DBD::SQLite#dbh-sqlite_progress_handler-n_opcodes-code_ref
02:50 Grinnz it would probably be a big performance slowdown though, heh
02:51 Grinnz also, i dont think theres any sort of sleep query like what harry used for the silly mysql thing
02:52 Grinnz meh, i might make a polling version someday just to have it :P
02:54 lluad Can you get to sqlite3_update_hook() from DBD::SQLite?
02:54 SmokeMachine thanks!
02:54 Grinnz yes
02:54 good_news_everyon joined #mojo
02:54 good_news_everyon [mojo] kraih tagged v6.15 at 734522c: http://git.io/v3VYv
02:54 good_news_everyon left #mojo
02:54 Grinnz but i don't know if that works across different database connections, does it?
02:55 Grinnz i think it's just for the current connectin
02:55 lluad Yeah, it is. I was wondering if you could insert notifies into a table...
02:55 SmokeMachine sri: any problem if the "event name" is a "email"? so: any problem having a lot of "event names"
02:55 Grinnz SmokeMachine, it can be any string
02:55 lluad Nah, it'd be horrible.
02:56 Grinnz however you might be better off making a more generic event name, and passing the email as a parameter
02:56 Grinnz depending on your logic...
02:56 SmokeMachine I mean: no performance issue?
02:56 Grinnz it's just a hash lookup
02:56 Grinnz the string doesnt matter
02:56 sri i'd pick a sensible name that would work with a database backend in the future
02:57 sri you don't have to though
02:57 SmokeMachine but if I receive a request from a user, I need to send data for all other connection from that user...
02:58 good_news_everyon joined #mojo
02:58 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/v3VYr
02:58 good_news_everyon mojo/master 2727039 Sebastian Riedel: bump version
02:58 good_news_everyon left #mojo
02:59 Grinnz \o/
03:00 sri normally you'd use events like channels
03:00 sri subscibe to a channel for notifications with ->on() and send notifications to channels with ->emit()
03:04 absolut_todd joined #mojo
03:11 sri Grinnz: btw. there's an alternative to :prototype https://github.com/kraih/mojo/commit/f0ff29c6d3889eb698541e99f83d6ae5286dfade
03:12 zivester joined #mojo
03:13 sri there's some funny branches i completely forgot about https://github.com/kraih/mojo/compare/time_in_words
03:16 good_news_everyon joined #mojo
03:16 good_news_everyon [mojo] kraih deleted unicode_characters at dd585a8: http://git.io/v3Vss
03:16 good_news_everyon left #mojo
03:17 good_news_everyon joined #mojo
03:17 good_news_everyon [mojo] kraih deleted xml_tags at ee38a39: http://git.io/v3Vs0
03:17 good_news_everyon left #mojo
03:18 good_news_everyon joined #mojo
03:18 good_news_everyon [mojo] kraih deleted resolver at 93c380d: http://git.io/v3Vsy
03:18 good_news_everyon left #mojo
03:18 good_news_everyon joined #mojo
03:18 good_news_everyon [mojo] kraih deleted test_simple at fbd3c26: http://git.io/v3Vs9
03:18 good_news_everyon left #mojo
03:20 good_news_everyon joined #mojo
03:20 good_news_everyon [mojo] kraih deleted post-example at b8d0e3d: http://git.io/v3VGe
03:20 good_news_everyon left #mojo
03:20 good_news_everyon joined #mojo
03:20 good_news_everyon [mojo] kraih deleted pod-ascii-art-fix at 90408da: http://git.io/v3VGI
03:20 good_news_everyon left #mojo
03:37 jberger preaction hmm I could expose a class method that checks
03:37 preaction it wouldn't be useful if it can't be installed at all though
03:37 jberger Right
03:38 jberger So just skip all unless require
03:39 jberger I have been meaning to investigate an alien module for it though
03:39 preaction right, that's the plan right now
03:39 jberger It ships as a single file binary, so it wouldn't be too hard to just fetch per platform
03:40 preaction also, starting up a postgres and now a browser to test my app, inside a single test, is awesome
03:40 jberger \o/
03:42 jberger I didn't get to looking at the css4 selector thing tonight, ran errands with the wife then had a very pleasant meal at an outdoor place
03:43 jberger Soon though
03:46 Grinnz sri, cool but i don't think it should be in Mojo::Base unless for a major version change
03:46 Grinnz it will break code using Mojo::Base and prototypes
03:47 Grinnz oh, thats in a branch, ok
03:49 absolut_todd joined #mojo
03:56 sri http://cdn.themetapicture.com/media/funny-Simpsons-Flanders-soon-meme.jpg
04:00 absolut_todd joined #mojo
04:19 melo joined #mojo
04:30 inokenty-w joined #mojo
04:39 Grinnz http://i.kinja-img.com/gawker-media/image/upload/s--0fa87WeO--/c_fit,fl_progressive,q_80,w_320/18egdssyncsl0gif.gif
04:42 Snelius suddenly
05:26 irqq joined #mojo
05:36 absolut_todd joined #mojo
05:42 absolut__ joined #mojo
05:51 kivilahtio joined #mojo
05:52 sopanshewale joined #mojo
05:52 absolut_todd joined #mojo
05:55 arpadszasz joined #mojo
06:15 trone joined #mojo
06:15 arpadszasz joined #mojo
06:17 marcusr silly rabbit, prototypes are for kidz
06:19 buu joined #mojo
06:19 marcusr http://static.tvtropes.org/pmwiki/pub/images/trix_murder2.jpg
06:48 bwf joined #mojo
06:49 Grinnz_ joined #mojo
06:49 Repaster joined #mojo
06:54 odc` joined #mojo
07:01 eseyman joined #mojo
07:02 bjakubski joined #mojo
07:18 Fink joined #mojo
07:18 Fink Quick question: With Mojo::UA, what's the best way to extract links that match a certain domain (e.g., facebook, etc), and emails, phone numbers, etc?
07:19 Fink I.e., extract links from dom that match regex
07:22 Snelius Fink: by pure regex from html )
07:22 dotan joined #mojo
07:22 damaya joined #mojo
07:24 Fink Ah, OK.
07:25 oalders joined #mojo
07:36 marcusr mojo::dom to extract links?
07:38 Fink Actually, I get that much really. What I'm trying to figure out is how to match a phone number in the dom, anywhere in there.
07:38 Fink based on regex
07:38 Fink $dom->match('/regex/') or something
07:47 buu $dom->all_text =~ /(regex)/g
07:47 buu Or $tx->res->body =~ //...
07:48 Snelius exactly
07:56 Fink buu, awesome, thank you!!
08:11 kaare joined #mojo
08:23 batman i think if the "signatures" branch gets merged, i'm actually going to start using signatures.
08:23 batman right now it's more of a hassle to me to import signatures, haha
08:27 marcusr I'm +2 for the signatures branch.
08:27 marcusr :p
08:28 marcusr I use them now, and it's a hassle with the import
08:30 marcusr Also, I tried using mojo legacy on an olg rhel 5 box we have, and it broke perl :)
08:38 Vandal joined #mojo
08:39 irqq joined #mojo
08:45 batman marcusr: :)
08:51 jontaylor joined #mojo
09:13 amon joined #mojo
09:19 meshl joined #mojo
09:38 irqq joined #mojo
09:44 Fink buu, $dom->all_text and $tx->res->body also search HTML, not text.
09:45 Fink not just text I mean
09:45 Fink I think $dom->text is a better method
10:02 Snelius nice
10:07 Fink Actually, why does all text grab inline css and javascript stuff?
10:13 Snelius why not?)
10:15 buu Extract text content from this element only (not including child elements), smart whitespace trimming is enabled by default.
10:16 Fink Dang, I wish there was an easy way to grab only what is rendered in browser
10:16 batman Fink: Probably because it is text :)
10:16 Fink I.e., only the text seen in a browser
10:17 Fink Yeah, it makes sense now that I think about it, just not exactly how I wanted it to behave for this scenario :D
10:17 batman That is actually pretty hard. Difficult to know what is hidden by CSS/JavaScript
10:18 buu w3m | perl ...
10:20 batman I think I would do $dom->find("main, section, article, div.content");
10:21 batman If that doesn't work... Well, you have Instapaper that does this for you :)
10:22 batman You could also do it the other way around: remove header, footer, div.header, div.nav, script, style, ... And see what you're left with
10:24 batman Meaning, do all_text() on body after that
10:26 batman marcusr: Did you vote on the GitHub issue?
10:26 batman I'm on a train... (Makes me lazy)
10:30 Fink Is there any way to just exclude script and style tags?
10:35 asymp left #mojo
10:38 batman I can't remember the exact, but probably something like this $dom->find("script, style")->map("remove")
10:47 Fink batman, that worked, you're awesome
11:05 neilhwatson joined #mojo
11:17 batman too bad Fink has gone...
11:17 batman i was planning to gloat ;)
11:26 eitz joined #mojo
12:01 batman I guess it's a bit late, but I was wondering if we should have a micro hackathon on the Saturday after the YAPC.
12:01 batman No idea where... Just throwing the idea out there.
12:04 * Lee would attend that - got a few hours to kill on the Sat afternoon
12:05 Lee joined #mojo
12:15 batman Cool. I'll send an email to the organizers and see if they have any tip
12:15 batman *ideas
12:34 zivester joined #mojo
12:50 ajr_ joined #mojo
12:51 bobkare joined #mojo
13:00 arpadszasz joined #mojo
13:14 good_news_everyon joined #mojo
13:14 good_news_everyon [mojo] kraih deleted signatures at 6d534e6: http://git.io/v3rhw
13:14 good_news_everyon left #mojo
13:23 hernanGOA joined #mojo
13:24 good_news_everyon joined #mojo
13:24 good_news_everyon [mojo] kraih created signatures (+1 new commit): http://git.io/v3oJ0
13:24 good_news_everyon mojo/signatures ad20805 Sebastian Riedel: add basic support for Perl 5.20 signatures
13:24 good_news_everyon left #mojo
13:26 btyler_ woo, signatures :)
13:28 sri old signatues branch needed to be cleaned up
13:29 berov joined #mojo
13:30 sri i imagine we would end up with two special cases at some point anyway
13:30 sri once signatures go stable, we don't just activate them on Perl 5.24+, or would we?
13:31 sri there would be a check for 5.24+ and for 5.20+
13:32 mst marcusr: package MyApp::ControllerClass; use Import::Into; sub import { Mojolicious::Controller->import::into(1, -base); experimental->import::into(1, qw(signatures)); }
13:32 mst batman: ^^
13:32 mst it's only more typing if you do it the hard way
14:01 hernanGOA joined #mojo
14:02 sri oh my, catalyst core is only 200 lines smaller than mojolicious now :o
14:02 sri 8400 vs 8600
14:14 jontaylor joined #mojo
14:29 Grinnz_ sri: so you're saying we just have to turn 200 more lines of core code into plugins...
14:29 Grinnz_ ;)
14:42 gryphon joined #mojo
14:52 sri that's exactly what i was saying
14:52 sri or we just wait a few more weeks, catalyst is growing so fast ;p
14:53 nicomen how about dancer?
14:53 sri 6500 lines or so
14:59 eitz left #mojo
14:59 * jberger wants a plot of LoC and tests vs version number
15:00 jberger someday I'll step through version control and try it
15:00 sri don't forget the Mojo::DOM::CSS thing ;p
15:00 Grinnz_ that reminds me... graphs of how long dists take to build+install on cpantesters would be cool
15:00 Grinnz_ installing dependencies complicates things of course...
15:00 * jberger is currently $work ing
15:01 * sri is really curious how easy it actually is
15:02 sri the Mojo::DOM::CSS code is mostly pretty good, but if someone feels like cleaning up some code... i'm almost certain the equation stuff could be implemented more elegantly
15:02 sri https://github.com/kraih/mojo/blob/master/lib/Mojo/DOM/CSS.pm#L114-L131
15:03 sri it's the nth-whatever(odd) stuff
15:03 ribasushi jberger: openhub does a lazy version of that (not nearly as detailed as you described, but hands-free): https://www.openhub.net/p/dbix-class/analyses/latest/languages_summary
15:03 sri nth-whatever(-n+3)
15:05 nicomen sri: why no start-anchor on line 125?
15:06 sri you tell me!
15:06 sri i actually would have to read up on the selector spec again to understand the code myself :)
15:08 nicomen hehe
15:08 nicomen I see it's is not there since the very beginning
15:08 nicomen https://github.com/kraih/mojo/commit/9d201abd9ebf79c209c951326520d010af16d4ef#diff-24fe40937fb0bc295d664900b1a94f0eL561
15:10 sri # "Hi, Super Nintendo Chalmers!"
15:13 lluad joined #mojo
15:18 ajr_ joined #mojo
15:19 njlg joined #mojo
15:24 marcusr mst: and Import::Into is made of 100% beef?
15:25 ribasushi marcusr: grassfed hamstermeat
15:29 marcusr hmm, only module::runtime and module::build in the graph
15:30 Grinnz_ hopefully the latter can be fixed... https://rt.cpan.org/Public/Bug/Display.html?id=96557
15:33 mst marcusr: pretty sure I didn't give rolsky a commit bit
15:37 meshl joined #mojo
15:41 jberger ribasushi: yeah, I hadn't looked at that in a while so its a good reminder
15:42 jberger but of course, what I really want is LoC without tests vs number of tests (not lines of tests) so its going to need perl-level analysis to accomplish I'm sure
15:45 mst jberger: 'sloccount lib'
15:45 jberger mst: exactly
15:46 jberger then run the tests and get the number out by hook or by crook
15:48 mst prove -lr t and a regexp
15:49 mst though remember that test count is also a kinda terrible metric
15:51 jberger coverage isn't great either though, permutations are important
15:51 jberger this isn't really intended as scientific anyway, just to prove  a point
15:51 jberger s/prove/demonstrate/
15:54 jontaylor joined #mojo
15:57 mst oh, sure, just ... I do things like
15:57 mst is(Dumper($x), Dumper($y));
15:57 mst instead of multiple separate tests
15:57 mst because often that output is easier for me to use to find the bug
16:02 sopanshewale joined #mojo
16:31 PryMar56 joined #mojo
16:37 jberger that's one way to do it
16:37 jberger I'm sure you are aware that there are CPAN modules which make that easier too
16:48 mst there are CPAN modules that allow you to get different output, but I disagree with your implicit assumption that that always makes things easier
16:48 mst sometimes Test::Deep is better, sometimes Dumper and eq is better
16:54 sopanshewale joined #mojo
16:55 berov1 joined #mojo
17:01 dod joined #mojo
17:02 howitdo joined #mojo
17:03 jberger I was thinking of Test::Differences in this case, but sure, TIMTOWTDI
17:06 mst right. but, basically, "sometimes I like a diff, sometimes I like to open the two files side by side"
17:06 mst I think is a reasonable metaphor
17:06 * Grinnz has gotten by ok with is_deeply so far
17:22 ashimema joined #mojo
17:25 eitz joined #mojo
17:29 njlg joined #mojo
17:31 dotandimet joined #mojo
17:36 CromeDome joined #mojo
17:44 disputin joined #mojo
17:46 dotandimet1 joined #mojo
17:47 marcusr is_deeploy is a bit annoying to me.
17:47 marcusr deeply
17:47 marcusr I think I prefer mst's approach, actually.
17:50 marcusr sooo weird. Os x has suddenly started running out of open files ofr me.
17:51 disputin joined #mojo
17:51 meredith i only jump to is_deeply when a tested structure isn't static, really. like the test only cares about a subset or only cares that there is an array of similar things somewhere.
17:57 lluad joined #mojo
17:58 disputin joined #mojo
18:03 arpadszasz joined #mojo
18:05 jberger meredith: IIRC thats Test::Deep's realm, but again TIMTOWTDI
18:07 Jonis want moar time
18:07 Jonis for everything
18:07 Jonis hi jberger, how are you?
18:07 meredith oh, sorry that's what i meant.  similar names
18:08 jberger Jonis: o/ good, you?
18:08 Jonis jberger: pretty good!
18:08 Jonis not enough time in the day
18:08 Jonis to do all the things that need doing
18:08 jberger how's the beard doing?
18:08 dave I hear ya Jonis
18:08 Jonis jberger: strong :)
18:09 Jonis jberger: fair amount larger now than last time
18:09 Jonis had a few trims and so on
18:09 jberger that's the important thing :D
18:09 jberger nice
18:09 Jonis jberger: https://scontent-fra3-1.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/10998819_10153291210620845_935255684977509826_n.jpg?oh=acaf7d68effdc09517e4e863a741c6bc&oe=564C6D6F
18:09 Jonis there we go, fairly new-ish pict
18:10 jberger magnificent
18:10 dotandimet joined #mojo
18:10 jberger that really should be your gravatar, your current one isn't nearly that impressive
18:11 Jonis oh, I should fix that
18:14 Jonis jberger: thanks, fixed :D
18:17 meshl joined #mojo
18:22 disputin joined #mojo
18:23 dotandimet joined #mojo
18:23 irqq joined #mojo
18:32 * jberger refreshes irc client
18:32 jberger nice
18:35 dvinciguerra joined #mojo
19:22 Fink joined #mojo
19:22 damaya joined #mojo
19:51 sri we still need the documentation conventions section
19:51 marty joined #mojo
20:01 njlg joined #mojo
20:06 JDorpinghausDev joined #mojo
20:07 JDorpinghausDev Hi, I am trying to store a value in a session using $c->session(test => 'test'). For some reason this session value does not persist through page loads.
20:08 disputin joined #mojo
20:08 JDorpinghausDev My code snippet:
20:08 JDorpinghausDev https://gist.github.com/JDorpinghaus/3a20bd2ab212d490e3c0
20:09 buu Can you set cookies via websockets?
20:09 Adura You'd think indirectly via JS...
20:10 dave In Mojo::Pg ... if I do a $db->begin and then some sql like SELECT..FOR UPDATE ... and an error happens, how do I release the lock?
20:10 sri you can set cookies during the websocket handshake
20:10 sri but not afterwards
20:10 buu JDorpinghausDev: Which is the point, session stores the data in the cookie, which isn't changed by your websocket callback
20:11 JDorpinghausDev Hmm, I see.
20:12 buu You could probably change the session store to use an alternative
20:12 sri websockets are a persistent connection
20:13 sri why would you need a session?
20:13 disputin joined #mojo
20:13 JDorpinghausDev I want to store the value for a long time (days), across multiple page loads.
20:19 dotandimet joined #mojo
20:26 Grinnz_ i had the same problem... i havent worked on that project in a while but i think i used local storage
20:26 Grinnz_ from JS
20:27 sri seems reasonable
20:28 njlg joined #mojo
20:35 jberger JDorpinghausDev: the quickest is to write a little ajax handler that sets session values
20:35 jberger and then have the client hit that
20:35 jberger a hack, sure, but it works
20:35 dave I used session storage for something similar to that purpose, set my tokens in there
20:36 jberger (btw, I'm not saying that that is better than localstorage, just answering the direct question)
20:36 sri i guess activating signatures with Mojo::Base also fits into our backcompat philosophy, since it would work on the last two stable perl releases
20:37 dave it's funny how no one likes persistent data being stored in the browser (for security and tracking reasons) but when you need that as a dev...you feel dirty
20:37 sri just too bad the signatures cpan module has not been updated yet
20:37 Grinnz_ dave: re your Mojo::Pg question, that's the purpose of Mojo::Pg::Transaction - if your transaction is scoped, and the returned $tx goes out of scope, it will rollback which should release the lock
20:37 dave Grinnz_: yeah I have something funny going on here...getting DBD::Pg::st fetchrow_hashref failed: no statement executing
20:37 jberger sri: I still feel a bit odd recommending (and indeed enabling) an experimental feature
20:37 jberger but it looks like I'm being outnumbered
20:37 dave Grinnz_: not really sure what the real bug is yet
20:38 Grinnz_ i would vote against any enabling of signatures without a major version bump because it will break any code using prototypes
20:38 jberger putting it in the docs with a disclaimer is one thing
20:38 Grinnz_ and i don't see a way to apply our deprecation policy to that
20:38 sri jberger: true, it would feel better if signatures were stable in blead perl ;p
20:39 sri fingers crossed
20:40 jberger sri: is it possible to do "use Mojo::Base -strict => 'signatures';"
20:40 sri jberger: ewww
20:40 jberger my question is, does anything use a second slot in import?
20:40 sri Grinnz_: sure, i'll bump to 7.0 :)
20:41 jberger or 'experimental'
20:41 sri no need to wait a year
20:41 JDorpinghausDev @jperger Thanks, I think I have it working using JS localstorage
20:41 Grinnz_ sri: i wouldnt mind that :P
20:41 Grinnz_ hmm what did they make non-experimental in blead perl? there was something
20:41 sri 7.0 without a blog post would be a little odd, but not really a problem
20:42 jberger postderef
20:42 Grinnz_ oh yes
20:42 jberger and they removed autoderef
20:42 sri not like we'll have that many major releases to announce with 7.0 anyway
20:42 sri s/releases/features/
20:42 Grinnz_ anyway, i think we should wait for non-experimental overall :/
20:43 dave where's Onigiri? I think I found the same scoping bug
20:43 jberger use Mojo::Base -strict => 'experimental'; # wouldn't even be breaking
20:43 sri Grinnz_: -.-
20:44 sri jberger: -1
20:45 dave I'm actually curious why jberger's syntax is disliked :)
20:45 sri considering there's no proposal for doc changes yet, i somehow doubt #830 will go anywhere actually
20:45 sri there will be some more talk, and then silence
20:46 ajr_ joined #mojo
20:46 jberger I think we all are agreed to the basics of #830
20:47 jberger I think adding signatures to Mojo::Base is the more controversial bit
20:47 Grinnz_ the documentation conventions section, yeah
20:48 sri someone also has to actually go through all the docs and change the examples ;p
20:48 jberger use Mojo::Base -strict => 'nibbler'; # enables things we think are awesome
20:49 jberger sri: they aren't incorrect without signatures
20:49 jberger we can add them where appropriate
20:49 sri -1
20:49 sri consistency matters
20:50 sri seems we have more disagreements
20:50 jberger consistency is good, but I won't have the time for a big project like that at least until the weekend if not longer
20:51 jberger plus I'm the one that seems to be the most cautious about using experimental features :-P
20:51 sri then i seem to have misunderstood
20:51 sri i was under the impression you wanted to change examples partially
20:52 jberger I was saying that was something that could be done quickly
20:54 Grinnz_ it can be done in a branch easily enough
20:55 dave http://fpaste.org/254918/ ... I may have found a bug in Mojo::Pg but this could also be my misunderstanding
20:56 dave that runs normally unless you give the program an argument, then it dies strangely
20:57 Grinnz_ keeping results objects around could cause problems, as i discovered making Mojo::SQLite
20:57 Grinnz_ global context bad
20:57 dave heh this is my discovery for today :)
20:57 dave is that kind of thing considered a bug though?
20:58 Grinnz_ dunno, what problem exactly are you getting?
20:59 dave well in the complex code I'm writing, DBD::Pg::st fetchrow_hashref failed: no statement executing
20:59 Grinnz_ what about in this test script?
20:59 dave so I investigated by writing a small test case and ran into what Onigiri talked about yesterday
20:59 sri doubt it's a bug, pilot error
20:59 dave and in this test case, when you set the argument, line 28 dies
21:00 Grinnz_ in which iteration?
21:00 dave Can't use an undefined value as an ARRAY reference at /usr/local/lib/perl5/site_perl/mach/5.18/DBI.pm
21:00 dave iteration 2
21:00 good_news_everyon joined #mojo
21:00 good_news_everyon [mojo] jberger created feature (+1 new commit): http://git.io/v3ic8
21:00 good_news_everyon mojo/feature f8a52ba Joel Berger: enable features conditionally, added signatures feature
21:00 good_news_everyon left #mojo
21:00 sri database handles are stateful, you're responsible for managing them
21:00 Grinnz_ it dies in DBI? wtf
21:00 jberger eep, typo
21:00 dave hence the name of my argument switch :D
21:00 sri Grinnz_: language
21:01 dave sri: so I should always destroy my results objects?
21:01 dave when I'm done with them
21:01 good_news_everyon joined #mojo
21:01 good_news_everyon [mojo] jberger force-pushed feature from f8a52ba to b4386e0: http://git.io/v3icF
21:01 good_news_everyon mojo/feature b4386e0 Joel Berger: enable features conditionally, added signatures feature
21:01 good_news_everyon left #mojo
21:01 dave if you take line 25 and make that local to the foreach block with "my", the bug does not happen
21:02 sri jberger: oddly named branch
21:02 sri dave: yes
21:02 Grinnz_ dave: i suspect it's similar to the issue i had in Mojo::SQLite though it's presenting a different way
21:02 jberger I'm proposing it as a mechanism to add other features that way
21:02 Grinnz_ dave: when ->hashes is run on the first results object it makes that sth inactive, which means the next iteration reuses the cached sth
21:02 Grinnz_ but then it destroys the first results object by assigning to $r again, which calls finish on that sth
21:03 Grinnz_ why that would cause an error in DBI i have no idea
21:03 dave me either but I kind of get what you are saying
21:04 Grinnz_ but if keeping your results objects local solves it, thats the best way
21:04 dave this is why I write test cases :)
21:04 sri rule of thumb is to keep Mojo::Pg::Database and Mojo::Pg::Results objects around the least amount of time possible
21:05 sri stuff is cached, connections re-established... and so on
21:05 Grinnz_ how i worked around the issue in Mojo::SQLite: https://github.com/Grinnz/Mojo-SQLite/commit/36bd11a05a83e4587d0d7b97c494ffb1fc6cbad7
21:06 sri Grinnz_: it's a logic error imo
21:06 sri if you're still messing with a results object, you shouldn't be starting a new query on the connection
21:06 dave Do you say that explicitly anywhere that I've missed sri?
21:07 Grinnz_ perhaps, but i felt it was worth fixing: it caused your updated sequential query test to fail for SQLite
21:07 Grinnz_ it doesn't fail for Mojo::Pg which makes me suspect something else migh tbe going on in dave's case
21:07 sri dave: pretty sure i do
21:09 dave yeah sri, I don't see any language on the Mojo::Pg or Mojo::Pg::Results pages that would tell me to keep results objects around a minimal time :)
21:10 * sri shrugs
21:10 dave I think I'm going to scope guard all my results in blocks
21:10 Phil21 anyone know if there is anyone else doing work on MySQL support for Minion?
21:10 sri maybe it only says for Mojo::Pg::Database
21:10 sri can't actually think of a good way to explain it for results
21:11 dave Maybe a "caveat" or "caution" on both the Mojo::Pg and Mojo::Pg:Results page...I dont see any language on the ::Database page
21:11 sri Phil21: i've only seen redis
21:11 Phil21 sri: ok, thanks
21:11 Phil21 guess that's something we will likely contribute then :)
21:12 dave this is a really subtle error that I'd love to see extra language in the docs about
21:12 sri dave: sure, propose something ;p
21:12 dave hehe
21:12 dave ok, is that done by a pull request or can I just say it here on irc? :D
21:12 sri literally, right now, if you have something i can add it
21:13 dave How about "Be extremely careful keeping Mojo::Pg::Results objects around longer than you need them."
21:14 Grinnz_ https://github.com/kraih/mojo-pg/blob/master/t/database.t#L68 this is what fails when i applied it to Mojo::SQLite without that fix
21:14 sri dave: here is something http://mojolicio.us/perldoc/Mojo/Pg#db
21:14 Grinnz_ maybe it's different in Mojo::Pg simply because it's actually async there
21:14 Grinnz_ in Mojo::SQLite it's just emulated :P
21:15 dave sri: "...so you can handle connection timeouts gracefully by holding on to -it- only..."
21:15 dave The subject for that pronoun is a bit far back in the text :D
21:15 dave I think it might be better to say "Try not to keep the following objects around any longer than you need them: ..."
21:16 Grinnz_ in Mojo::SQLite - $one goes out of scope at the end of that step, which calls finish on that sth being used for the 2nd query, discarding the result
21:16 dave because it's not just connection timeouts that are the problem
21:16 disputin joined #mojo
21:21 sri actually, i just realized i have no idea what's actually going on, Grinnz_ confused me a little
21:21 sri holding on to results objects might be meaningless in Mojo::Pg
21:22 sri someone actually has to look into it before the doc changes
21:23 dave Onigiri had another issue that I believe is quite related, might check yesterday's chat logs
21:23 Grinnz_ sri: does this test work in Mojo::Pg - https://github.com/Grinnz/Mojo-SQLite/blob/master/t/results.t#L61
21:23 Grinnz_ it tests for the issue without involving async
21:23 dave Thankfully, in most of my code, I don't hold on to the results object like I do in this new code
21:26 sri Grinnz_: no
21:27 Onigiri dave: My issue is rather strange, and makes no sense to me.
21:27 dave Onigiri: yeah but I did something very similar and got bit too
21:27 dave and IIRC you have the same idea going on
21:28 njlg joined #mojo
21:28 Grinnz_ sri: DBI error or empty results?
21:30 Grinnz_ i wonder if DBD::Pg handles fetchall_arrayref on an inactive handle differently
21:30 sri DBI error
21:30 sri Can't use an undefined value as an ARRAY reference at /Users/sri/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/darwin-2level/DBI.pm
21:30 Grinnz_ huh
21:32 dave that's kind of like what I got
21:32 dave modulo perl versions
21:33 njlg joined #mojo
21:33 Grinnz_ wait, it doesn't even give you a line number?
21:34 sri it's not the whole error
21:34 Grinnz_ oh, i saw dave's didnt have one either...
21:34 dave Can't use an undefined value as an ARRAY reference at /usr/local/lib/perl5/site_perl/mach/5.18/DBI.pm line 2074, <DATA> line 2231
21:35 dave mine does have a line #
21:36 dave not that this may help much:perl -MDBI -e 'print $DBI::VERSION."\n";' => 1.633
21:41 Grinnz_ yeah, that is in fetchall_arrayref
21:41 dave I think I see this a bit clearer. If you assign a variable with an existing Mojo::Pg::Results object to something else, DESTROY gets called.
21:42 Grinnz_ yes, the old object has no more references and is destroyed
21:42 dave if that assignment is a ->query, then the new results object gets returned but you haven't had a chance to process the results yet
21:42 dave s/the results/these results/
21:42 Grinnz_ the new results object gets created by ->query itself, before the assignment happens
21:43 dave so somehow having a DESTROY happen on an older results object can screw up the new one if you haven't actually gotten the results from the new one yet
21:43 Grinnz_ the issue here is because they are using the same statement handle, because the old results object was "done" when the new query was run
21:43 dave that would make more sense to me now
21:44 dave so query() gets called, then DESTROY() on the old object, then you try to call (e.g.) ->hashes() on the new object and ... boom
21:45 dave time to rewrite this model again :)
21:46 Grinnz_ there might be a cleaner solution with ->hashes and ->arrays setting a "finished" flag, which prevents the finish in DESTROY... but you can also just call ->hash or ->array over and over to get the same scenario
21:46 Grinnz_ that might be trickier to handle
21:47 sri now i'm a little tempted to use the same hack you did
21:47 dave for me, the right way is to slurp the data I need into perl memory and release the results object. :)
21:57 sri https://github.com/kraih/mojo-pg/commit/fa472549e3d1b7d1a97542ecd85c2d89fdfeb335
21:59 Grinnz_ sri: ooh you got increment/decrement to work on those weird tied objects?
21:59 sri i just did it, and it somehow worked ;p
22:00 dave test case looks spot on :)
22:00 sri Grinnz++
22:00 sri took me a bit to grok it
22:01 sri annoying case really if you perform the same query twice in the same scope
22:01 dave so is a query with a bind placeholder in it the same query over different values? :D
22:02 Grinnz_ in Mojo::SQLite yes, in Mojo::Pg no
22:02 Grinnz_ ;)
22:02 dave :/
22:02 dave "But it's SQL. What could be different?"
22:03 pink_mist hahaha
22:03 * pink_mist cries
22:03 sri Grinnz_: why not?
22:03 Grinnz_ well, in Mojo::mysql no, i actually don't know for Pg
22:03 Grinnz_ but it disables server prepare right?
22:03 sri nope
22:03 Grinnz_ oh
22:04 sri there was actually a very long discussion here about it
22:04 Grinnz_ i vaguely remember it heh
22:04 sri regarding the performance of prepared statements in postgres
22:04 sri and the conclusion was that prepared statements are better
22:04 sri because the query planner got very smart in postgres 9.x
22:05 Grinnz_ cool
22:05 Grinnz_ meanwhile in mysql, binding params pretty much just sticks them quoted into the query :s
22:06 Grinnz_ i don't know whether that affects prepare_cached or not
22:06 dave O.o
22:06 dave I remember the first DBD::mysql code I wrote, I cached statement handles myself cause I didn't trust the driver.
22:07 Grinnz_ Mojo::mysql doesn't even use prepare_cached :P
22:07 sri it might be based on an older version of Mojo::Pg too
22:07 sri the caching changed a few times
22:07 Grinnz_ i wonder if it would be reliable there
22:08 sri i see you are using next_tick now, that's nice :)
22:11 Grinnz_ yeah now that i think about it, that might have fixed this issue in the sequential query case; the second statement isn't prepared until after the first one goes out of scope
22:11 sri all green, i guess the tie handle stuff works https://travis-ci.org/kraih/mojo-pg
22:11 Grinnz_ oh no, i still do the query during query(), just returning the results is deferred
22:11 Grinnz_ hehe
22:12 sri not very different from Mojo::Pg actually
22:12 sri the write on the socket happens blocking
22:12 sri only waiting for the results in actually async
22:13 dave thank you for that patch sri :D
22:14 sri wish i could find my Mojo::Pg benchmarks, wonder if the tie attribute stuff has a negative effect
22:14 sri i had a bunch of ojo one-liners i would run all the time :S
22:15 Grinnz_ you dont want to know what i was considering before i remembered DBI had private attributes :P
22:21 sri hmm, seems measurable across 1000 inserts
22:22 sri 0.26s instead of 0.25s
22:22 Grinnz_ heh
22:24 sri do you have anything else i could merge into Mojo::Pg?
22:24 sri now that i'm at it
22:25 sri (aside from the bind stuff i find silly ;p)
22:26 Grinnz_ heh
22:27 Grinnz_ i think the only other things were mostly related to the file path stuff for SQLite
22:28 Grinnz_ hmm... strange
22:28 Grinnz_ if i use your increment/decrement logic my $sth is becoming an unblessed reference in DESTROY again, i dont remember why that happened before
22:30 sri how odd
22:31 sri must be a DBD::SQLite thing
22:32 Grinnz_ oh nevermind, it's not that
22:32 Grinnz_ it's because one of the tests creates a results object without a sth, because DBD::SQLite can fail on the prepare step
22:33 Grinnz_ thats why i had a check for sth in the increment
22:34 Grinnz_ should probably just return $results as undef in that case instead (it's the callback case)
22:36 sri sure
22:37 trone joined #mojo
23:20 jontaylor joined #mojo
23:59 sri so mr robot is real after all :O
23:59 Grinnz spoilers!

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