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

IRC log for #mojo, 2014-12-13

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

All times shown according to UTC.

Time Nick Message
00:14 absolut__ joined #mojo
00:24 absolut_todd joined #mojo
00:29 absolut__ joined #mojo
00:39 jberger reading through the advent calendars today
00:40 jberger I really don't want to dis any other frameworks, but I'm always amazed at how rudimentary other framework's testing architectures look compared to Test::Mojo
00:40 jberger https://metacpan.org/pod/Dancer2::Manual::Testing
00:41 jberger that's just an example, but since it uses Plack::Test I'm not really criticizing Dancer especially
00:48 absolut_todd joined #mojo
00:50 absolu___ joined #mojo
01:40 * jberger plays with perl6
01:40 jberger perl6 -e 'Supply.interval(1).tap({say "$_ sec"}); sleep 10'
01:40 jberger so farking cool
01:45 woz joined #mojo
01:59 good_news_everyon joined #mojo
01:59 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/Ljyhkw
01:59 good_news_everyon mojo/master 4bfb82d Sebastian Riedel: mention IO::Socket::Socks dependency
01:59 good_news_everyon left #mojo
02:04 * Grinnz still can't figure out what tap actually does
02:06 jberger in perl6 tap taps into the supply
02:11 akhasanov joined #mojo
02:12 Grinnz oh god that wat talk purl linked is amazing
02:13 klapperl_ joined #mojo
02:13 Grinnz i'm sure something in perl5 could be added to that
02:15 * jberger starts watching
02:17 jberger zomg
02:17 jberger must
02:17 jberger breathe
02:17 Grinnz the presenter reminds me of if Jerry Holkins was a programmer
02:17 Grinnz similar voice and comedic style
02:18 good_news_everyon joined #mojo
02:18 good_news_everyon [mojo] kraih tagged v5.69 at d53885f: http://git.io/pA8c4g
02:18 good_news_everyon left #mojo
02:18 jberger how have I never actually watched that before?!
02:19 * jberger watches again
02:19 Grinnz i can see why he didn't include PHP though, it'd be a half hour long
02:19 good_news_everyon joined #mojo
02:19 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/yznUBA
02:19 good_news_everyon mojo/master 4e9360f Sebastian Riedel: bump version
02:19 good_news_everyon left #mojo
02:20 jberger Grinnz: I would use Nancy typing for my p5 one
02:20 jberger 1 == 1
02:20 jberger 'Paul' == 'Paul'
02:20 jberger 'Nancy' != 'Nancy'
02:20 jberger hehe
02:20 Grinnz lol
02:20 jberger (use warnings)
02:21 sri if you like distributed systems, you'll laugh your ass off about this talk too http://vimeo.com/95066828
02:22 Grinnz ahh because it turns it into nan
02:22 Grinnz rofl
02:22 jberger Grinnz++
02:23 Grinnz hooray new release
02:23 jberger hehe, in all the laughter and tears I completely missed it!
02:23 jberger sri++
02:32 jberger "Why does anything happen at all" hahahaha
02:39 Grinnz lol
02:44 Grinnz this guy is great
02:55 ryozi joined #mojo
03:09 noganex joined #mojo
03:13 akhasanov joined #mojo
03:34 denny joined #mojo
03:34 woz joined #mojo
03:52 disputin joined #mojo
04:02 franzkafka Evening guys
04:02 franzkafka I have a question for you.
04:02 franzkafka It's with regards to Mojo::UA and CSS selectors.
04:03 preaction ask to ask ask
04:03 purl Don't ask to ask ask. Don't ask if ask can help you with x. Just ask ask! If ask doesn't answer, then rest assured that it's not that he doesn't know but that it's specifically because he doesn't like you.
04:04 preaction ask ask to ask ask
04:04 purl Don't ask ask to ask ask.  He talks to himself enough as it is.
04:04 franzkafka I have something like this: <div class="col-md-8"><h2>Blah</h2>a bunch of text, some of it wrapped in tags, e.g., <i>boogers</i><br /><h2>Another heading<div class="ruler></div>
04:04 preaction (the joke is there's a person named "ask")
04:04 franzkafka preaction :)
04:05 franzkafka Once you explained the joke it was actually pretty funny
04:05 franzkafka So, I want to grab the "a bunch of text, some of it wrapped in tags, but the totality of the text wrapped in nothing..."
04:06 franzkafka I.e., everything between <h2>Description</h2>(this stuff) and <div class="ruler">
04:06 franzkafka Now, I am using FirePath and it doesn't even put a box around the bunch of text showing me the CSS selector, because there isn't one.
04:06 franzkafka Is there any way to do this without using a regex?
04:06 preaction you can't do that with just the selectors. you can get the nodes in .col-md-8 (but that's a class and probably happens more than once, so perhaps look for .col-md-8 h2 and then go to its parent
04:07 preaction then, walk over each node and take the ones you want
04:07 preaction Mojo::Collection probably has something like grep() or reduce(), or you could just use grep() or List::Util::reduce()
04:07 franzkafka ok, let me give that a try... I am going to try walking over the nodes first.
04:08 franzkafka Thank you preaction :D
04:10 franzkafka $dom->find('div.col-md-8')->each(sub { say $_->text }); worked
04:11 franzkafka I don't know man, I don't like it
04:11 franzkafka ok
04:34 Eke- joined #mojo
04:45 franzkafka Yeah, I think I need to use a regex against it :/
05:23 woz joined #mojo
06:08 sri preaction: both of course! :)
06:09 * sri is still amazed we got $a and $b to work
06:11 sri still remember how sceptical i was about reduce... but i love that count all tags with a hash example we got now http://mojolicio.us/perldoc/Mojo/DOM#find
06:12 davido___ joined #mojo
06:18 rem_lex joined #mojo
06:28 franzkafka what's the best way to ensure a page loaded correctly? I am doing $tx->res->is_status_class(200)
06:31 neyasov______ joined #mojo
07:08 damaya joined #mojo
07:10 imatesting joined #mojo
07:12 woz joined #mojo
07:40 irq joined #mojo
08:20 alnewkirk joined #mojo
08:30 preaction i'm building a filesystem watcher to my dev site instance so that if you edit the sites markdown files, the site automatically rebuilds itself. i'm going to add a websocket to notify the browser to refresh the page after the rebuild is complete. can anyone think of any reason why all of this should not be the default?
08:31 preaction jekyll makes you opt-in, using jekyll daemon --watch; i think it should simply be the default.
08:52 Vandal joined #mojo
08:54 amon joined #mojo
08:57 dod joined #mojo
09:01 woz joined #mojo
09:39 franzkafka I've build a Mojo::Transaction::HTTP object and now I am trying to use UserAgent to send the request: http://pastebin.com/dExWwHAa
09:39 franzkafka How do I properly do this?
09:40 tempire http://mojolicio.us/perldoc/Mojo/UserAgent#build_tx
09:42 franzkafka tempire, I see build_tx... so in my conditional I say something like my $method; if ( $blah ) { $method = 'put'; } else { $method = 'post'; } ... $ua->build_tx($method ...)?
09:43 franzkafka rather than setting variables and passing those variables into build_tx, I'd much prefer using methods like $obj->method('GET'), $obj->header(...), etc
09:44 franzkafka my $tx = $ua->($obj); or something
09:44 franzkafka Build the request object and then pass that to useragent
09:44 tempire objects are the devil
09:45 tempire build a list and pass it to build_tx
09:47 franzkafka ok. sounds good enough
09:52 trone joined #mojo
09:56 franzkafka tempire, so if ($blah) { $tx_string = "POST => $url => { 'If-None-Match' => '\"*\"' } => json => $key"; } and then later $ua->build_tx($tx_string);
10:05 disco joined #mojo
10:11 basiliscos joined #mojo
10:25 sh4 joined #mojo
10:45 damaya joined #mojo
10:50 woz joined #mojo
11:32 sugar joined #mojo
11:45 dod joined #mojo
12:11 punter joined #mojo
12:39 woz joined #mojo
12:47 sugar_ joined #mojo
14:08 asarch joined #mojo
14:28 woz joined #mojo
14:52 PotatoGim^Home joined #mojo
14:54 nicomen franzkafka: why are you passing a srting?
14:55 denny joined #mojo
15:10 * sri yawns
15:15 akhasanov joined #mojo
15:32 jberger \o\
15:33 jberger /o/
15:40 sri ~o~
15:53 jberger sri: look out! there's a snake behind you!
16:00 crab is it a friendly snake?
16:11 * sri wonders if making tokens so configurable in Mojo::Template was a mistake
16:12 sri compiling all those regexes over and over is rather expensive
16:12 akhasanov joined #mojo
16:17 woz joined #mojo
16:17 mst sri: cache the last version you used in the class somewhere on the assumption people probably pick one?
16:26 sri nope, very little gain
16:31 sri you'd think this method was easy to optimize https://github.com/kraih/mojo/blob/master/lib/Mojo/Template.pm#L115
16:35 sri perl -Mojo -E 'n { Mojo::Template->new->parse(q{test <% for (1 .. 3) { %><%= 1 + 1 %><%= 3 + 3 %><%= 4 + 4 %><% } %>123} x 100) } 100'
16:35 sri been testing with that one-liner
16:35 sri cache gets it down from 1.1s to 1.0s
16:35 sri which is meh
16:37 sri only with some appended /o it gets better
16:38 sri 0.8s and faster
16:38 sri so it's really the dynamic tokens killing everything
16:43 sri actually, that 0.1s gain is from moving regex compilation out of the loop
16:43 sri the cache does absolutely nothing
16:44 sri well... nytprof says regex compilation takes 63µs
16:47 sri not even sure this is worth it for 0.1s of template compilation time https://gist.github.com/anonymous/9e81480d50ecb778772d
16:51 mst WHAT HAPPENED TO 2 + 2?
16:51 mst YOU MONSTER
16:54 sri SOME MEN JUST WANT TO SEE THE WORLD BURN
16:57 dod joined #mojo
16:57 woz joined #mojo
17:04 good_news_everyon joined #mojo
17:04 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/TXjsRA
17:04 good_news_everyon mojo/master 6712502 Sebastian Riedel: improved Mojo::Template performance
17:04 good_news_everyon left #mojo
17:04 sri oh well, 5-10% is 5-10%
17:06 sri although the renderer cache will prolly make it unnoticeable
17:06 sri (the one that keeps the last 100 templates pre-compiled)
17:10 mst LRU! LRU! LRU!
17:25 mst sri: I must admit that the excessive configurability strikes me as more like to be a way for your users to shoot themselves in the foot more than anything else
17:25 mst but ... meh
17:37 Adurah joined #mojo
17:43 Grinnz .oO(Mojo::Template::Tiny?)
17:43 sri mst: you have to consider that Mojo::Template was started at a time when we had no idea where it would end up
17:44 Grinnz lots of projects do :)
17:44 sri now it's mostly configurable for backwards compatibility
17:45 sri it was the time when haml, mustache and friends were still new
17:46 sri and django templates
17:46 purl django templates are intentionally dumbed-down so that “a designer can wrap his head around them.” So it makes you jump through a lot of hoops if you happen to take on both the role of the programmer and that of the template author.
17:47 * sri pats purl
17:47 * purl bites!
17:47 * sri bites purl
17:47 * purl bites sri back
17:47 Grinnz rawr
17:48 jberger one of these days, I still intend to release a Mojo::Template configuration for LaTeX
17:48 jberger the defaults would interact very badly with LaTeX markup
17:54 Eke- joined #mojo
18:00 mst sri: oh, sure. I'd probably have done the same thing
18:03 sh4|2 joined #mojo
18:09 sri happy birthday marcusr!
18:19 tempire I don't know who this marcusr is, but when marcus comes back from his birthday party, I suspect there will be words.
18:24 Grinnz i thought it was batman's birthday?
18:26 jberger it was supergirl's birthday
18:27 jberger happy birthday marcusr!
18:32 tempire It must be everyone in Norways' birthday
18:45 moritz didn't you know about the Great Norwegian Birthday Unification? :-)
19:02 mst hrmf
19:03 mst package JSONShim; sub new { bless {}, __PACKAGE__ } sub decode { Mojo::JSON::decode_json($_[1]) }
19:03 mst then
19:03 mst local *Parse::CPAN::Meta::_json_backend = sub { 'JSONShim' }
19:03 mst meh
19:04 mst at that point I may's well just hack load_json_string directly
19:14 Eke- joined #mojo
19:24 woz joined #mojo
19:35 Grinnz_ joined #mojo
19:58 Grinnz joined #mojo
20:11 howitdo joined #mojo
20:18 akhasanov joined #mojo
20:25 sri https://pbs.twimg.com/media/B4rVC4ICQAAr65m.jpg
20:58 Grinnz lol
21:07 zivester joined #mojo
22:02 nebulous joined #mojo
22:06 nebulous could anyone point me to an example how to open a file and fire an event whenever content is added? Basically "tail -f". My documentation-search skills are failing.
22:07 nebulous stepping back: what I'm ultimately trying to achieve is to stream a serial tty out a websocket indefinitely.
22:13 preaction Mojo::IOLoop::Stream might work for you. otherwise, Mojo::Reactor->io
22:13 preaction Stream is probably good for you. the lower-level Reactor is necessary if you have to do special things to read from the handle.
22:14 nebulous preaction: yeah I attempted to put together a test using /dev/urandom with Mojo::IOLoop::Stream, but it immediately closes for some reason
22:14 preaction pastebin code
22:15 preaction did you ->start the stream before adding it to the IOLoop?
22:19 nebulous http://pastebin.com/eG6THx2h
22:20 KCL_ joined #mojo
22:20 nebulous I'm sure I'm just missing something trivial. Basically just pasted the IOLoop::Stream synopsis from cpan
22:24 woz joined #mojo
22:24 preaction when pasting code, could you remove the | characters? it's hard for me to copy paste your code into my editor to run it
22:24 nebulous preaction: derp. vim/terminal fail.
22:26 preaction works for me
22:26 nebulous http://pastebin.com/5ujgPNCB
22:27 nebulous works eh? Must be some unrelated issue then
22:27 preaction https://gist.github.com/preaction/afa3588b56971cc86776
22:27 preaction i get an endless stream of Read from stream\n messages
22:28 nebulous indeed, said gist runs fine.
22:29 preaction oh. here's a guess: $stream gets destroyed at the end of the block
22:29 preaction it works for me because reactor was not running, and reactor->start blocks
22:30 nebulous ahh, good guess. I added a sleep 10 at the end and CLOSE didn't fire for 10 seconds
22:30 preaction so hold on to the stream in a hash outside of your callback, and then when it closes or the controller fires finish, destroy the stream in that hash
22:31 nebulous preaction: yep. moving stream def outside of the sub does the job, thanks.
22:34 basiliscos joined #mojo
23:25 asarch joined #mojo
23:52 Grinnz joined #mojo

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