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

IRC log for #mojo, 2015-08-31

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

All times shown according to UTC.

Time Nick Message
00:00 jontaylor joined #mojo
00:21 Zoffix http://i.imgur.com/Y32BbB0.png
00:21 Zoffix Sent barbie that
00:24 iloveyou joined #mojo
00:35 punter joined #mojo
00:35 jberger Zoffix++
00:54 preaction i volunteered as well. have to dust off all my mysql books
00:56 didge joined #mojo
01:14 Zoffix preaction++
01:23 jberger cool: http://www.perlmonks.org/?node_id=1140443
01:26 iloveyou joined #mojo
02:13 noganex_ joined #mojo
02:16 marty_ joined #mojo
02:16 meshl joined #mojo
02:37 jberger sri: I have a possible feature request
02:37 jberger for minion
02:37 jberger enqueue_helper
02:37 jberger acts like enqueue but creates a task on the fly from a helper
02:37 jberger hmmmm, even as I type it in it seams silly
02:38 jberger nm
02:49 * sri just thought of a problem with Catalyst::Plugin::StatusMessage
02:49 sri if the redirect is not followed, the message is never removed from the session
02:49 sri and the session will keep growing
02:50 sri flash would be cleared on the next request no matter what
02:51 sri perhaps even an attack vector
02:51 sri if the session is stored server side
02:51 melo1 joined #mojo
03:01 jberger and could cause cookie problems if stored on the client side
03:02 jberger I really only use flash messages for login (and especially login failure)
03:02 kaare joined #mojo
03:02 jberger this example app is about the most flash message usage I think I've ever done
03:18 oalders joined #mojo
03:21 iloveyou joined #mojo
03:34 iloveyou joined #mojo
03:51 oalders joined #mojo
04:04 iloveyou joined #mojo
04:08 asarch joined #mojo
04:53 hshong joined #mojo
05:31 cpan_mojo Mojolicious-Plugin-I18NUtils-0.15 by RENEEB https://metacpan.org/release/RENEEB/Mojolicious-Plugin-I18NUtils-0.15
05:34 kivilahtio joined #mojo
05:44 iloveyou joined #mojo
05:49 inokenty-w joined #mojo
06:05 iloveyou What's the best way to assign and test if a dom element exists? I am doing my $type = $dom->at('div#factsLocation div.fact')->text if $dom->at('div#factsLocation div.fact');
06:07 Snelius if ($dom->at('div#factsLocation div.fact')->text) {}
06:09 batman iloveyou: http://mojolicio.us/perldoc/Test/Mojo#element_exists
06:10 Snelius best way
06:10 batman iloveyou: Oh. You could use map on a collection
06:11 batman But it sounds like we are doing your homework :/
06:11 iloveyou I was thinking about doing map on a collection, but it's more of an at thing, since there is only one
06:12 iloveyou no, no... haha, this isn't for school or anything
06:12 iloveyou :D
06:12 batman $Text =$dom->at('div#factsLocation div.fact')->map(sub{$_->text("foo")}))->first
06:13 batman I meant $type, not $text
06:13 iloveyou wait, that won't bail if dom element doesn't exist?
06:14 batman What do you expect $type to be?
06:14 iloveyou And the other thing, how come element_exists is not part of Mojo::DOM (or if it is, it's not documented there.)?
06:14 batman No. map on empty list just doesn't do anything
06:15 iloveyou Ah, OK, perfect. The text is in the fact div.
06:15 batman I thought you meant "unit tested". That's why I sent you a link to Mojo-Test
06:15 iloveyou Ahh, OK. No, I'm scraping a site for some data.
06:15 iloveyou It's running, and going well, but looking at my code I wasn't really happy with what I pasted in here.
06:15 batman Right. Note that the map() doesn't do the same as your original code.
06:16 iloveyou I will use map from now on. I was using map on find, but it didn't seem the right thing to do.
06:16 batman at = first, map = every element
06:16 batman iloveyou: Crap! You can't use map on at()
06:16 batman Sorry. On my phone. I mess up copy/paste.
06:17 iloveyou Haha, yeah, just tested that :
06:17 batman $elem = $dom->find('div#factsLocation div.fact')->map(sub{$_->text("foo")}))->first
06:17 iloveyou However, this works: $dom->find('div#factsLocation div.fact')->map('text')->first;
06:18 batman I have to go. Going to drop my coffee since the bus driver is a maniac :/
06:18 iloveyou haha, thanks batman! good luck.
06:18 memowe joined #mojo
06:19 memowe Good morning all! \o/
06:38 berov joined #mojo
06:55 batman good morning
07:08 talexb_ joined #mojo
07:10 * batman henter kaffe og setter på headset (syklubben er igang igjen på andre siden av rommet)
07:10 batman oops! sorry. wrong channel :(
07:10 Snelius )
07:17 eseyman joined #mojo
07:19 cpan_mojo Mojo-IRC-Server-1.0.4 by SJDY https://metacpan.org/release/SJDY/Mojo-IRC-Server-1.0.4
07:25 odc joined #mojo
07:38 Vandal joined #mojo
07:56 Dandre joined #mojo
08:23 dod joined #mojo
08:54 ashimema joined #mojo
09:24 cpan_mojo Mojo-Webqq-1.4.3 by SJDY https://metacpan.org/release/SJDY/Mojo-Webqq-1.4.3
09:38 melo joined #mojo
09:44 nicomen barbie seems to be covered ;)
10:00 Zoffix Yeah. Good. "Hi Zoffix, Many thanks for the offer. At the moment someone has stepped forward and is taking a look for me. As such, I'm going to give them a chance to see how they get on. If it doesn't work out, I'll keep you posted."
10:18 dexteruk joined #mojo
10:25 jontaylor joined #mojo
10:29 hahainternet joined #mojo
10:45 eitz joined #mojo
11:05 cpan_mojo Mojolicious-Command-generate-lexicon-0.995 by UNDEF https://metacpan.org/release/UNDEF/Mojolicious-Command-generate-lexicon-0.995
11:37 jontaylor <offtopic> Why is the javascript community so mental? I want to add a lib into my JS, which is normally just a script tag away, but now i’ve got to download it with bower, which requires installing node, to then webpack or browserify a commonjs/AMD component, and it doesn’t work as some of its dependencies i’m using the normal script version, so its forcing me to replace everything with the same ecosystem, and now i’m 3 hours in for what should be noth
11:37 jontaylor more than a simple <script> tag….. </offtopic>
11:39 nicomen heh
11:40 hahainternet jontaylor: oh god you're so right
11:40 hahainternet i was working with a frontend project recently
11:40 hahainternet and i swear the build process was more complex than the backend, significantly so
11:41 jontaylor indeed
11:41 hahainternet too many utilities with unclear uses to count
11:41 hahainternet frontend MVCs
11:42 hahainternet i wouldn't mind but half of them don't even manage when noscript is enabled
11:42 jontaylor and they will all either be gone, or have a painful upgrade path in under 3 hours
11:42 jontaylor *3 years
11:42 hahainternet there was one on the frontpage of HN for a while that shit markup all over the page when loaded without js
11:42 iloveyou joined #mojo
11:42 jontaylor but hours does actually sound funnier
11:42 hahainternet here we go: http://www.phoenixframework.org/blog
11:43 hahainternet load without javascript and you get...
11:43 hahainternet [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/JBnwd0i3QO8vGt5F6xpY", "diff2.png", "1200", "216", "#27aa50", "" ] } ] } [/block] After a year and a half of work, 2500 commits, and 30 releases, Phoenix 1.0 is here!
11:43 jontaylor There isn’t even anything on that page that needs any javascript...
11:43 jontaylor perhaps the video player depending on what they are using
11:44 hahainternet i find this particularly amusing: https://www.filepicker.io/api/file/JBnwd0i3QO8vGt5F6xpY
11:47 jontaylor Thats a nice obvious url for the next person who has to maintian it haha
11:47 jontaylor *maintain
11:47 hahainternet it's just all 'modern' nonsense isn't it
11:48 hahainternet erlang backend! why? uh, because
11:48 hahainternet complicated frontend template based javascript why? uh, because!
11:48 hahainternet jontaylor: i came across Discourse recently though
11:48 hahainternet and for a frontend js and backend ruby platform, i'm surprisingly impressed
11:48 jontaylor some of its change for the sake of change, some of it is repeating mistakes of the past that we’ve already learned from
11:48 jontaylor i’ll have a quick look at Discourse and see if it calms me down :)
11:49 hahainternet http://try.discourse.org/
11:58 jontaylor The ruby backend on that is sensible enough, built on a well established framework thats reached ubiquity. None of the javascript frameworks at the moment make sense though, jQuery is acceptible though
11:59 jontaylor I once converted a large prototypejs app into jquery and it wasn’t that hard to do, because it doesn’t completely infect your code base
11:59 neilhwatson joined #mojo
11:59 jontaylor but imagine an angularJS/Ember/React app, and imagine the framework goes away or they make a new version that has no upgrade path
11:59 jontaylor you’d pretty much have to rewrite it
11:59 hahainternet no thank you :)
12:03 dvinciguerra joined #mojo
12:14 Ptolemarch joined #mojo
12:29 guru joined #mojo
12:32 hahainternet jontaylor: speaking of incomprehensible things with no clear explanation
12:32 hahainternet https://jupyter-client.readthedocs.org/en/latest/_images/frontend-kernel.png
12:39 Mikey joined #mojo
12:45 Ptolemarch joined #mojo
12:48 jontaylor hahainternet: even that can’t get me down, because now after 4 hours I have tamed the bonkers JS build pipeline
12:51 hahainternet jontaylor: :D
12:54 sri hahainternet: please watch your language, this channel is G-rated now
12:56 jabberwok looking at jupyter's homepage:  (1) why would anyone want a language named for a snake [shiver] (2) why does haskell have a recycled Amtrak logo
12:57 hahainternet sri: i have no idea what G-rated means sorry, i'm not American
12:58 hahainternet did I use any bad language? I must have missed that
12:58 sri actually i find phoenix framework interesting, they are one of the few frameworks that has managed to combine http and websocket
12:58 sri hahainternet: just avoid profanity
12:59 hahainternet that seems rather difficult to enforce and rather odd
12:59 hahainternet but your channel
13:00 Adura It's a bit of a minefield, honestly.
13:06 jontaylor I take it back, still not working :(
13:06 jontaylor now I need a bunch of gulp modules
13:06 jontaylor and instead, i’m just going to fork the repos and make it sensible instead
13:12 batman jontaylor, hahainternet: tried assetpack?
13:14 batman jontaylor, hahainternet https://metacpan.org/pod/Mojolicious::Plugin::Browserify
13:15 batman not perfect, but it's a start
13:15 jabberwok jontaylor: so... a preprocessor for the extraction of a preprocessor to be loaded into a devel environment ... =sigh=
13:16 jontaylor batman: those might help, but i’m starting to get really upset that something as simple as <script src=“something.js” /> has now taken me nearly 5 hours
13:17 batman jontaylor: that's why you use a plugin for this.
13:17 batman and... i'm a bit curious what lib this is. most of the *good* libraries work in all modes.
13:18 batman meaning you often have it available from https://cdnjs.com/ as well
13:20 jabberwok batman++
13:21 batman you can't blame people from wanting to do development smoother. but you can probably blame them from not providing the result javascript file
13:21 batman i wish i had the shiny tools from js. but since i don't i try to make mojo plugins that handle the heavy lifting for me.
13:21 batman so it at least _looks_ like i have the tools
13:25 meshl joined #mojo
13:27 jabberwok $it->fake() until { $it->make(); } # innit?
13:31 hernanGOA joined #mojo
13:37 batman jabberwok: https://s-media-cache-ak0.pinimg.com/736x/ea/89/73/ea89738c73d9fba55741887f03a56543.jpg :)
13:42 jontaylor batman: this is what I was after
13:42 jontaylor https://github.com/jhudson8/react-chartjs/tree/v0.6.0
13:43 jontaylor I did actually also want a dev setup, as i’d invariably have to fork it and change things
13:44 jontaylor but i’ve come to realise, its all just bloat, the actual implementation is under 100 lines
13:44 batman well... react* without a proper dev environment will easily make the output js become several megabytes :/
13:44 batman jontaylor: do you just want some chart lib, or are you in deep with react?
13:45 jontaylor batman: i’ve actually got the entire thing, charts and all working without react, i’m on a branch to put react in now
13:46 jontaylor batman: I was letting users do things like click the chart to “zoom” in, and faking it with doing a server refresh and remembering their scroll position
13:46 jontaylor which was very pragmatic and had a working version of that in an hour or so
13:46 gryphon joined #mojo
13:47 jontaylor but now I want to be able to stream new data in, and I figured I should get some exposure to at least one of the new JS frameworks
13:47 jontaylor The idea of just updating the data in the background and having everything update as it should be was quite appealing
13:52 batman right. i'm using morris.js. pretty light and does what i want.
13:52 PryMar56 joined #mojo
13:53 jberger jontaylor: if you just want a tiny js binding library, you can look at rivets.js
13:54 batman or if you want something that looks like react, just a whole lot more lightweight you can use riot.js
13:54 batman and yes, i made an assetpack extension that compile riot tag files.
13:54 nicomen sri: is it possible to have a nice mojo related logo for the mojo irc logs? (now it's the child drawing of camelia)
13:55 iloveyou joined #mojo
13:56 jontaylor These smaller libraries look more like what I’m actually after, and small enough I could maintain it if the author went away (which is a big worry for me)
13:56 jontaylor so I will give these a go on a branch
13:56 jontaylor better than messing about with increasingly complex JS buid envs anyway :)
13:57 sri nicomen: moritz maintains the logs i think
13:58 sri someone actually made a pretty nice layout for the perl6 site with my butterfly logo once, but it seems timtoady insists on using his logo
13:59 nicomen sri: aha
14:00 batman jontaylor: riot.js is up and coming. works very nice. <3
14:01 batman the databinding is the same as in react. makes it a lot cleaner to work with.
14:04 jberger I was just chatting with moritz the other day about getting #NNN links to point to github rather than RT
14:05 jberger he is considering making them configurable per-channel
14:05 jberger after chatting he suggested I open a tracking issue, which is here: https://github.com/moritz/ilbot/issues/39
14:05 jberger anyway, perhaps in the same process a configurable logo might be possible?
14:06 jberger nicomen: perhaps open an issue or drop him a note
14:10 marty joined #mojo
14:14 Repaster joined #mojo
14:18 dod joined #mojo
14:32 iloveyou joined #mojo
14:36 nicomen hmmmmmmmmmmmm https://www.youtube.com/watch?v=XPGsa5OaqWY
14:43 nicomen yup, nope.
14:52 human39 joined #mojo
14:57 dod joined #mojo
15:01 theshane joined #mojo
15:02 theshane Hello all, I have a need to check if a helper exists at a certain point in the app and if not, create it. I have not found a good way to handle this yet. Any tips?
15:11 sri http://mojolicio.us/perldoc/Mojolicious/Renderer#get_helper
15:13 PopeF joined #mojo
15:17 theshane Thank you! That did the trick
15:18 khw joined #mojo
15:19 khw fyi, there's a person who is now wanting to contribute to p5p; he came back to perl because of mojolicious meeting his needs more than what was available in other languages
15:21 neilhwatson Reminds me, Toronto PM is planning a Mojolicious talk in an upcoming meeting.
15:25 sri \o/
15:36 iloveyou joined #mojo
15:42 sh4 joined #mojo
15:48 sri this is really unfortunate https://github.com/kraih/mojo/commit/04732845a2b30d7e6d5e7f0d9064b58205dfa678#commitcomment-12979059
15:52 Grinnz_ ah yes, those fake-files always return size 0
15:52 sri guess the question is if we care
15:52 Grinnz_ i'm not entirely sure if i do
15:53 sri we do not need it for mojo core
15:53 batman i think we should care
15:54 sri https://github.com/kraih/mojo/blob/ec6fc90b5ec6ab4bcc73286789e41136e3b9145f/lib/Mojo/Util.pm#L234-L240
15:54 sri that was the old implementation, which was slow and did not throw exceptions
15:55 sri for surping a 300mb file 10 times it is 0.735056s vs 0.981803s
15:55 sri so, quite a big difference
15:56 Grinnz_ i mean, if someone needs to slurp a fake-file, they can always just do the local $/ trick, i doubt performance on slurping one of those files is an issue
15:56 sri batman: if you have a fast and elegant idiom for slurping we could use please share
15:56 batman sri: workig on it.
15:57 batman *working
15:57 Grinnz_ my only concern would be how to indicate that this slurp wouldn't work on the fake-files
15:57 Grinnz_ (i need to remember what the technical term for those files is)
15:58 nicomen does this mean this recommended module does it wrong too? http://cpansearch.perl.org/src/LEONT/File-Slurper-0.002/lib/File/Slurper.pm
15:58 genio virtual filesystem files, process information pseudo-file system, meh
15:58 sri also note that the errors are not actually tested, so anything complicated is a no go
15:59 sri "... or croak ..." is as complicated as i would accept without tests
15:59 Grinnz_ nicomen: that actually does the fallback to the local $/ trick if -s is 0, so it would work
15:59 Grinnz_ that's another option i guess
15:59 nicomen ah right, so does Path::tony
15:59 sri an actual fallback requires tests
15:59 nicomen *Tiny
16:00 Grinnz_ sri: i doubt such a thing exists on windows, so they would be non-portable tests if anything
16:00 sri and i assume this is pretty hard to test portably
16:01 neilhwatson FYI Perl6::Slurp. Don't know if it's suitable for your needs.
16:01 sri so, the most reasonable option so far seems to be anote in the docs, mentioning that virtual files don't work
16:02 Grinnz_ i would be fine with that, given the number of alternatives
16:02 sri neilhwatson: how is that relevant?
16:03 Grinnz_ and one would never "accidentally" try to slurp a virtual file, they are only in specific places
16:03 asarch joined #mojo
16:03 batman sri: why not just make a test that runs on linux for a proc file?
16:03 nicomen I would easily use a slurp method to read /proc/meminfo or similar
16:04 genio so, maybe the fix is a blurb about it in the doc.  "Don't try on /proc/ or other virtual files as they have a size of 0 ..."
16:04 nicomen since the readon I use a slurp method in the first place is to avoid open, read, close or non-intuitive $/ + <> combos
16:04 Grinnz_ that Perl6 module is actually quite a bit more complicated, that's odd
16:05 sri batman: because i'd like to be able to run all tests on my dev box (pretty sure i'm the one running the test suite the most currently)
16:05 Grinnz_ oh, it's dconway, not that odd :)
16:05 Grinnz_ sri: they should work on OS X also
16:05 sri "they"?
16:05 Grinnz_ tests involving /proc
16:06 sri there is no /proc on os x
16:06 Grinnz_ oh, i see
16:07 nicomen sri: not even if you mount it like on some BSDs?
16:07 sri i don't customize my os x
16:07 batman wow.
16:08 batman i spent several days making osx behave.
16:08 batman like... not suspending when i close the lid.
16:08 batman sri: my idea is off the table, since you want to test it on osx.
16:08 genio mostly I just install homebrew, perlbrew, atom, and iTerm2.  I live with most other defaults.
16:09 batman i still think it would be good enough to run the test with travis
16:09 sri i install homebrew and that's it, literally never touched anything outside of userspace
16:09 sri installing a dev environment is not customizing
16:09 sri nicomen was talking about modifying the operating system
16:09 * Grinnz_ likes sticking to userspace in linux too lately
16:10 nicomen sri: how about socket files?
16:10 Grinnz_ it might be possible to open a socket file in a tempdir to test with
16:10 sri so, we are out of proposals?
16:11 batman i don't think your argument is good enough sri. (the dev box argument) i think it's good enough that it's confirmed by travis.
16:11 batman that's where i stand.
16:14 sri you would take personal responsibility for that test? and investigate any problems that pop up in the future in a timely manner?
16:15 sri it would be the first time we had a non-sri space in mojolicious, which i'm unable to deal with
16:16 batman not sure what "timely manner" means. but i would investigate (whenever i'm around) any issue that is reported by travis regarding the slurp function.
16:17 sri cpantesters and problems reported by users would count too of course
16:17 batman yes.
16:17 batman sri: but! this need to be a vote. it's not batman vs superman ;)
16:18 batman s/superman/sri/
16:18 batman sri: if you're agains it, then i can't do much about it, other than respect your wish.
16:19 sri really too bad perl is not better at this
16:20 Grinnz_ it would be nice to have an integrated solution, at least it's starting to be shaken out now
16:20 sri you'd think something as simple as slurping files was reasonably optimized
16:21 Grinnz_ it's simple, until someone expects it to do something else :P
16:22 sri like "do { local $/; <FOO> }" should just be not terribly slow
16:22 Grinnz_ true
16:22 nicomen isn't there a special file in /dev on mac then?
16:23 pink_mist isn't -s wrong for passing to read() anyway since read() expects a number of characters, and -s gives a number of bytes?
16:23 nicomen which returns zero size and is of a certain length
16:23 sri pink_mist: we don't use read()
16:24 pink_mist then I must have misread the commit you linked to earlier
16:24 sri this is the code in question https://github.com/kraih/mojo/blob/master/lib/Mojo/Util.pm#L234-L240
16:24 sri the commit was something old, we never released
16:25 jnbek slurp, spurt.. Perl the only language where bad eating manners becomes valid code!! lol
16:25 pink_mist sri: ah, alright
16:27 sri for the record, "do {local $/; <FOO>}" is so slow it takes 2.51305s for my test
16:28 sri 0.735056s for the current code, 0.981803s for the sysread in a loop version
16:32 theshane11 joined #mojo
16:33 cpan_mojo CallBackery-0.2.5 by OETIKER https://metacpan.org/release/OETIKER/CallBackery-0.2.5
16:37 sri batman: so, you just gave up?
16:37 guru joined #mojo
16:38 batman either we put it up for a vote or you decide.
16:38 sri not many options right now
16:39 sri as in things we can actually do right now
16:39 jberger can't we just test /proc if /proc exists?
16:39 jberger (sorry, had to read the scrollback)
16:39 sri jberger: would be the first test i can't personally support
16:39 batman the idea is to keep your version, unless -s == 0. then we do the slow way (while loop + error handling + $content .= $buf)
16:39 jberger and tbh, I don't mind going back to the 0.9s version if its more reliable
16:40 sri jberger: had no error handling
16:40 jberger hmmm
16:40 batman yeah. we're not going back :)
16:40 sri the point was to switch to a simple idiom
16:40 batman sri: simple in code, but not in documentation, nor dwim (imho)
16:40 sri i like "defined $file->sysread(my $content, -s $file, 0) or croak..." because it's super simple and fast
16:41 sri batman: and yours is simple in documentation, but not in code or tests
16:42 batman it's only harder to test when you're not on linux. and i think that's ok, since we have Travis
16:42 sri i don't feel comfortable having code i can't personally support anymore
16:43 Grinnz_ i'm sure there is a way to test it on OS X
16:43 pink_mist well wouldn't testing it on a fifo or socket work?
16:43 Grinnz_ but i don't have OS X, so i can't test that :P
16:43 PopeF I have OSX
16:43 batman wouldn't testing it on socket/fifo just hang..?
16:44 pink_mist not if you fork off a supply
16:44 nicomen sri: so mojolicious is only guaranteed to work on OS X?
16:44 batman sri: I'm out if travis ain't good enough for you :/
16:44 sri nicomen: wat?
16:44 batman nicomen: of course not
16:45 mst nicomen: I'm unsure why you keep randomly picking fights in IRC channels but please reconsider your life choices
16:45 sri os x is just the lowest common denominator for features right now
16:45 batman mst: are you in spain?
16:46 mst batman: yep
16:46 nicomen sri: you say you don't feel comfortable having code that is not testable on your setup, I can understand that. But you have to realize the majority of users are using it on a platform that you are not personally testing on
16:46 batman cool! see you in a day or so :)
16:46 jberger nicomen: the question of course is making a solution portable, so that it does work on all platforms
16:46 mishanti1 Whats going down in Spain?
16:46 jberger YAPC::EU
16:46 batman nicomen: just stop. we have travis and a bunch of users running the tests on various platforms.
16:46 mishanti1 Except financial ruin.
16:47 mishanti1 Ah. :)
16:47 nicomen sure, we are all for that, I have suggested making a socket file on osx or checking some of the standard /dev files available
16:47 jberger what does -s on /dev/urandom do on mac?
16:47 batman nicomen: make a proposal that runs. fork mojo and gist a diff
16:47 sri i would have been open to alternative testing methods, but this is getting a bit too heated now
16:47 nicomen batman: I don't have a ma
16:48 jberger of course, you can't slurp that :-P
16:48 sri so, for now i'll dictate that we just add a note to the docs
16:48 nicomen mac
16:48 batman jberger: :)
16:48 jberger /dev/null?
16:48 nicomen it's inifinite
16:48 nicomen I tried to propose it earlier and googled quite a bit, and tried to see if I had anything on linux that was zero that would exist on mac
16:48 mst my thought would be to test the '-s doesn't work' case on a unix socket
16:49 jberger perl -E 'say -s "/dev/null"' # 0
16:49 jberger on my mac
16:49 Grinnz_ has to be something you can actually slurp
16:50 pink_mist jberger: yes, but if you try to slurp() that, you'll be in pain
16:50 PopeFelix jberger, you beat me to it. ;)
16:50 jberger so slurp returns nothing
16:50 PopeFelix slurp makes no sense on a socket.
16:50 pink_mist jberger: currently yes. this is what we're talking about fixing.
16:50 neilhwatson /dev/zero?
16:50 Grinnz_ i don't know enough about domain sockets to write this, but could you write some data to the socket, send EOF, then read from it?
16:50 pink_mist neilhwatson: also infinite
16:51 jberger slurping on /dev/null seems to work here
16:51 Grinnz_ jberger: if there's nothing to slurp, it didn't test anything
16:51 mst PopeFelix: sure it does
16:51 nicomen jberger: ah sorry, not infinite, but actually zero size
16:52 pink_mist ah right, I mistook /dev/null for /dev/zero ... then when /dev/zero was also brought up I didn't connect the dots >_>
16:52 Grinnz_ and slurp wouldn't work on urandom because it wouldn't end
16:52 mst PopeFelix: I've worked with plenty of services where I open a socket, send a request, then read until eof for the response
16:52 mst PopeFelix: you may've heard of HTTP
16:52 nicomen was thinking of /dev/klog, or even /dev/console (write only it seems),
16:52 PopeFelix mst, good point. ;)
16:52 Grinnz_ it's easy to make a domain socket in a tempdir, i just wouldn't know how to use it
16:52 nicomen maybe you can get some more ideas from this page I was looking at: http://docstore.mik.ua/orelly/unix3/mac/appa_01.htm
16:53 nicomen maybe use a modem device, and give yourself a call ;D
16:53 mst Grinnz_: er, listen to it, accept, print some stuff, close
16:53 * jberger remembers modem negotiate tone and pukes
16:53 mst my IO::Async apps usually have a built in repl built from that
16:53 nicomen stderr/stdin/stdout have a size on my setup, but perhaps not on mac os x
16:55 PopeFelix jberger, aw, it wasn't so bad.  I remember learning to recognize the different kinds of 56k tones, before 56k got standardized.
16:57 meshl joined #mojo
17:00 sri for the record, the slurp in core thread on p5p went nowhere i believe, not even a reasonable idiom came up... that should be a hint maybe
17:01 mst well, also, IIRC uri happened
17:01 mst sri: have you tried File::Slurper ?
17:01 sri looking for an idiom, not a module
17:02 sri File::Slurper uses a fallback
17:02 mst yes, I can read, now please stop, step back, assume good faith, and consider that there was a constructive reason why I asked that - which is that I'm curious what you thought of the feature set and the performance
17:02 mst whether we can extract an idiom from that is a separate question
17:03 mst but I was trying to expand the conversation since clearly an obvious simple answer doesn't exist
17:03 mst 'not a module' doesn't mean modules' source code can't be a useful source of further constructive discussion
17:04 sri you take a step back now please
17:04 mst sorry, I don't like being dismissed when I'm trying to be constructive, it's upsetting
17:04 mst but if you don't like the File::Slurper source code, then, yeah, never mind
17:04 dod joined #mojo
17:05 sri i've literally been discussing the File::Slurper source code over and over
17:05 * jberger compares File::Slurper to Path::Tiny
17:05 nicomen mst: the source was discussed earlier, Path::Tiny also, they both use the local $/; <FOO> approach, so it continued to evaluate wether one could use a fallback in the same manner, it is slower, and finally it needed a testable case also on osx
17:05 nicomen feels like a loop ;D
17:07 genio File::Slurper, Path::Tiny::slurp, Data::Munge::slurp, Mojo::Util::slurp, etc. etc.  I hardly know what to suggest for use these days.
17:07 buu Why can't we just call it `cat`
17:07 sri everybody is confused, even the participants of p5p
17:08 Grinnz_ if you're not already using Path::Tiny i would suggest File::Slurper for a lightweight dep
17:08 nicomen buu++
17:08 Grinnz_ and simple API
17:08 nicomen the obvious spurt/write_file equivalent would be 'dog'
17:09 Grinnz_ catdog lives!
17:09 batman buu: cat is short for concatinate
17:10 batman "concatenate"
17:10 mst nicomen: and then the faster replacement would be 'updog'
17:10 jberger sri: would simply creating an overloaded IO::Handle object which overloads -s be sufficient for testing?
17:11 nicomen mst: you got me
17:11 batman jberger: oooh! interesting idea :)
17:12 buu Oh hey, we forgot IO::All
17:12 genio and I guess you could add IO::Handle::getlines to that list
17:12 sri jberger: you tell me
17:12 pink_mist I don't think "forgot" is the right word, buu :P
17:12 mst io->file($foo)->all tends to work for me
17:12 mst pink_mist: I dunno, it's my standard tool
17:13 mst since Path::Tiny was basically NIH
17:13 Grinnz_ it's like Path::Tiny without trying for Tiny
17:13 mst whereas IO::All has a standing maint team
17:14 mst I'll try Path::Tiny if I ever need a fatpack that small
17:14 mst (but Path::Tiny is intentionally un-subclassable with ...)
17:15 Grinnz_ with what?
17:15 mst anything
17:15 mst that was meant to be 'which'
17:15 mst if you subclass Path::Tiny, it breaks, and that's officially expected
17:15 Grinnz_ ah
17:15 sri am i the only one who actually looked at the File::Slurper code?
17:15 Grinnz_ i did
17:15 sri it doesn't appear to even test the fallback
17:16 Grinnz_ well i didnt look at the tests
17:16 jberger no, neither does path::tiny as far as I got in reading them
17:16 sri lol
17:16 jberger certainly path::tiny has a lot more tests
17:17 bwf joined #mojo
17:17 Grinnz_ IO::All on the other hand is using getline with local $/
17:17 Grinnz_ directly
17:18 sri anything that needs local $/ seems to be horribly slow
17:18 mst yeah, I use IO::All for convenience, not performance
17:18 mst I suspect $/ touches too much magic :(
17:19 * mst would probably try read/sysread into a buffer until exhausted
17:19 sri as in 3-4 times slower
17:19 sri to reiterate
17:19 mst since sysread w/-s as suggested above will potentially go horribly wrong, I think, in the case where the initial read isn't full size
17:19 mst defined $file->sysread(my $content, -s $file, 0)
17:19 sri sysread until exhausted is slower too
17:19 sri quite a bit
17:20 mst can legitimately read less than the full content of $file
17:20 mst and return that many bytes
17:20 sri i've mentioned results earlier
17:20 sh4 joined #mojo
17:20 mst and now you have partial content
17:20 mst so that idiom is unsafe without extra work, sadly
17:20 sri yes, the race condition is a problem too
17:20 mst oh, write-during-read?
17:20 sri yea
17:21 mst the semantics of sysread already shot you in both feet long before you should ever notice that one, but, yeah, that'll break too :)
17:21 mst then again, read-until-eof with active writers is basically, uhhh, variable, anyway
17:21 berov joined #mojo
17:21 mst so I'm not sure I'd worry too much about that bit
17:21 sri safest option seems to be sysread into buffer until exhausted
17:22 sri but it's a little slower than sysread with -s
17:22 mst well, sysread returns the number of bytes read
17:22 mst so ... maybe if the return from sysread == the -s
17:22 mst you assume good
17:22 mst and if not, you do buffer-until-exhausted
17:22 mst then the simple case is fast, and the non-simple case still basically works
17:23 mst I mean, -hopefully- the -s trick works first read
17:23 nicomen wow
17:23 sri it would be nice to have a definitive idiom for slurping
17:23 mst you just have to handle when it doesn't
17:23 sri which is why i keep mentioning it ;p
17:23 nicomen like read until size met (could even be zero), then continue till EOF?
17:23 mst it would, yes, but uri <expletive> <expletive> <expletive> guttman derails any attempt to discuss it on p5p by explainig why File::Slurp is perfect
17:23 mst and PerlIO is horrible
17:23 mst and and and and and
17:23 mst sri: which is why I'm trying to help figure one out :)
17:23 Grinnz_ no, try to read the size you find, and then see if it actually read that amount
17:24 Grinnz_ the problem is still the sockets which return -so 0
17:24 Grinnz_ -s 0 *
17:24 mst yeah, and you'd only do that if -s returned >0
17:24 mst because srsly
17:24 Grinnz_ that still needs a fallback
17:24 mst yes, that's what I said
17:24 iloveyou joined #mojo
17:25 nicomen what should you do if file is truncated while reading?
17:25 nicomen or can you even notice?
17:25 mst ideally, a small gnome exits the back of the monitor and hits the developer with a mallet
17:25 Grinnz_ what anyone does in that case: facedesk
17:26 Grinnz_ but really you'd probably just get EOF
17:26 mst right
17:26 mst which is just yet another case of "didn't get exactly -s bytes first time, read until eof"
17:26 mst you're well into http://trout.me.uk/youtriedstar.jpg territory at that point anyway
17:26 * genio is glad there's no monitor gnome to beat him senseless with the amount of stupid he spews
17:27 Grinnz_ genio: spew is the Path::Tiny version
17:27 sri to put some code into the room, this is what i mean with the safe and reasonable fast solution https://gist.github.com/anonymous/7761d24ce36a4c1dec36
17:27 pink_mist I feel like getting beat senseless would be an improvement upon my current condition :/
17:28 Grinnz_ sri: is that the solution you said was slightly slower?
17:28 sri it is 0.743279s vs 0.962079s
17:28 sri (current solution first, safe second)
17:28 Grinnz_ i'm kind of thinking that's good enough, since it solves all of the cases and avoids further complication
17:29 mst sri: I still like trying the -s trick first and falling back
17:29 sri local $/ never goes below 2.47935s
17:30 mst sri: or at least i think it might be worth checking
17:31 sri mst: portable testing is the problem there
17:31 jberger sri: should I try to make an object for testing?
17:31 * jberger hacks
17:31 mst sri: how so?
17:31 sri jberger: i was waiting the whole time for an example
17:31 Grinnz_ jberger: no hairballs here
17:32 * jberger is also working an talking someone through one of his examples, so ... yeah
17:32 sri so far i'm the only one showing code and tests
17:33 mst I just arrived in granada, I don't have a full dev setup handy
17:33 mst after the conference I can happily write you a trivial IO::Async socket server that would provide a test case for this, then people can throw man pages at me until I figure out how to port it to mojo
17:34 sri unix domain sockets are a portability nightmare too
17:34 sri and not actually supported in mojolicious core
17:35 sri Mojo::Util::slurp requires a path, so you can't just pass it a socket
17:35 mst you can pass it a socket path
17:35 mst if you had support for that :/
17:38 jberger hehe, well if we are mocking, just mock "open" too
17:38 mst yeah, that's pretty easy actually
17:38 sri funny thing, if i modify the chunk size in the sysread loop to 1mb, it gets slower
17:38 batman sri: i would very much appreciate 7761d24ce36a4c1dec36
17:39 mst jberger: http://shadow.cat/blog/matt-s-trout/war-stories-open-sesame/
17:39 batman i think in most cases it's fast enough
17:39 sri somehow reading in chunks of 128kb seems to be some kind of sweet spot for my dev box
17:40 batman is that "sweat spot" stored in POSIX..?
17:41 mst probably depends on the file system, the OS, the phase of the moon, and the number of russians in a quarter mile radius
17:41 mst performance tuning always seems to
17:42 batman :D
17:43 mst "hmmmm, performance seems to vary depending on how close I am to zoffix, either it's file system tuning again or the alcohol fumes are affecting it"
17:43 sri it's also a sandforce ssd
17:44 sri so compression
17:44 Grinnz_ sri: is the benchmark you're using in the repo?
17:45 mst IRTA sadface ssd
17:45 sri Grinnz_: just a one-liner
17:45 sri perl -Ilib -Mojo -E 'n { Mojo::Util::slurp "../../test.bin" } 10'
17:45 Grinnz_ what's test.bin :P
17:46 sri with a 300mb mp4 (less compressible, so more consistent)
17:46 mst Grinnz_: you are not cleared for that information. your clearance level is purple. trust sri. sri is your friend.
17:47 * Grinnz_ ponders writing a test file that generates giant temp files
17:48 sri it has to be a battlestar galactica episode
17:48 sri otherwise the benchmark is invalid
17:48 Grinnz_ heh
17:48 marty joined #mojo
17:49 Grinnz_ which series, 60s, 80s or 2000s?
17:49 sri 2000s
17:49 * Grinnz_ watched the 60s version a while back... it was painful
17:50 neilhwatson 70s
17:50 good_news_everyon joined #mojo
17:50 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/vGEYP
17:50 good_news_everyon mojo/master 1c448e3 Sebastian Riedel: improve portability of slurp function in Mojo::Util
17:50 good_news_everyon left #mojo
17:50 mst it was classic old school silly british sci-fi
17:50 mst you have to watch it for what it is
17:52 sri slurp is serious business :S
17:52 mst and therefore requires bleak in space
17:53 sri you know, at first i thought the thread about a core function was silly, but after all this... it is soooo warranted
17:54 Grinnz_ definitely
17:54 sri anyone know of the perl6 method is still called spurt()?
17:55 sri i think they wanted to rename it to spew()
17:55 mst the grammar's still called STD, their innuendo avoidance is basically already toast ;)
17:56 mst anyway, must go find food and beer &
17:57 pink_mist http://design.perl6.org/S16.html#Functions <-- listed as spurt in here still
17:59 sri we have two slurp implementations in core btw.
17:59 sri https://github.com/kraih/mojo/blob/master/lib/Mojo/Asset/File.pm#L127
17:59 sri that one is still optimized
18:05 jberger this is where I have gotten so far: https://gist.github.com/jberger/2d8e7767b1bd470c8551
18:05 sri btw. pink_mist's joke doesn't perform as bad as local $/
18:05 sri 1.21981s for qx/cat $path/
18:07 Ptolemarch joined #mojo
18:09 sri jberger: interesting
18:11 theshane11 left #mojo
18:16 * jberger has to get lunch, see if that works for the proposed fallback implementation
18:17 jberger Also I see that over loading -X is 5.12 and I'm not sure where open overloading shows up
18:18 sri oh, right
18:20 hernanGOA joined #mojo
18:25 iloveyou joined #mojo
18:25 PopeF joined #mojo
18:29 disputin joined #mojo
18:35 ajr_ joined #mojo
18:51 PopeFelix joined #mojo
19:02 jberger sri: I'm not sure that's working :s
19:07 jberger ah, no, I'm overloading open too late
19:13 hernanGOA joined #mojo
19:20 PopeF joined #mojo
19:20 hernanGOA joined #mojo
19:26 iloveyou joined #mojo
19:33 jberger when I get closer to something working I start getting a strict violation out of Digest::SHA :s
19:37 melo joined #mojo
19:50 hernanGO1 joined #mojo
19:51 disputin joined #mojo
20:04 batman if anyone is curious about convos: https://twitter.com/jhthorsen/status/638442254064070656
20:24 Ptolemarch joined #mojo
20:28 ajr_ joined #mojo
20:57 iloveyou joined #mojo
20:57 jberger prinsiples
20:57 jberger s/s/c/
20:58 Ptolemarch joined #mojo
20:58 jberger batman++
20:58 * Grinnz_ keeps feeling like there's some improvements that should be made to https://metacpan.org/source/DBOOK/Mojo-JSON-MaybeXS-0.008/lib/Mojo/JSON/MaybeXS.pm
20:59 Grinnz_ but nothing seems to give a significant performance difference
20:59 batman jberger: thanks! fixed the typo now and fixed the diagram
20:59 batman somehow i missed out on "User" :P
21:00 jberger Grinnz_: if I may toot my own horn, metamerge.json was my idea ;-)
21:00 Grinnz_ jberger++ # too, then :P
21:01 nicomen batman: nice ;)
21:01 disputin joined #mojo
21:01 jberger Grinnz_: https://github.com/Leont/app-modulebuildtiny/compare/master...jberger:distmeta
21:10 meshl joined #mojo
21:45 PopeFelix I'm using Mojo::UserAgent to communicate with a web service that marks you as authenticated by setting a cookie.  Is there a nice way to make my UA log in on the first request but only the first request?
21:46 hernanGOA is it login on every request ?
21:47 Grinnz_ PopeFelix: that should just work, the UA object keeps a cookie jar
21:47 hernanGOA just send updated headers with cookies after login
21:48 Grinnz_ PopeFelix: or you mean the actual login itself? you'd have to implement that however it's expected by the web service
21:48 PopeFelix No, log in on the first request, then send the cookie on subsequent requests.
21:48 PopeFelix No, I'm probably not saying it right.
21:48 PopeFelix Let me work up a paste.
21:48 Grinnz_ the cookie will be sent automatically once it's received
21:49 PopeFelix Sorry, I misspoke. I need to set the cookie, and I'll receive it from the login process.
21:49 Grinnz_ why do you need to set it?
21:49 y1mmm joined #mojo
21:50 PopeFelix That's how the authentication works.  You POST your credentials to the login URL, they send you an auth token.  You then set a cookie with that auth token.
21:50 Grinnz_ it doesn't send it as a cookie?
21:52 jberger you can make a method which short circuits if the cookie already exists
21:52 PopeFelix "The returning session value provided has to be set in subsequent calls as part of
21:52 PopeFelix How do I do that?
21:52 PopeFelix dammit
21:52 jberger and just call it inside the methods that need authentication
21:52 PopeFelix Oh, well, yes, I could do that.
21:52 jberger PopeFelix: that's not a cookie
21:53 PopeFelix That's what the docs said.  "The returning session value provided has to be set in subsequent calls as part of the cookie within the header."
21:53 PopeFelix brb
21:53 Grinnz_ how is it returned?
21:55 sri PopeFelix: please no swearing in this channel
21:58 jberger I really am bad at spotting swearing when not in anger (at someone)
21:58 jberger my radar is tuned to the wrong thing
21:59 sri my english skills are limited, but wasn't that even directed at you?
21:59 nicomen jberger: first time I see an actual swear word
21:59 sri if i talk to someone and say "how do i do that dammit", isn't that rather offensive?
21:59 jberger oh I saw that as frustration, but I guess you could read it that way
22:00 nicomen PopeFelix: You probably want to go to the main page "both" times, check wether you are logged in based on for instance a "log in" text
22:00 ZoffixMobile joined #mojo
22:00 nicomen and then decide to post or not
22:00 jberger yeah, if that was at me >:(
22:00 jberger (but I don't think it was)
22:00 ZoffixMobile sri, nah, I think it was due to sendong an unfinished sentence :)
22:00 ZoffixMobile *sending
22:00 sri in any case, just refrain from swearing
22:00 jberger indeed
22:01 nicomen "how do I do that?" "dammit" - is very clearly directed at himself for not getting it. But a swear word is a swear word.
22:01 Grinnz_ yeah what ZoffixMobile said
22:02 ZoffixMobile Anyway, PopeFelix, are you sure you're using the same UA object for both requests?
22:02 ZoffixMobile 'Cause of it's a new object, it won't remember the login cookie
22:02 sri nicomen: we seem to have very different definitions for "very clearly"
22:03 * ZoffixMobile blames languages
22:04 nicomen it's two sentences, it's like saying "how do I do that?", "<pull my hair>"
22:04 Grinnz_ it wasn't even referring to that sentence
22:04 Grinnz_ it was regarding the mispaste, but anyway it's not important
22:05 ZoffixMobile Indeed. Let's move on.
22:05 nicomen haha, ok
22:05 nicomen PopeFelix: sounds like you are using an orcale rest api?
22:06 jberger sri / all: is this an insane way to use "has" for attributes? http://pastie.org/10388302
22:07 nicomen PopeFelix: did you try inspecting the cookie yourself? or the headers received? because based on the text, it sounds like you need to set it yourself?
22:07 ZoffixMobile Jberger, I feel fine with it
22:08 Grinnz_ jberger: has _expensive => sub { blah }; has a => sub { shift->expensive->{a} } ?
22:08 Grinnz_ shift->_expensive rather
22:08 nicomen PopeFelix: if it indeed is this one: http://www.oracle.com/technetwork/documentation/restapiv124-1870459.pdf ?
22:08 jberger Grinnz_: yeah, that's better
22:08 ZoffixMobile Yeah
22:09 Grinnz_ it could get weird if you start deleting things, is all
22:09 Grinnz_ probably true for either way
22:10 mst ZoffixMobile: if you didn't get anything back from barbie, maybe mail again and suggest we set up a channel or something?
22:12 jberger mst: he did, but it seems someone had already stepped up
22:12 cfedde what can a mere mortal do to assist with the testers thing?
22:12 jberger we are on his back burner
22:12 jberger cfedde: make it such that a mere mortal can assist
22:12 jberger :-P
22:12 cfedde yay!
22:13 mst cfedde: I was trying to create a situation where we could work that out
22:13 mst jberger: ok, can you please be less vague when I'm at YAPC::EU and about to try and recruit half the conference to help and you're keeping me in the dark :P
22:13 AndroUser2 joined #mojo
22:13 Grinnz_ mst: there was an update to the blog post, it was about that vague
22:13 AndroUser2 mst, I did get a reply: irclog.perlgeek.de/mojo/2015-08-31#i_11146392
22:14 mst right. I'll probably have to kick him directly to get the details then
22:14 ZoffixMobile2 :)
22:14 jberger ZoffixMobile2: need me to kick an alternate you?
22:14 mst also to vouch for at least a few members of #mojo so you don't get tarred with very old feuds
22:15 jberger actually, I can't kick you from the server, nm
22:15 mst I can
22:17 ZoffixMobile2 \o/
22:21 nicomen mst: if you look at the line above Zoffix, I got a reply too. It was the same text basically.
22:21 ZoffixMobile Good to see such quick reply from the community!
22:22 nicomen yeah ;)
22:22 nicomen always scary when building blocks lose support
22:22 nicomen and it's nice when you run a site to feel that there are people that can help
22:25 iloveyou joined #mojo
22:25 mst shame I was the only one who offered to help when it first broke
22:25 mst nice to see that now he's specifically asked, people are getting over their bystander syndrome and trying though
22:27 mst not that other people aren't willing, I just wish people would realise you can volunteer -before- somebody shouts 'go'
22:27 mst that was my biggest problem adjusting to sri's departure from catalyst, he was the guy who shouted go and I ended up lead against my will because while I wasn't as good as shouting go I was the only one who did at all :(
22:27 ZoffixMobile mst++ that's a goos point. It didn't even cross my mind to offer help when I first heard of the issue.
22:28 ZoffixMobile *good
22:28 mst right, but I don't want to denigrate the fact that once I made him realise he was allowed to once help and he asked, y'all stepped up
22:28 mst that's still awesome
22:28 nicomen I got really curious about the db problems, oh and I build cpan modules with recursive dependencies and test results from scratch daily
22:28 cpan_mojo Mojo-SQLite-0.012 by DBOOK https://metacpan.org/release/DBOOK/Mojo-SQLite-0.012
22:28 mst s/once/want/
22:29 * mst was also grumpy with barbie for not asking for help sooner too ;)
22:29 ZoffixMobile :-)
22:38 PopeFelix sorry, i have to run.  nicomen, yes, it's oracle, and thank you and Grinnz for helping.
22:38 PopeFelix nicomen, and yes, that one. :)
22:39 PopeFelix sri, sorry for my language.  and it was directed at myself
22:39 PopeFelix zoffix was right
22:40 nicomen PopeFelix: I would check if you get a SetCookie* header back, if so, listen to what peopl said about cookiejar and using the exact same ua object. If not, you need to fetch the authToken from somewhere and set it in a cookie yourself before continuing
22:40 PopeFelix and now i really have to run. :)
22:40 dvinciguerra joined #mojo
22:40 PopeFelix nicomen, thanks
22:41 nicomen yw
22:44 ZoffixMobile joined #mojo
22:55 iloveyou joined #mojo
23:15 Snelius joined #mojo
23:49 iloveyou joined #mojo
23:57 jberger joined #mojo

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