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

IRC log for #mojo, 2014-12-10

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

All times shown according to UTC.

Time Nick Message
00:29 marty joined #mojo
00:48 oetiker joined #mojo
00:48 neyasov___ joined #mojo
00:57 bobkare joined #mojo
01:08 zackiv31 joined #mojo
01:19 tbushell joined #mojo
01:20 tbushell left #mojo
01:20 Snelius_ joined #mojo
01:34 mattastrophe_ joined #mojo
01:37 marty joined #mojo
01:48 zacts joined #mojo
02:13 mst Grinnz_: yeah, making them a github pages site is for later
02:13 mst Grinnz_: SCS uses markdown so that's easy
02:14 Grinnz cool
02:25 asarch joined #mojo
02:38 marty joined #mojo
02:57 * sri wonders if Mojo::DOM::first/last methods would be confusing
02:57 sri (because of Mojo::Colection::first/last)
02:58 sri as a faster alternative to $dom->contents->first
02:59 sri hmmm... guess it might
03:13 noganex_ joined #mojo
03:38 marty joined #mojo
03:39 akhasanov joined #mojo
03:41 woz joined #mojo
04:05 Eke- joined #mojo
04:27 akhasanov joined #mojo
04:34 bpmedley_ joined #mojo
04:39 marty joined #mojo
05:27 denis_boyun joined #mojo
05:33 denis_boyun_ joined #mojo
05:40 marty joined #mojo
05:49 good_news_everyon joined #mojo
05:49 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/CAXDQg
05:49 good_news_everyon mojo/master bd8bb40 Sebastian Riedel: filter nodes earlier
05:49 good_news_everyon left #mojo
05:50 davido_lt joined #mojo
05:55 denis_boyun joined #mojo
06:16 rem_lex|pivo joined #mojo
06:19 KCL_ joined #mojo
06:24 Eke- joined #mojo
06:37 ver joined #mojo
06:40 woz joined #mojo
06:41 marty joined #mojo
06:58 denis_boyun joined #mojo
06:59 dod joined #mojo
07:00 denis_boyun_ joined #mojo
07:08 Eke- joined #mojo
07:12 denis_boyun joined #mojo
07:21 marty joined #mojo
07:30 McA joined #mojo
07:54 wim joined #mojo
08:12 sugar joined #mojo
08:21 fhelmberger joined #mojo
08:23 odc joined #mojo
08:23 sugar_ joined #mojo
08:29 woz joined #mojo
08:33 sugar__ joined #mojo
08:36 eseyman joined #mojo
08:38 Vandal joined #mojo
08:48 trone joined #mojo
08:50 wim joined #mojo
09:04 basiliscos joined #mojo
09:12 woz joined #mojo
09:27 irq joined #mojo
09:47 davido___ joined #mojo
10:16 Ralesk Anyone ever used Mojo::UserAgent in a GUI app? (like... Gtk something something)
10:36 neyasov___ joined #mojo
11:32 mattastrophe_ joined #mojo
11:35 ver joined #mojo
11:43 Ralesk uh, I guess I'd need to run EV and Glib::EV to pair the glib and mojo loops together...
11:44 Ralesk and Glib::EV is really really really bloody slow on Win32
11:44 trone joined #mojo
11:47 alnewkirk joined #mojo
12:08 neilhwatson joined #mojo
12:13 eseyman joined #mojo
12:15 jkramer Wasn't there a shortcut for routes that do nothing but render a template? Like get '/foo' => { template => 'foo' }; or something like that?
12:21 cosimo joined #mojo
12:22 jkramer get '/foo' => 'foo'; seems to work
12:37 * Ralesk wonders if writing a Reactor module for Glib would help with running Mojo::IOLoop under Glib?
12:37 Ralesk (really no idea)
12:56 xtetsuji joined #mojo
13:25 jberger Ralesk: do you have a link to Glib loop handy?
13:28 ignacio_ joined #mojo
13:28 Ralesk like... its documentation or so?
13:28 jberger yeah
13:29 Ralesk https://developer.gnome.org/glib/2.28/glib-The-Main-Event-Loop.html
13:29 Ralesk or man Glib::MainLoop if you have perl-Glib installed
13:29 punter joined #mojo
13:30 Ralesk I saw in the mean time that eg. IO::Async has a IO:A::Loop::Glib module, which seems kinda similar to Mojo's Reactor submodules
13:30 Ralesk so I can take some inspiration from there
13:32 Ralesk or... since we also use AnyEvent (but not EV) currently, I guess I could do the same for AnyEvent or AE, if my idea isn't entirely nonsensical in the first place
13:35 jberger I would be interested to see a glib reactor module, not that I need it, but I'm sure it would be useful
13:36 Ralesk I guess -- though I'm fairly sure I'm a fringe use case here :D
13:36 jberger But it's an event loop written in c that isn't written by a mad man
13:37 Ralesk like... Mojo(licious) is meant as a web thingy, serving dynamic web pages and other generated content, not necessarily to be embedded into something entirely different :D
13:37 jberger Ralesk: mojo components can absolutely be embedded in other applications
13:37 Ralesk I know
13:37 jkramer left #mojo
13:38 jberger I like to talk about the mojo toolkit
13:40 neyasov___ joined #mojo
13:44 akhasanov joined #mojo
13:46 amon joined #mojo
13:54 Ralesk "isn't written by a mad man" -- now I wonder who you meant :D
13:57 asarch joined #mojo
14:29 tbushell_ joined #mojo
14:32 tbushell_ joined #mojo
14:32 tbushell left #mojo
14:43 jberger https://metacpan.org/pod/EV
14:43 Ralesk jberger: https://gist.github.com/ralesk/6ee91ab98e936fd7cdd9 this is my vague idea on how it should be (haven't tested it yet actually, but thought I'd share in case I'm doing something dead wrong. IO stuff hasn't been touched yet
14:43 tencendur joined #mojo
14:44 Ralesk that was my guess, yes :D
14:44 jojo joined #mojo
14:45 Grinnz who else :P
14:45 jberger Ralesk: I won't have time to review that today
14:45 jberger perhaps sometime else does
14:46 Grinnz https://metacpan.org/source/MLEHMANN/AnyEvent-6.13/lib/AnyEvent.pm#L1396 all that really needs to be said...
14:46 jberger But keep it up
14:48 Ralesk I kinda like AnyEvent, but yes, the guy is quite uh... yeah. :D
14:49 Ralesk jberger: okay :) I totally hope someone else will speak up too, anyway
14:55 marty joined #mojo
14:58 marty_ joined #mojo
15:20 akhasanov joined #mojo
15:51 Ralesk updated the gist, not quite getting the new method in M:R::EV to be honest...
15:52 Ralesk (certainly doesn't appear to work in my small mockup program :P)
15:56 sh4 joined #mojo
16:03 Ralesk or debug just tells me it'd loaded Mojo::Reactor::Poll :/ hrmmm
16:03 zackiv31 joined #mojo
16:12 jojo Hey, is it possible to use Mojolicious to handle requests that do blocking IO ?
16:13 Grinnz_ sure, why not... you'll want to increase the timeout though probably, and have a lot of workers...
16:14 Eke- joined #mojo
16:14 jojo I'd love to use Mojo::UserAgent but some modules I need use LWP, so I'm stuck with blocking IO
16:15 jojo thanks Grinnz_
16:16 jberger jojo: you can non-block where possible of course
16:16 jberger it just might not be worth the hassle
16:17 jberger depending on the use-case
16:18 mst jberger: adventplanet look better to you now?
16:19 * jberger looks
16:19 jberger nice
16:20 Ralesk woot, it gets loaded and runs, just throws some glib errors :D
16:21 * jberger eagerly awaits today's entry
16:21 irq where do I define an action to be performed upon each request?
16:29 jberger mst: I need your "died of vague" please
16:29 mst http://trout.me.uk/caption.jpg
16:29 jberger mst: thanks
16:30 * jberger notes for future reference
16:30 Ralesk :D
16:31 Ralesk a few hours of coding later, Mojo::Reactor::Glib works together with Mojo::UserAgent \o/
16:33 good_news_everyon joined #mojo
16:33 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/D4JpGg
16:33 good_news_everyon mojo/master 011436d Sebastian Riedel: more consistent Mojo::DOM examples
16:33 good_news_everyon left #mojo
16:42 sri hmm, this Net::DNS::Native problem is not good https://groups.google.com/d/msg/mojolicious/lGNpgW4cfow/oHokgkd059UJ
16:53 good_news_everyon joined #mojo
16:53 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/lIVW_A
16:53 good_news_everyon mojo/master 51cb302 Sebastian Riedel: updated Net::DNS::Native requirement to 0.13 for some important bug fixes
16:53 good_news_everyon left #mojo
16:53 Grinnz_ sri: the delay helper is awesome :)
16:53 sri :)
16:57 Ralesk sri: got any comment for Mojo::Reactor::Glib? :)
17:01 mst hey, I'm the expert on glib comments in here!
17:02 RJReed67 joined #mojo
17:07 Ralesk mst: well that works too :3
17:10 mst Ralesk: that was a bad pun, sorry
17:10 Ralesk ah, right :)
17:10 Ralesk that's a fairly rare word
17:29 sri i guess that puts Net::DNS::Native support back on the chopping block :(
17:30 sri random segfaults after Net::DNS::Native passed its tests during installation is pretty much a worst case
17:31 sri jberger, tempire, batman, marcusr, crab: can haz opinionz?
17:33 RJReed67 Does anyone have a link to some sample code that does a useragent post with parameters?
17:34 mst sri: I sort of wonder if it should be 'user turns it on'
17:34 mst sri: maybe it could be a plugin somehow?
17:34 mst that way people who need the last erg of performance can take the risk while it shakes out
17:35 sri i don't see a nice way to make that happen
17:35 s1037989_ joined #mojo
17:50 ceej__ joined #mojo
17:51 dod joined #mojo
18:03 Grinnz_ is there a way i can do something like POE::Wheel::Run non-blocking command execution with a Mojo::IOLoop delay?
18:10 Grinnz_ also, is there a way to pass arguments to the callback called by Mojo::IOLoop->timer?
18:12 bwf joined #mojo
18:19 tempire lulz
18:20 tempire If it can't be turned on, I don't see another option other than chopping.
18:20 tempire I suppose a warning that it requires version x
18:24 Eke- joined #mojo
18:28 tempire Grinnz: closure
18:28 tempire just watch out for vars going out of scope
18:29 Grinnz_ yeah i'm doing that... but passing args would be nicer
18:39 neilhwatson joined #mojo
18:41 Oleg joined #mojo
18:42 Grinnz_ do any of the other event loops have some like POE::Wheel::Run? or any sort of code execution with IO callbacks?
18:42 Oleg sri, don't worry we'll fix all the problems :)
18:42 Grinnz_ i really don't want to figure out how to run POE in this lol
18:43 neilhwatson joined #mojo
18:43 mst Grinnz_: if you're using the EV reactor, IO::Async's EV backend should co-operate just fine
18:44 Grinnz_ hmm..  i'm not but i was planning to, ill look into that
18:47 neilhwatson joined #mojo
18:47 jberger sri: just make MOJO_NO_NDN default to false unless it is set to true explicitly
18:48 jberger $ENV{MOJO_NO_NDN} //= 1; above line 10
18:49 jberger then if the bug is fixed we remove the line
18:50 skiehn joined #mojo
19:01 Grinnz_ mst: IO::Async::Process looks like exactly what i was looking for, thanks
19:03 Grinnz_ well, at least, it should do for this case...
19:05 jberger Grinnz_: Mojo::IOLoop::ForkCall is my module for that
19:06 jberger it pirates most of the logic from AnyEvent::Utils::fork_call()
19:06 Grinnz_ that could work too
19:06 jberger it pirates a small amount of logic from POE::Wheel::Run
19:06 jberger the only thing that it doesn't do is have a fork queue as fork_call does
19:07 jberger another alternative is batman's Mojo::IOLoop::ReadWriteFork
19:07 sri Oleg: allright :)
19:07 jberger as the name might imply, that module lets you communicate with the forked child bidirectionally
19:07 Grinnz_ the only thing i'm missing from POE::Wheel::Run is the callbacks on stdout and stderr... but i don't need those for this particular case
19:07 * sri stops worrying
19:08 jberger ForkCall (and fork_call) only sends the result upon completion
19:08 Grinnz_ that's sufficient for my current task
19:08 Grinnz_ right now i just need the completion callback
19:08 jberger Grinnz_: the I recommend mine
19:09 jberger then
19:09 jberger Grinnz_: you are not on windows I assume?
19:09 Grinnz_ nope :)
19:09 jberger conceptually, ForkCall should work on windows (fork emulation) but due to a perl bug it does not
19:10 * jberger is still offering a $100 reward for fixing https://rt.perl.org/Public/Bug/Display.html?id=120767
19:10 Grinnz_ heh
19:10 Grinnz_ this does look nice, thanks
19:11 Grinnz_ jberger: does that include fixing the strangely oversized fonts on that page?
19:11 jberger I just noticed that
19:12 lars joined #mojo
19:12 jberger I really don't care for RT myself, but I don't get to make that call for other people's bugtracker
19:14 mst I hate everything else I've used more
19:15 Grinnz_ github's issue trackers are nice IMO
19:15 Grinnz_ that requires a github repo, of course
19:24 akhasanov joined #mojo
19:26 basiliscos1 joined #mojo
19:26 mst github's issue trackers are nice if you don't want any actual features or pages that load
19:27 mst the number of times I have to sit poundig Ctrl-R because some bit of their overly clever javascript has shat the bed is ridiculous
19:27 Grinnz_ strange, this computer is horribad at JS and i've never had a problem on github
19:27 Grinnz_ when i try to shop on newegg though...
19:28 * sri has been using github issues prety heavily for years are rarely encounters problems
19:29 mst it's entirely possible it just hates me
19:29 sri oh my, over 6 years now :o
19:30 mst I occasionally consider using github issues for open source stuff; I wouldn't consider it featureful enough to use in-house
19:30 Grinnz_ if (username === 'mst') { blow_up(); }
19:30 Grinnz_ sure, for open source web stuff though, its decent
19:31 Grinnz_ and everything has a github integration, heh
19:32 Oleg Hmm, still didn't get response from Scott. If he'll come here redirect him to bugtracker, now I need to logout
19:34 * Grinnz_ is thinking: $app->helper(delay_fork_call => ...)
19:35 sri jberger: if we disable it by default i don't think we should support it at all
19:35 sri jberger: it has no real tests
19:36 jberger eh, if there is just a minor bug that Oleg thinks he can fix, just make sure no one trips on it until then
19:36 jberger but that's just my $0.03 (inflation)
19:36 sri i would insist on real tests if we disable it
19:37 sri if you want to step up, sure
19:38 jberger versus remove, you mean
19:38 sri yes
19:39 sri if it can't be fixed soon, i think we have to a) remove it for now, or b) add real tests and disable it by default
19:39 mst I think "let people play with an experimental feature via opt-in because that's the only way to properly soak test it" is a good argument for tested + disabled by default
19:39 jberger I'm going to argue against tests of course
19:39 sri of course b depends on a volunteer writing tests
19:39 sri (i'm not going to volunteer, since i know how hard it is ;p)
19:40 jberger can it not just try to resolve something?
19:40 sri we need to be installable offline
19:40 jberger I know I'm asking a silly question because you wouldn't say its hard otherwise
19:40 jberger there are other features that are only tested conditionally based on environment
19:41 jberger given that we cannot predict what someone's crazy resolv.conf is doing, I think we would have to use conditional tests anyway
19:43 sri also, removing it for now doesn't mean we can't bring it back once we have more faith in it
19:43 sri especially if only lack of tests gets in the way
19:44 sri i'll give it 2 days, then before the next mojolicious release we'll make a decision
19:49 sri it's a bit unfortunate that all Net::DNS::Native bugs have such severe consequences :S
19:50 sri anyone who wants to send a pull request with tests and MOJO_NO_NDN=1, please don't forget to update the docs too
19:54 irq joined #mojo
20:02 sugar joined #mojo
20:29 disputin joined #mojo
20:39 Grinnz_ i suppose without IO::Socket::SSL, hypnotoad would not be able to accept https connections?
20:45 woz joined #mojo
20:48 sri jberger: of course you need to find a way to verify that the lookup has been performed non-blocking, and not just blocking
20:49 sri so, possibly design a new api
20:54 bwf joined #mojo
21:01 [0xAF] joined #mojo
21:03 Grinnz_ got
21:03 Grinnz_ got IO::Socket::SSL to install after all, the tests were failing with Net::SSLeay 1.49 but passed with an updated version
21:04 Grinnz_ sounds like they should update their required version of Net::SSLeay...
21:05 [0xAF] hi there guys, i'm banging my head on something related to DBIC... I have my custom made ResultSet (for calling sql procedures), i'm trying to access my stash from the ResultSet, where the $self is DBIx::Class::ResultSet object ... is there a way to backtrace from here to mojo objects ?
21:06 basiliscos joined #mojo
21:12 mst [0xAF]: no, and you didn't want to, and your design is wrong
21:12 mst [0xAF]: pass whatever data you need into the resultset object
21:12 mst [0xAF]: remember that ->search creates a new resultset
21:12 mst [0xAF]: so you can use attrs to pass information down
21:13 mst [0xAF]: if the DBIC code even knows that Mojo exists, your design is about to become a ball of mud. avoid.
21:13 [0xAF] mst: yeah, i realized this scenario... but since i have already filled user ID and some other stuff which i can easily use in the ResultSet, i though i can just take them from mojo...
21:13 [0xAF] mst: ok, i got the idea...
21:13 mst er. yeah. you habve you mojo code do
21:13 [0xAF] mst: i will pass whatever is needed to the resultset
21:14 mst $schema->resultset('Foo')->for_user($id)->...
21:14 mst resultset chaining is allowed for your methods too
21:14 mst also, look at DBIx::Class::Schema::RestrictWithObject
21:14 mst and remember #dbix-class exists
21:14 [0xAF] mst: ahh, that's cool... didnt thunk of...
21:15 mst I often have code like
21:15 mst has 'schema';
21:15 mst has 'user_id';
21:15 marty joined #mojo
21:15 mst has 'foo_rs' => sub { $_[0]->schema->resultset('Foo')->for_user_id($_[0]->user_id) };
21:15 mst then my code in a method just does $self->foo_rs->whatever
21:15 [0xAF] mst: sorry, i though my question is more related to mojo than DBIC... but your suggestiong with chaining seems cool...
21:16 mst yeah. that's fine.
21:16 mst the answer only becomes obvious once you realise it -isn't- a mojo question
21:16 mst hence why I answered in here rather than chasing you over there, and then answering :)
21:16 [0xAF] yeah, i stand corrected ;)
21:16 marty joined #mojo
21:17 mst resultset chaining is ridiculously powerful but takes a bit of getting used to
21:17 [0xAF] i will learn more about it... the internet is in front of me ;)
21:17 [0xAF] but yeah, it looks really cool ;)
21:17 mst things like
21:18 mst $rs->search({ user_id => $id })->search_related('some_rel')->all
21:18 mst are just NICE
21:18 mst and you can build those up using your own ResultSet::Foo methods
21:18 muraiki joined #mojo
21:20 [0xAF] mst: i still have to learn a lot of DBIC and Mojo... but your pointers are very appriciated ;)
21:20 mst [0xAF]: if it's any consolation, I invented resultsets by accident so I was the first person to experience the confusion of the learning curve :D
21:21 [0xAF] s/very/much/ (sorry my English is not quite good)
21:21 [0xAF] hehehe :)
21:21 [0xAF] that sounds a bit relaxing, tho ;)
21:23 mst sri and I were still working together on catalyst in those days, we both needed relaxing from time to time to recover from each other :D
21:23 * mst gives up on trying to concentrate and wanders off to the pub
21:23 irq joined #mojo
21:24 [0xAF] hehe ;) i feel a bit ashamed to admint, but i didn't knew you were in catalyst team before ;)... though i dont know who where there ... i know for sri, since i've read that the Mojo is made from one of the catalyst main devs...
21:25 Adura joined #mojo
21:27 [0xAF] in my defense i should say that i know you're on the DBIC main devs side :) at least i'm grateful that you helped me in the past with my learning curve ;)
21:29 [0xAF] mst: so thanks again for the effort on my ignorance, i'm taking my way to the docs ;)
21:33 Grinnz_ jberger: i'm trying to setup a helper akin to ->delay that will call Mojo::IOLoop::ForkCall.. but i'm not sure how to go about setting up exception handling
21:33 disputin joined #mojo
21:33 Grinnz_ i see there's an error event, but i don't think i'd be able to access the controller from there
21:33 disputin1 joined #mojo
21:34 Grinnz_ https://metacpan.org/pod/Mojolicious::Plugin::DefaultHelpers#delay
21:35 Grinnz_ unless, i set the error handler inside the helper
21:36 Grinnz_ as a closure
21:37 Grinnz_ i guess thats what the delay helper does as well
21:38 mattastrophe joined #mojo
21:38 Grinnz_ ah, catch is from Mojo::EventEmitter, so i can actually use the exact same way, lol
21:44 absolut_todd joined #mojo
22:06 [0xAF] left #mojo
22:08 disputin joined #mojo
22:12 sugar_ joined #mojo
22:15 neyasov___ joined #mojo
22:17 akhasanov joined #mojo
22:28 denis_boyun joined #mojo
22:30 Grinnz_ jberger: so, the $err passed to the finish event is populated for errors in the child, but the error event is emitted for errors in the parent?
22:30 Grinnz_ so i need to handle both
22:32 denis_boyun joined #mojo
22:36 denis_boyun joined #mojo
23:28 Grinnz_ sri: on 5.68 now, my websocket test seems to be having an odd issue... ->finish_ok and ->finished_ok succeed, but don't seem to call the 'finish' event in my controller, until it gets called during global destruction (with a different code)
23:32 Grinnz_ http://fpaste.org/158551/18254360/
23:35 sri Grinnz_: timing is not guaranteed, you're welcome to improve it
23:35 Grinnz_ right, thats why i threw the 5 second sleep in there... figured that would be enough :P
23:35 Grinnz_ perhaps not
23:39 sri which reminds me, every now and then i want a Mojo::EventEmitter::emit_once(...)
23:39 sri it would automatically make sure an event can only be emitted once
23:39 sri like finish
23:40 Grinnz_ it doesn't seem to be getting emitted at all though, until global destruction
23:40 sri i'm not talking about your problem at all
23:40 sri no clue what you have to do for better timing
23:40 crab joined #mojo
23:41 sri you prolly have to mess with the WebSocket closing handshake
23:41 Grinnz_ i don't think it's an issue of timing, i put a 60 second sleep in there and still nothing
23:41 sri timing, not time
23:41 sri sleep doesn't change the order of events
23:42 Grinnz_ ah
23:44 oetiker joined #mojo
23:45 woz joined #mojo
23:46 Grinnz_ well, here's one way, i added Mojo::IOLoop->one_tick; at the end, lol
23:49 Grinnz_ i see finish_ok and finished_ok both do that, so i dunno why
23:49 Grinnz_ unless, $self->{finished} is already set
23:52 Grinnz_ thats for the internal finish event i'm guessing
23:56 sri hmm, i guess the result is a bit meh... https://gist.github.com/anonymous/2070c161523bd06812a1
23:58 Grinnz_ well it is a nice idea i think when you don't want dupes
23:58 sri Grinnz_: you'll likely want to look into Mojo::Transaction::WebSocket, and change around when it emots the finish event
23:59 sri s/emots/emits/
23:59 Grinnz_ i will probably take a look, but not today, it's quittin time ;)

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