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

IRC log for #mojo, 2014-11-04

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

All times shown according to UTC.

Time Nick Message
00:07 snap_ joined #mojo
00:19 disputin joined #mojo
00:19 jberger re linking to pthreads, the interpreter has to do that? could the xs module link to it and be sufficient?
00:22 jberger oh reading the perl rt bug I see the problem is initialization
00:22 jberger never mind
00:37 bpmedley I wonder if the initialization method(s) can be called in XS.
00:53 jberger I can't verify (yet) but this guy seems to think that dl_open flags might be sufficient: http://stackoverflow.com/questions/26190860/threaded-shared-library-for-non-threaded-application#comment41070895_26191843
00:53 jberger which can totally be done
01:03 dvinciguerra joined #mojo
01:06 bpmedley Where would you put the call to dlopen?
01:22 bpmedley https://sourceware.org/bugzilla/show_bug.cgi?id=16628 <— Some good info, perhaps
01:27 neyasov joined #mojo
01:43 jberger_ joined #mojo
01:44 jberger_ bpmedley: before XSLoader
02:16 denny joined #mojo
02:17 d4rkie joined #mojo
02:18 doublelel joined #mojo
02:27 KCL joined #mojo
02:35 bpmedley http://pastie.org/9694491 <— This change to Net::DNS::Native makes it so that test 5 doesn’t seem to segfault.
02:37 jberger_ joined #mojo
02:52 franzkafka Using this (Routing via Callback Mojolicious::Plugin::Authentication) is it possible to route / to different pages depending on if auth'd?
02:52 franzkafka http://search.cpan.org/~madcat/Mojolicious-Plugin-Authentication-1.26/lib/Mojolicious/Plugin/Authentication.pm#ROUTING_VIA_CALLBACK
02:53 romel hello. what if i want to store some information for the whole app since its' start? where should i put it?
02:56 bpmedley romel: I would use a helper with a state variable.
02:57 bpmedley Do you need an example?
02:57 romel bpmedley: it would be nice :)
03:01 franzkafka i.e., can route callbacks have routes in them, or does it just have to be render?
03:01 bpmedley http://pastie.org/9694516 <— I hope that’s right for a ::Lite app.  I usually do them in full apps only.
03:01 franzkafka Looking at this: http://mojolicio.us/perldoc/Mojolicious/Guides/Routing#Route-to-callback
03:03 bpmedley franzkafka: What does the module give you setting a session variable wouldn’t?  Seems like a lot of complexity for something that could be streamlined.
03:04 bpmedley I use a “under” bridge for that.
03:04 bpmedley Would you like to see an example?
03:04 franzkafka bpmedley, you are full of examples tonight :D
03:04 romel bpmedley: thanks a lot
03:05 franzkafka bpmedley, I was doing it without the module before, and I'm pretty sure I was doing it right. I guess then that most people in here are not using or advocating the use of Mojolicious::Plugin::Authentication then?
03:05 franzkafka Although, an example certainly couldn't hurt, just to be sure
03:06 bpmedley http://pastie.org/9694519 <— see the redirects
03:06 bpmedley Not saying that.  I’m just ignorant of what the module does.
03:07 franzkafka bpmedley, nice and thank you!
03:15 romel bpmedley: your state variable example is great. many thanks!
03:15 franzkafka bpmedley, from what I can tell though in your example domain.com/ will go to domain.com/ if not authenticated and domain.com/dashboard if you are authenticated
03:16 franzkafka I want it to go to domain.com/ either way, but what it shows for domain.com/ will be different depending on whether authenticated or not.
03:16 neyasov joined #mojo
03:16 ppp joined #mojo
03:16 bpmedley I see.  Hrmm.
03:17 bpmedley What I hear you say is you wan the “action” of the route to be dynamic dependant on the authenticated sate.
03:17 bpmedley *state
03:17 franzkafka Correct
03:22 franzkafka http://pastie.org/9694533 <- something like that, but I know that's not the correct way to do it.
03:28 hesperaux joined #mojo
03:34 sri bpmedley: wait a minute, you have a fix to make Net::DNS::Native work on non-threaded perl?
03:34 bpmedley All I know is that the tests in Net::DNS::Native pass…
03:34 franzkafka bpmedley, are dynamic actions based on state possible?
03:34 bpmedley Without the code patch test 05 segfaults a lot.
03:35 bpmedley franzkafka: One sec.
03:35 franzkafka bpmedley, no problem, I am shampooing my carpets :)
03:36 bpmedley sri: I’m sorry to be vauge; I don’t know if the code change fixes everything.
03:40 sri i'll be damned
03:40 sri UV works with the fix
03:40 bpmedley Sweet!!
03:41 sri 1000 getaddrinfo segfaults without, and just works with it
03:41 bpmedley How much faster is it?
03:41 sri faster?
03:42 bpmedley Hrmm, as a reference point the 191 urls from the other day.
03:42 sri i have done no tests at all
03:44 sri got a branch with basic support though if you want to try it https://github.com/kraih/mojo/compare/net_dns_native
03:44 sri shitty code, just a proof of concept
03:44 sri needs to be cleaned up and ipv4 only needs to be handled somehow
03:46 sri bpmedley: you might want to mention your solution in #700 or open a ticket for Net::DNS::Native (or both) https://github.com/kraih/mojo/issues/700
03:46 bpmedley Ok, one sec.
03:47 bpmedley The tests on that branch fail for me
03:48 sri not surprising
03:59 sri bpmedley: should pass again now
03:59 good_news_everyon joined #mojo
03:59 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/AFXcFQ
03:59 good_news_everyon mojo/net_dns_native a1ac74b Sebastian Riedel: make tests pass again
03:59 good_news_everyon left #mojo
03:59 nicomen joined #mojo
03:59 sri still very shitty code though
04:01 jberger hey, do I get any love here?
04:01 jberger :p
04:01 bpmedley No, just shitty code.. :P
04:02 bpmedley franzkafka: I can’t get a dynamic action to work.  I’m not well versed in hooks and actions ’n things.
04:03 bpmedley Result: PASS  <— that’s cool.  Glad jberger found the flags thing.
04:04 jberger https://github.com/Perl5-Alien/Alien-Base/blob/master/lib/Alien/Base.pm#L149
04:04 jberger never thought my Alien::Base knowledge would help in mojo land
04:04 jberger bpmedley++ putting it together
04:05 bpmedley Where do I open a ticket for Net::DNS::Native?  metacpan?
04:07 hesperaux_ joined #mojo
04:08 sri looks like i screwed up earlier, going IO::Socket::IP only seems to actually work here
04:10 sri this migth end up not so bad after all, IO::Socket::IP actually handles the raw getaddrinfo input, so we can pass that along
04:18 bpmedley The “mojou” script takes 5-6 seconds to run with your Net::DNS::Native branch.
04:22 jberger bpmedley: why bootstrap_inherit?
04:23 bpmedley I think it allows for the flag sub to be called.  I honestly copied ’n pasted it from some documentation.
04:24 jberger I think just defining the dl_load_flags method and bootstapping normally with DynaLoader would be fine
04:25 bpmedley What would that code look like?
04:25 jberger http://perldoc.perl.org/DynaLoader.html#SYNOPSIS
04:25 yuni_ joined #mojo
04:26 bpmedley It saves a bit of typing with ISA; that seems to be the only reason.
04:27 jberger I just worry that bootstrap_inherit seems to have no documentation
04:27 jberger I guess it doesn't matter much
04:28 bpmedley I see.  The documented approach is usually better.
04:34 doublelel joined #mojo
04:37 sri argh, somehow i can't get the clean version to work :(
04:37 sri IO::Socket::IP handle never becomes writable with PeerAddrInfo
04:41 sri hmm
04:41 sri not even if i use Socket::getaddrinfo
04:41 sri suspicious
04:47 basic6 joined #mojo
04:57 good_news_everyon joined #mojo
04:57 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/du9ujQ
04:57 good_news_everyon mojo/net_dns_native 6759391 Sebastian Riedel: use IO::Socket::IP by default
04:57 good_news_everyon left #mojo
04:57 sri can't figure it out yet, gonna commit what i have
04:58 sri maybe one of you wants to give it a try... i'm sooooo close
04:58 ppp left #mojo
04:59 sri localhost is special cased because on many boxes the tests just wouldn't pass otherwise
05:02 jberger jamadam is going to have fun with THAT patch if it goes in
05:03 sri first we have to get it to work!
05:04 * jberger had a long day, will be able to think about it after some rest
05:04 jberger nn
05:05 sri wtf?
05:05 sri perl -MIO::Socket::IP -E 'my ($err, @res) = Socket::getaddrinfo("mojolicio.us", undef); my $handle = IO::Socket::IP->new(PeerAddrInfo => \@res) or die $@; warn $handle->connect, $handle->connected while 1'
05:05 sri someone run that please
05:05 sri i get "Can't assign requested address at -e line 1."
05:05 bpmedley What version of Mojo?  Current or your branch?
05:06 sri bpmedley: what do you mean?
05:06 neyasov joined #mojo
05:06 bpmedley Do you want it ran against your Net::DNS::Native branch?
05:06 sri *it*?
05:06 bpmedley The oneliner you just posted.
05:07 sri the one-liner doesn't use any of those modules
05:07 bpmedley Ok, one sec.
05:07 firnsy i get "1 at -e line 1." ad nauseum
05:07 sri firnsy: that is... odd
05:07 * firnsy can be ... odd
05:07 sri anyone on os x can try it?
05:08 bpmedley That’s what I get.. the ad nauseum thing.
05:08 sri all you need is IO::Socket::IP installed
05:08 bpmedley Can't assign requested address at -e line 1.
05:08 sri :S
05:09 firnsy fwiw, i'm on fedora
05:09 sri that result makes no sense
05:09 sri it's literally what IO::Socket::IP does internally
05:09 sri must be some flag missing or so
05:11 irq joined #mojo
05:12 sri ah!
05:16 neyasov joined #mojo
05:17 sri it appears to expect a service name
05:18 sri *it* being getaddrinfo()
05:18 dotandimet joined #mojo
05:21 sri yea, i don't get it :(
05:28 bpmedley http://klickverbot.at/blog/2012/01/getaddrinfo-edge-case-behavior-on-windows-linux-and-osx/
05:31 franzkafka Hi all, I had a hard time the other day figuring out how to handle some HTML.
05:31 franzkafka I know there is probably a better way to do this, but I was hoping maybe there could be a similar example in the documentation: http://pastie.org/9694650
05:32 franzkafka Thank you for trying bpmedley !
05:32 bpmedley Anytime; I gotta get some sleep, though.
05:35 franzkafka What I am trying to show in my example is how to deal with things like <p><b>Industry</b><br/>Job Title1<br/>Job Title2<br/></p>
05:36 franzkafka And just grabbing things from the DOM that don't seem easy to get to with CSS selectors.
05:36 franzkafka I couldn't find a good example of this in the documentation, and I think as someone new to this stuff it's nice to have good examples in documentation to work from.
05:52 good_news_everyon joined #mojo
05:52 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/SqoQHg
05:52 good_news_everyon mojo/net_dns_native 4eecfcd Sebastian Riedel: fixed getaddrinfo arguments
05:52 good_news_everyon left #mojo
05:52 sri ok, first problem solved :)
05:53 sri now there's just a few tests that need to be fixed
06:03 dod joined #mojo
06:07 good_news_everyon joined #mojo
06:07 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/P-xmFA
06:07 good_news_everyon mojo/net_dns_native 3eebb2e Sebastian Riedel: fixed support for handles
06:07 good_news_everyon left #mojo
06:07 sri all tests pass \o/
06:11 doublelel joined #mojo
06:20 sri oops, forgot one :)
06:21 good_news_everyon joined #mojo
06:21 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/qONVcQ
06:21 good_news_everyon mojo/net_dns_native d5fd199 Sebastian Riedel: fixed IPv6 test
06:21 good_news_everyon left #mojo
06:21 franzkafka sri, do you think it's possible to have a section of the documentation that has examples?
06:21 franzkafka like the one I've given, but obviously not as bad
06:22 sri jberger, tempire, batman, marcus, crab: allright, i guess the branch is ready for review https://github.com/kraih/mojo/compare/net_dns_native
06:22 sri of course reviews from everyone here are more than welcome!
06:22 sri and testing on different platforms!
06:23 sri once the pthreads fix makes it in, non-blocking name resolution might "just work" :o
06:28 Oleg joined #mojo
06:30 Oleg sri: looks like we need to call $DNS->timedout on timeout to prevent leaks (if resolving not done yet)
06:30 marmez joined #mojo
06:31 sri Oleg: oh, that's not so nice, i assumed the handle worked as a guard somehow :/
06:32 Oleg hmm, unfortunetly no
06:33 batman sri: Net::LibAsyncNS is mentioned in IO::Socket::IP. have you looked into that module?
06:33 batman (i'm just curious)
06:35 sri batman: yes, the fact that Leonerd is not even using it himself should be hint enough
06:35 batman ok.
06:35 batman thanks
06:36 dod joined #mojo
06:36 good_news_everyon joined #mojo
06:36 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/XqdIHA
06:36 good_news_everyon mojo/net_dns_native bf157f5 Sebastian Riedel: do not leak threads
06:36 good_news_everyon left #mojo
06:37 sri that should work, is hard to test though
06:37 sri Oleg: i'd prefer something that "just works" :)
06:37 batman sri: so this code should just be "drop in replacement", so no additional tests are required?
06:38 Oleg sri: ok, i'll test this
06:38 batman the only things i could point out is what you just changed: shift->remove(my $handle = delete $self->{dns});
06:39 batman sri: ^
06:39 batman looks nice. i also like the side effect that IO::Socket::IP is a dep now :)
06:40 good_news_everyon joined #mojo
06:40 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/7L-PIg
06:40 good_news_everyon mojo/net_dns_native 536fb2e Sebastian Riedel: use a more appropriate attribute name
06:40 good_news_everyon left #mojo
06:40 sri IO::Socket::IP has come a long way
06:41 batman "To avoid this compile your perl linked with pthreads" # do i have to do anything magical with perlbrew to get pthreads?
06:41 sri and since localhost is a special case that only binds and connects to 127.0.0.1, it should work portably for us
06:41 sri batman: read backlog
06:41 * sri is away for a bit
06:41 Oleg batman: read few lines after this message
06:43 batman ok. guess i won't be testing this then :/
06:44 batman haven't compiled anything since 2006, hehe
06:46 Oleg Ok, I'll check solution by bpmedley, may be it will remove this requirements
06:49 batman i don't get why pthreads is required: "This class uses system native threads and not perl threads. So overhead shouldn't be too big"
06:49 batman i'm sorry if i just don't know what "pthreads" are.
06:50 batman the only threaded programming i've done was two days in 2006 :/
06:50 Oleg pthreads is a POSIX threads library (threads library in POSIX systems)
06:56 good_news_everyon joined #mojo
06:56 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/0ltZ_w
06:56 good_news_everyon mojo/net_dns_native c4b8cb8 Sebastian Riedel: do not leak the watcher either
06:56 good_news_everyon left #mojo
06:57 sri Oleg: the solution seems to work really well, even managed to make UV work for thousands of concurrent getaddrinfo calls
06:57 amon joined #mojo
06:58 sri MOJO_NO_DNS might need a better name btw. ;p
06:58 sri MOJO_NO_NDN maybe, for Net::DNS::Native
07:02 good_news_everyon joined #mojo
07:02 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/NCgBNQ
07:02 good_news_everyon mojo/net_dns_native 60f8229 Sebastian Riedel: renamed MOJO_NO_DNS to MOJO_NO_NDN
07:02 good_news_everyon left #mojo
07:07 batman Oleg: ok. thanks
07:08 fhelmber_ joined #mojo
07:14 neyasov joined #mojo
07:20 basiliscos joined #mojo
07:25 sri Oleg: <nitpick> could you bump your modules to a 1.x version? mentions of 0.x versions in the docs can make less experienced folks uncomfortable</nitpick>
07:26 Oleg sri: ok
07:27 sri especially now that semver is so popular
07:28 sri reminds me that i wanted to learn more about v-strings
07:29 sri DBD::Pg uses the semver format succesfully somehow
07:30 sri Oleg++ # btw.
07:30 sri bpmedley++
07:31 Oleg sri++ ;)
08:09 jamesaxl joined #mojo
08:16 basiliscos1 joined #mojo
08:19 Vandal joined #mojo
08:21 meshl joined #mojo
08:34 trone joined #mojo
08:41 dod joined #mojo
08:48 neyasov joined #mojo
09:13 dp_ joined #mojo
09:15 Lee joined #mojo
09:15 irq joined #mojo
09:20 Shaeto joined #mojo
09:21 mib_pz5mzm joined #mojo
09:41 mib_pz5mzm left #mojo
09:42 sh4 joined #mojo
09:47 rem_lex joined #mojo
09:53 rawler joined #mojo
10:05 dod joined #mojo
10:09 neyasov joined #mojo
10:13 basiliscos joined #mojo
10:30 bpmedley batman: Did you peruse the code here to see the pthreads stuff?   https://metacpan.org/source/OLEG/Net-DNS-Native-0.10/Native.xs
10:36 dvinciguerra joined #mojo
10:37 batman bpmedley: sorry, i don't get the question. i simply tried to do "cpanm Net::DNS::Native"
10:38 bpmedley I see.  I’m not sure the current version on cpan will do what you want.
10:39 bpmedley It seems we need to pass some dynamic linker flags to the OS and https://metacpan.org/source/OLEG/Net-DNS-Native-0.10/lib/Net/DNS/Native.pm#L16 does not do that.
10:40 batman so i need to install it with "cpan" and not "cpanm" ?
10:40 bpmedley https://github.com/kraih/mojo/issues/700  <— The shows some code changes.
10:41 bpmedley If I was going to test right now, I think what needs to be done is a manual install.  You can use cpanm look for this.
10:43 bpmedley The Makefile.PL needs the “unless” piece commented out and the Native.pm needs to use DynaLoader.
10:47 batman bpmedley: works like a charm!
10:48 bpmedley What OS are you on?
10:48 batman i got some warnings though: https://gist.github.com/jhthorsen/52e9cb553845f8f1f0f1
10:49 batman bpmedley: the gist has the details
10:49 batman oh. i forgot to run the tests :P
10:49 neyasov joined #mojo
10:51 batman bpmedley: i added another file for the test output and also attached perl -V output
10:52 batman sorry. i have to run to a meeting now. *bbl*
10:52 bpmedley Ok
10:54 batman let me know if i can provide any more useful information
10:55 bpmedley The Native.pm file you’re using could be helpful.
10:57 d4rkie joined #mojo
11:03 batman bpmedley: same gist. new file added :)
11:05 bpmedley You will need to update line 16 per issue 700.
11:05 dod joined #mojo
11:27 doublelel joined #mojo
11:32 denis_boyun joined #mojo
11:53 Oleg joined #mojo
11:59 fhelmber_ joined #mojo
12:06 Kripton joined #mojo
12:21 lipizzan joined #mojo
12:26 lipizzan joined #mojo
12:30 Kripton joined #mojo
12:38 batman bpmedley: cool! "All tests successful."
12:38 batman perl t/03_pool.t # looks very good after "make install"
12:39 batman thanks :)
12:43 bpmedley np
12:46 Oleg bpmedley: looks like this global flag helps only on Linux. BSD still fails. Interesting how this works on other platforms
12:49 ribasushi Oleg: check your pm please (another flashing tab in the mibbit interface :)
12:54 dvinciguerra joined #mojo
13:17 ignacio_ joined #mojo
13:25 Shaeto joined #mojo
13:37 Ptolemarch joined #mojo
13:46 neilhwatson joined #mojo
14:01 nicomen I want to read from a socket, and everytime there is data I want to print it, how would I do such a "while" loop with Mojo::IOLoop?
14:04 hernan604 is there a recommended way to stream files with mojolicious ?
14:04 hernan604 i want to stream music / videos
14:18 basiliscos joined #mojo
14:23 sri Oleg: too bad, but having it work with all linux perls is pretty good though
14:23 arthas joined #mojo
14:24 sri linux, os x and windows should be the huge majority of all users
14:26 KCL_ joined #mojo
14:28 good_news_everyon joined #mojo
14:28 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/1vYPWQ
14:28 good_news_everyon mojo/net_dns_native 2a127c4 Sebastian Riedel: run tests with Net::DNS::Native
14:28 good_news_everyon left #mojo
14:28 basiliscos1 joined #mojo
14:30 good_news_everyon joined #mojo
14:30 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/gfy7Ig
14:30 good_news_everyon mojo/net_dns_native 6db3812 Sebastian Riedel: run tests without Net::DNS::Native
14:30 good_news_everyon left #mojo
14:30 sri Net::DNS::Native doesn't install on travis yet :( https://travis-ci.org/kraih/mojo/builds/39948484
14:35 sri jberger, tempire, batman, marcus, crab: you've not reviewed yet!!!1
14:36 sri and everyone else... we need reviews! https://github.com/kraih/mojo/compare/net_dns_native
14:38 Oleg sorry, still busy a little. Will release and may be review today. Btw bpmedley's code didn't help on BSD
14:41 batman sri: not sure what else i can say, then what i said earlier.
14:42 batman i can't see any big changes after the leakage commit...
14:52 dvinciguerra joined #mojo
14:52 sri purl is still missing :S
14:56 hernan604 aha
14:56 hernan604 jberger: i used your example https://gist.github.com/jberger/5224c5c09ee56eeaa99e
14:57 hernan604 really nice, thanks
14:57 hernan604 however it does not work on firefox
14:57 hernan604 because of firefox defaults... but works on chrome
14:58 hernan604 but it doesnt detects any of my music, so i had to create a fake array of tracks
14:58 hernan604 but in the end the POC worked, much thanks +)
15:02 doby sri: reviewed the net_dns_native diff.  it looks very natural and straight forward and the fact most tests just lost an environment variable check is an excellent sign
15:07 sri one thing to consider about the patch, it is pretty much impossible to test, so we have to decide how much technical debt non-blocking name resolution is worth for us
15:08 sri and there's the fact that we have a hard dependency on anything before Perl 5.20.0
15:08 meshl joined #mojo
15:09 * sri tends towards +1, but would like to share the blame with others if things go wrong ;p
15:12 bwf joined #mojo
15:12 hoppie joined #mojo
15:13 hoppie sri: testing mojo-net_dns_native ... during make test got this warning: t/mojolicious/app.t ........................ 1/? Use of uninitialized value $this in pattern match (m//) at t/mojolicious/app.t line 186, <DATA> line 109.
15:16 hoppie Is there anything special needed to enable the use of Net::Native::DNS.  I installed Net::Native::DNS manually (changed line 16).
15:17 hoppie have great news all -- thanks for the hard work.  It's passing all 191 urls (should only have 5 errors, no more).
15:17 hoppie wow
15:18 hoppie perl mojou < urls_191 > out; egrep -c "::" out;    <-- note without MCE; this would fail previously.
15:19 odc :)
15:21 basiliscos joined #mojo
15:25 hoppie the pastie URL for mojou is here: http://pastie.org/9689667
15:28 hernan604 what is that hoppie ?
15:28 hernan604 mojou ?
15:28 hernan604 exampel of mojo nonblocking ua ?
15:31 hoppie last week came across a presentation on the web http://www.openfusion.net/talks/pwp/.  Mojo is not mentioned there. Therefore, attempted to try Mojolicious out. Am going to provide the author of the presentation 2 examples using Mojo.
15:32 kmx joined #mojo
15:33 nmac joined #mojo
15:34 hoppie http://pastie.org/9689667 for the non-MCE and http://pastie.org/9694330 with MCE (the latter will need 1.520 though, release day tomorrow).
15:37 dod joined #mojo
15:38 hoppie Actually, will post various examples in gist by tomorrow. lwp, lwp_mce, anyevent, anyevent_mce and mojo, mojo_mce. I'm very new to Mojo and the reason I joined this IRC. The mojo example was failing and could not understand why. Folks here have explained why, btw.
15:42 hoppie herman604: yes, is an example of mojo nonblocking ua
15:45 Ptolemarch joined #mojo
15:49 sri batman: i interpret your earlier comments as a +1 then
15:49 batman yes, that is correct
15:49 batman or +2. you decide ;)
15:50 sri sure, +2 means twice the blame :)
15:58 hoppie sri: does this mean you guys have come up with a solution for issue 700.
16:00 Oleg sri: you didn't use pool option in the constructor, do you think creating thread for each request is good enough? I didn't measure how fast creating of new thread is, so didn't know is it ok or not
16:01 hoppie Oleg, yea, not good. +1 to use pool
16:02 hoppie about 100 threads per 1 ~ 2 seconds
16:02 agregory joined #mojo
16:04 hoppie imagine an app polling hundreds of thousands (although using IP addresses), but for apps out there using fqdn.
16:05 hoppie example, telecom companies polling cable boxes to ensure well being, etc..
16:05 hoppie some companies have over 20 million devices
16:08 doublelel joined #mojo
16:09 hoppie cannot imagine Mojo creating 20 million threads (100 threads per second) overhead = seems expensive
16:12 neilhwatson joined #mojo
16:14 sri Oleg: what would be a good default? (pool => 5, extra_thread => 1)?
16:22 Oleg sri: good question. Yes, I think this will be good as start point
16:22 dvinciguerra joined #mojo
16:24 good_news_everyon joined #mojo
16:24 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/cZQZBA
16:24 good_news_everyon mojo/net_dns_native 8b542f0 Sebastian Riedel: start with 5 threads
16:24 good_news_everyon left #mojo
16:25 Oleg i already thought about dynamic pool, but still not sure is it needed
16:26 * sri shrugs
16:28 sri whole patch is only 14 new lines btw. (to put the technical debt into numbers)
16:31 * sri would like a vote from jberger
16:38 sri ohoh https://metacpan.org/release/KOSTYA/MojoX-Mysql-0.03
16:39 sri this is a real antipattern imo https://metacpan.org/source/KOSTYA/MojoX-Mysql-0.03/Mojolicious/Plugin/Mysql.pm#L20
16:39 sri <3 transaction scope guards
16:41 sri hope MojoX::Mysql doesn't get confused with Mojo::mysql too much
16:44 nicomen so is it MojoX:: or Mojolicious::Plugin ?
16:44 sri both, which is quite unfortunate
16:44 kablamo joined #mojo
16:45 sri Mojolicious::Plugin::Mysql has the potential to distract people from Mojo::mysql
16:45 nicomen but didn't you actually decide a path to use at some point?
16:45 sri what do you mean?
16:45 nicomen I thought there was a decision to move away from MojoX at some point
16:46 doublelel joined #mojo
16:46 sri yes, there was, and it didn't work very well, so we've decided not to pick a namespace
16:47 nicomen oh
16:47 nicomen so I can't yell at people then :-((
16:47 punter joined #mojo
16:48 sri the MojoX namespace is not used often though
16:48 sri so that's good
16:48 sri we do not encourage it, and nobody from the inner circle would use it (i hope!)
16:48 stephanj nicomen: you could still point out that they fall out of the "usual way"
16:49 sri rule of thumb is still that MojoX contains mostly legacy code
16:49 nicomen ok
16:49 nicomen If metacpan doesn't fail me miserably, it's 63 vs 300
16:50 nicomen in favour of M::P
16:50 stephanj have fun then? ;)
16:56 disputin joined #mojo
17:07 rawler joined #mojo
17:14 Ptolemarch joined #mojo
17:19 hoppie joined #mojo
17:21 hoppie sri: The mojo-net_dns_native branch is failing for the script utilizing MCE (all 191 reported connection errors). Passing though with version 5.57.   Tested the recent mojo-net_dns_native branch.
17:23 hoppie mojo-net_dns_native is passing for the mojou script.  not sure why it would fail though running utilizing many child processes.
17:25 hoppie if helpful, will test without the pool => 5 change
17:27 kablamo joined #mojo
17:30 hoppie 191 :: Connect timeout errors
17:31 hoppie trying next (without pool => 5)
17:34 sri hoppie: confirmed
17:35 hoppie without the "pool => 5" is passing.  Thinking whether apps out there (forking) separate process may fail.
17:35 hoppie ok
17:35 sri looks like Net::DNS::Native doesn't survive a fork
17:35 sri or rather the pool
17:36 hoppie I changed the line back to  Net::DNS::Native->new : undef;     and that is working.
17:36 hoppie forking or not
17:36 Ptolemarch joined #mojo
17:36 sri that stuff can also be easily tested with a one-liner
17:36 sri perl -Ilib -Mojo -E 'say g("mojolicio.us")->dom->at("title")->text; a(sub { $_->render(text => $_->ua->get("mojolicio.us")->res->dom->at("title")->text) })->start' prefork
17:37 hoppie ok
17:37 good_news_everyon joined #mojo
17:37 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/-bB4KQ
17:37 good_news_everyon mojo/net_dns_native 9a43a9b Sebastian Riedel: the thread pool does not survive a fork
17:37 good_news_everyon left #mojo
17:38 kablamo joined #mojo
17:38 sri now i'm scared
17:39 hoppie ?
17:39 sri hopefully active threads don't screw up fork() calls for modules like Mojo::IOLoop::ForkCall
17:41 hoppie hmm.
17:42 hoppie do not know enough about Mojo and ForkCall, unfortunately.
17:42 basiliscos joined #mojo
17:44 Oleg threads and fork sounds incompatible
17:44 sri that would be unfortunate for us
17:45 hoppie :(
17:45 hoppie $$
17:45 Oleg Can we create pool after fork?
17:45 sri nope, we don't know when a fork will happen
17:45 hoppie capture $$ process id.
17:45 kablamo joined #mojo
17:46 sri there are modules like Mojo::IOLoop::ForkCall
17:46 sri so at any time the event loop is running, and threads are active there might be a fork()
17:49 hoppie I will try something and load Mojo::IOLoop inside MCE's user_begin block:  eval 'use Mojo::IOLoop';  this will work for MCE though. will put back pool => 5.
17:49 kablamo joined #mojo
17:51 hoppie yes, working.
17:51 Oleg there is mechanism to call handler before and after fork: pthread_atfork()  This looks like a way to handle fork
17:52 hoppie cool, not sure if Mojo::IOLoop::ForkCall has pre/after handlers as well.
17:54 hoppie seems so close
17:55 sri yea, just resetting the Net::DNS::Native instance after fork does not help at all
17:56 hoppie maybe not many Mojo::IOLoop::ForkCalls. I got it. :(  Hmm.
17:56 sri this was the idea i tried https://gist.github.com/anonymous/0617eda395b430195f55
17:56 denis_boyun joined #mojo
17:57 sri this needs to be handled in Net::DNS::Native
17:58 Oleg i think so. Good article http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them
17:59 good_news_everyon joined #mojo
17:59 good_news_everyon [mojo] kraih pushed 1 new commit to net_dns_native: http://git.io/OlYskw
17:59 good_news_everyon mojo/net_dns_native 29666a4 Sebastian Riedel: use a thread pool again to make testing easier
17:59 good_news_everyon left #mojo
17:59 sri allright, that means the net_dns_native branch is off the table for now :(
18:01 Oleg sad, but true
18:01 Oleg maybe i'll found solution in a few days
18:01 sri i was so happy the IO::Socket::IP stuff got cleaned up too
18:02 hoppie just tried the mce script to use threads instead of fork, and got a pleasant surprise:  EV does not work with ithreads.
18:04 hoppie going back to see where one disables ev (no_ev).  just testing stuff, never ran Mojo using threads
18:05 hoppie normally would not use threads for pollers, but testing anyhow
18:08 kablamo joined #mojo
18:09 irq joined #mojo
18:10 hoppie http://mojolicio.us/perldoc/Mojolicious/Guides/FAQ#What-does-the-error-EV-does-not-work-with-ithreads-mean
18:10 hoppie thanks
18:13 hoppie running with threads is ok ( pool => 5 ) and BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll'; }
18:14 hoppie Poll
18:17 good_news_everyon joined #mojo
18:17 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/lA8AAw
18:17 good_news_everyon mojo/master df0d57f Sebastian Riedel: all tests should work fine with IO::Socket::IP
18:17 good_news_everyon left #mojo
18:25 dod joined #mojo
18:31 hoppie joined #mojo
18:32 hoppie left #mojo
18:33 hoppie joined #mojo
18:35 Ptolemarch joined #mojo
18:50 rawler joined #mojo
18:53 hernan604 jberger: the reason it didnt work for me was i has not installed: AudioFile::Info::MP3::Info
18:53 hernan604 now all works >>
18:54 vytas_ joined #mojo
19:03 meshl joined #mojo
19:13 dotandimet joined #mojo
19:27 hoppie joined #mojo
19:29 brainbug joined #mojo
19:29 brainbug Are dynamic actions possible in Mojolicious?
19:30 brainbug And is there an example of how to do it?
19:31 woz joined #mojo
19:47 dotandimet brainbug: what do you mean by dynamic actions?
19:48 woz joined #mojo
19:49 hernan604 dynamic ? you mean like using libraries outside your code?
19:49 hernan604 mojolicious is just a perl app
19:49 hernan604 you can do anything a perl app can
19:50 brainbug No, I mean this get('/')-to('
19:50 brainbug bleh
19:50 dotandimet I gave my lightning talk at the rails conference today. https://speakerdeck.com/dotandimet/mojolicious-perl-framework-for-the-real-time-web-lightning-talk
19:51 brainbug One controller/action for slash (/) if authenticated, and a different controller/action if not.
19:51 sri dotandimet: how did it go?
19:51 dotandimet brainbug: that's called bridges
19:52 sri dotandimet: fun fact, the term bridge is not used in the docs anymore
19:52 sri it's all ->under now
19:52 brainbug I searched for bridges and found nothing.
19:53 sri http://mojolicio.us/perldoc/Mojolicious/Lite#Under
19:53 brainbug sri, OK so that's why I'm not finding anything on bridges. Some documentation for a plugin used bridges, but I could find nothing in the documentation on them.
19:54 sri dotandimet: found a typo on one of the slides s/IO::Socket::INET6/IO::Socket::IP/
19:55 dotandimet sri: I missed out on most of the conference putting together slides. My talk was near the end, and I had to leave soon after, so didn't get much feedback :( - the crowd said they could make out the code when I showed the big piece from the web site, and there was appreciation when I showed the failraptor.
19:55 dotandimet brainbug: It's called under now, in the Routing Guide
19:57 dotandimet sri: That's a slide I lifted from Tempire's presentation, so it's probably out of date (YAPC 2012).
19:59 dotandimet I had the correct list of optional deps in one draft (from the FAQ), but working in Powerpoint made me sad, so I used someone else's homework.
20:00 dotandimet Powerpoint is great for presenting, not so great for making presentations.
20:03 dotandimet sri: Also I think one could talk for 20 minutes about the 2nd example from the mojolicio.us front page :)
20:05 sri that's my plan for mojoconf 2015 :D
20:05 hoppie joined #mojo
20:06 sri what goes on behind the scenes in that one example
20:09 franzkafka I got it! Thank you, thank you, thank you dotandimet and sri!
20:10 franzkafka bleh, no I didn't
20:10 franzkafka haha
20:12 franzkafka dotandimet, what did people at the Ruby Conf think of Mojolicious?
20:15 franzkafka With regards to the 2nd example from the front page, why does it have use experimental 'signatures';? I don't see signatures used anywhere in the code.
20:16 dotandimet franzkafka: didn't get to talk to them, so I don't know :(. My pal the organizer said he talked to his guests about it, and that Steve Klabnik knew of Mojolicious (he's got a Perl camel tattoo).
20:17 dotandimet franzkafka: look at the anon subs - they both are sub($c) { ... }, not sub { my ($c) = shift; ... }
20:17 franzkafka dotandimet, thank you for pointing it out, I was still looking for it :D
20:18 dotandimet I worried about those 2 extra lines in the example, but after just fiddling with this example, I think I'm sold on signatures :)
20:20 disputin joined #mojo
20:20 sri dotandimet: without signatures it's the same number of lines ;)
20:22 sri signatures++ # after the first two signatures it's less code
20:26 dotandimet sri: right, but we're so used to the ugly unpacking of args it barely registers, while the use experimental line looks scary.
20:26 dotandimet Yep.
20:28 davido_laptop joined #mojo
20:31 franzkafka So, under doesn't really seem to work for what I am trying to do: http://pastie.org/9696288
20:32 bowtie joined #mojo
20:32 franzkafka If $r->get('/')->to('guest#index'); is above the under block, then it will always go to guest#index, if below, the page never loads.
20:33 hernan604 franzkafka: you need to use under
20:33 hernan604 http://paste.scsys.co.uk/438002
20:33 hernan604 like that
20:33 franzkafka Am I not using it correctly?
20:34 hernan604 creno
20:34 hernan604 no
20:34 hernan604 i mean
20:34 hernan604 i think you are :)
20:34 hernan604 partiaally
20:35 hernan604 see my example
20:36 franzkafka Alright, I am looking at the example. I guess bridge is deprecated, so I will use this as the basis for an under.
20:37 hernan604 s/bridge/under/
20:43 franzkafka Hm, is there any way to debug 'Firefox can't establish a connection to the server at domain.net:3000.' ? I.e., page is not loading, though morbo is running.
20:43 franzkafka I have ConsoleLogger, but I am not getting anything. Maybe a debug env var or something I can set?
20:44 franzkafka Oy vey, I get stuck on the smallest things :)
20:45 hernan604 netstat -an | grep 3000
20:45 hernan604 check there is any LISTEN on that port
20:47 franzkafka yeah, there is
20:47 franzkafka The problem is not on the server-side, but something with my code that is stalling morbo
20:49 franzkafka http://paste.scsys.co.uk/438008
20:49 franzkafka yeah, well now at least I am getting the error: 'The connection to the server was reset while the page was loading.'
20:49 franzkafka still nothing on the console (morbo)
20:51 dotandimet ttp://www.slideshare.net/dotandimet/mojolicious-41121847 - full powerpoint now also on slideshare, because I had notes.
20:51 dotandimet franzkafka: and if $test = 1?
20:51 rawler joined #mojo
20:52 franzkafka yeah, if $test = 1 then I get member#index, it works
20:52 franzkafka if it is 0 then it never loads and I get the error  'The connection to the server was reset while the page was loading.'
20:52 franzkafka CentOS 7 if that matters
20:57 dotandimet It's a logic problem,  I think, not a problem in the setup.
20:57 dotandimet There's also #under docs in the lite tutorial: http://mojolicio.us/perldoc/Mojolicious/Lite#Under
20:57 hernan604 try wget
20:58 hernan604 just return 1 and see
20:58 bowtie joined #mojo
20:59 hernan604 also you aree doing $r->get
21:00 franzkafka does $r become undef after the under?
21:00 franzkafka No data received on a wget
21:01 hernan604 http://paste.scsys.co.uk/438010
21:01 hernan604 franzkafka: maybe you broke it completely
21:01 hernan604 remove everything and do it again
21:01 hernan604 >)
21:01 dotandimet Here's a big example of under in jberger's Galileo: https://github.com/jberger/Galileo/blob/master/lib/Galileo.pm#L203
21:02 ua joined #mojo
21:02 hernan604 franzkafka: im seeing your codfe....
21:02 dotandimet If the user isn't authorized, the under sub calls his auth_fail() helper, which sends a redirect.
21:03 hernan604 under what? under that sub ?
21:03 franzkafka the problem is in the fact that I am trying to use the same route
21:03 franzkafka '/' in different ways (sorry, didn't mean to hit enter).
21:03 dotandimet So I see under rendering a template or redirecting, but not calling another route (or falling through)
21:04 franzkafka I can do a redirect_to or a render, but the route is something I cannot figure out.
21:05 dotandimet franzkafka: does it make sense for the same route to have 2 different actions?
21:06 dotandimet one action that renders different templates depending on a condition probably makes more sense.
21:06 franzkafka dotandimet, I'm not entirely sure, but what I do know is that www.linkedin.com/ shows up as a home page with login if not authenticated, and a dashboard if you are.
21:06 dotandimet don't need to mess with under for this
21:06 franzkafka dotandimet, That is what I am trying to accomplish. A login page if not authenticated, a dashboard if you are.
21:07 franzkafka So, if you go to www.mydomain.com/ and you're logged in, you get a dashboard. If you're not logged in, you get a login page.
21:07 franzkafka Maybe I am going about this wrong. I don't want it to redirect to www.mydomain.com/login if not authenticated...
21:08 dotandimet franzkafka: the benefit of under() is that it applies the test to the routes beneath it.
21:08 franzkafka I'm just going to use a redirect_to I think, and have a different route. It's not a big deal, was just trying to figure out if it was possible, and I'm beginning to think that it isn't.
21:09 dotandimet You can get what you want without redirect, just render 2 different templates depending on whether the user is authenticated.
21:09 franzkafka dotandimet, yeah, I am using under incorrectly. I believe it would be something like under '/foo' and then it would apply to '/foo/bar'
21:10 franzkafka dotandimet, I want two different actions depending. I had two templates and that did work, so I think I will just go back to that.
21:10 ashimema joined #mojo
21:10 franzkafka I can have all my logic in the templates rather than the action.
21:11 franzkafka Yeah, that works perfectly for me actually, and then I can have a route with a call back.
21:12 franzkafka Something like this: http://paste.scsys.co.uk/438014 (not tested)
21:12 franzkafka woops, s/redirect_to/render in that paste
21:15 franzkafka Yeah, that works, and it works awesomely. I guess no different actions based on state, but I can render differently based on state.
21:21 marty joined #mojo
21:24 dvinciguerra joined #mojo
21:40 * sri thinks he might reopen his t-shirt for a bit
21:42 franzkafka sri, t-shirt?
21:42 franzkafka i.e., a mojolicious t-shirt?
21:42 sri s/t-shirt/t-shirt store/
21:42 Mikey i'll get one if you do
21:43 sri could bring back the raptor shirt with a new limited edition too
21:45 sri spreadshirt.com still the best?
21:47 franzkafka sri, I would buy a t-shirt
21:47 disputin joined #mojo
21:48 disputin joined #mojo
21:50 nicomen dotandimet: I made a talk about Test::Mojo in five minutes the other day using slides.com
21:56 dotandimet nicomen - looks nice. I made slides for a couple of talks using some mishmash of markdown and reveal.js served by a mojolicious app, and I never got around to posting them online, which bugged me.
21:56 dotandimet http://slides.com/nicomen/frontend-testing-now#/1
21:58 dotandimet but fiddling with a mojolicious app and imprecise rendering beats select text - open font style - change color - change font size - remove bullets ...
22:02 woz joined #mojo
22:06 bowtie joined #mojo
22:06 nicomen heh, I bet, I just was surprised over the simplicity, which is good, takes away the focus of BIGGER FONTS and useless stuff ;)
22:09 ashimema joined #mojo
22:11 Ptolemarch joined #mojo
22:19 sri anyone experience with zazzle?
22:34 bowtie joined #mojo
22:51 sri us shop has a few t-shirts now :) http://kraih.spreadshirt.com/
22:53 sri think i'll stick with spreadshirt, the flock print is awesome
22:57 sri spreadshirt has cooler stuff in europe, like eastpak bags
23:08 sri eu shop should have soe stuff soon too
23:09 sri no clue when i'll close the shops again, so hurry up ;p
23:40 bowtie joined #mojo
23:44 Vytas_ joined #mojo
23:44 jberger I bought one of each of the front-facing shirts
23:45 jberger happy birthday to me!
23:45 jberger \o/
23:55 sri it's your birthday?
23:56 sri pretty much the only thing i use facebook for these days is to keep track of birthdays :o
23:57 * sri just made pirate mugs

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