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

IRC log for #mojo, 2014-12-30

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

All times shown according to UTC.

Time Nick Message
00:01 Grinnz_ that would be the easiest way at the moment
00:02 linagee (Aside from helping the effort to hack up the way IO::Socket::SSL is used and/or IO::Socket::SSL itself...)
00:03 linagee ModSecurity does seem pretty awesome though. :)
00:19 good_news_everyon joined #mojo
00:19 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/38fRrw
00:19 good_news_everyon mojo/master b736b64 Sebastian Riedel: parse URLs a little faster
00:19 good_news_everyon left #mojo
00:22 * tempire had forgotten about twitter
00:26 d4rkie joined #mojo
00:41 d4rkie joined #mojo
00:49 davido_ joined #mojo
00:58 ceej__ joined #mojo
01:01 marty joined #mojo
01:05 good_news_everyon joined #mojo
01:05 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/OpoWuw
01:05 good_news_everyon mojo/master cb97c26 Sebastian Riedel: fixed a few more Mojo::URL bugs
01:05 good_news_everyon left #mojo
01:11 espent joined #mojo
01:37 jonquest joined #mojo
02:03 marmez joined #mojo
02:12 good_news_everyon joined #mojo
02:12 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/LSAKxA
02:12 good_news_everyon mojo/master 4cd0088 Sebastian Riedel: use a simpler Mojo::URL example
02:12 good_news_everyon left #mojo
02:38 sri hahaha
02:38 Ptolemarch joined #mojo
02:38 sri and we have confirmation http://www.cpantesters.org/cpan/report/146c643c-8f0a-11e4-b9e9-1ef263ffe912
02:38 sri i bet that one previously resulted in Sub::Util errors
02:50 buu_ joined #mojo
02:52 klapperl_ joined #mojo
03:12 Grinnz oh boy
03:34 Ptolemarch joined #mojo
03:36 Eke- joined #mojo
03:40 d4rkie joined #mojo
03:45 noganex joined #mojo
03:48 gnephiak joined #mojo
03:48 inokenty-w joined #mojo
05:05 jberger wow
05:08 jberger sri: did you add that to the bug report?
05:08 good_news_everyon joined #mojo
05:08 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/IAGuwg
05:08 good_news_everyon mojo/master 5420cdb Sebastian Riedel: more consistent return values in Mojo::DOM
05:08 good_news_everyon left #mojo
05:15 jberger sri: I added it to the rt bug report and pinged leonerd
05:17 sri jberger++
05:20 hshong joined #mojo
05:29 d4rkie joined #mojo
05:58 sattellite joined #mojo
06:05 d4rkie joined #mojo
06:09 gnephiak joined #mojo
06:36 mib_dyt89y joined #mojo
06:37 mib_dyt89y what is the best practice about developing SPA web application using Mojolicious framework?
06:38 Snelius spa?
06:38 purl spa is doing a good job against piracy I think.  They seem to be gaining momentum or Single Page Application or at http://www.spa-info.be/
06:38 Snelius oh
06:39 mib_dyt89y Yes
06:40 mib_dyt89y :(
06:40 Grinnz mib_dyt89y, well, your single page is easy enough but for your ajax calls you may want a full controller setup
06:41 Grinnz other than that, you'll need a more specific question to get a specific answer ;)
06:43 rem_lex joined #mojo
06:45 mib_dyt89y My app front client is dojo toolkit, and using dojo/request to connect controller of Mojolicious.  The routes is useless?
06:47 Grinnz it's calling a Mojolicious controller directly? then yeah you don't need a route, the route is only to get to the controller
06:47 Grinnz i'm not familiar with dojo
06:48 Grinnz routes are a translation of URL to controller, with setting stash values and such
06:49 mib_dyt89y thnaks
06:49 mib_dyt89y thanks
07:25 Vandal joined #mojo
07:33 Eke- joined #mojo
07:52 trone joined #mojo
07:59 absolut_todd joined #mojo
08:04 d4rkie joined #mojo
08:07 ashimema joined #mojo
08:11 marmez joined #mojo
08:18 eseyman joined #mojo
09:01 sugar joined #mojo
09:19 sugar_ joined #mojo
09:21 alnewkirk joined #mojo
10:01 denis_boyun joined #mojo
10:16 neyasov_ joined #mojo
10:28 basiliscos joined #mojo
10:34 amon joined #mojo
10:38 * tempire giggles
10:39 marmez joined #mojo
11:17 neyasov_ joined #mojo
12:18 neyasov_ joined #mojo
12:18 Grinnz_ joined #mojo
12:27 fhelmberger joined #mojo
13:19 rem_lex|pivo joined #mojo
13:19 neyasov_ joined #mojo
13:32 d4rkie joined #mojo
13:32 neyasov_ joined #mojo
14:05 ignacio_ joined #mojo
14:27 d4rkie joined #mojo
14:31 D4RK-PH0ENiX joined #mojo
14:42 Eddy joined #mojo
14:45 marty joined #mojo
15:16 asarch joined #mojo
15:22 sh4 joined #mojo
15:46 Grinnz someone suggested i write a Mojo::Reactor::POE, would it be crazier to do that or to port POE::Wheel::Run to Mojo::IOLoop :)
15:46 Grinnz either seems a bit beyond my depth for the moment
15:53 Ptolemarch joined #mojo
15:57 neilhwatson joined #mojo
16:00 jberger Grinnz: why port POE::Wheel::Run to Mojo::IOLoop?
16:00 jberger what does it provide that ForkCall or ReadWriteFork does not
16:00 jberger I thought that the problem that you were having is that you already were using POE?
16:00 jberger maybe I'm mis-remembering
16:01 sh4 joined #mojo
16:01 Grinnz_ jberger: callbacks on stdout and stderr, and separate callbacks for sigchild and closed filehandles
16:02 Grinnz_ (the latter i don't personally need, but others may)
16:02 jberger Grinnz_: sounds like a lot of work to port, I would rather see a POE reactor personally
16:03 Grinnz_ jberger: indeed... but i'm wary of whether POE will even work that way
16:04 Grinnz_ the problem i was having that i'm already using POE, and porting is a non-option unless this functionality exists outside POE ;)
16:04 sri or just fix the ev backend for poe
16:05 sri https://metacpan.org/pod/POE::Loop::EV
16:07 Grinnz_ honestly i just think it would be really cool if Mojo::IOLoop had a module like that
16:07 jberger Grinnz_: that's the reactor
16:07 Grinnz_ but none of these things sound like things i could do without a lot of diving :P
16:08 jberger implementing a reactor is (conceptually) not that hard
16:08 Grinnz_ jberger: i mean, a module like POE::Wheel::Run
16:08 jnbek joined #mojo
16:09 * sri agrees
16:09 jberger Grinnz_: I don't know enough about it to know, my only thought would be to attempt to extend one of the existing modules (via PR) before attempting to port the entire thing
16:09 jberger but, it you want to do it, be my guest
16:10 jberger ForkCall was just a port of AnyEvent::Util::fork_call() after all
16:10 jberger though it has diverged somewhat at this point
16:11 sri we need something better than Mojo::IOLoop::ReadWriteFork
16:12 sh4 joined #mojo
16:12 sri problem is there are only very few people who can get it right
16:12 sri in the entire community
16:12 sri you really need to know about event loops and portability
16:13 Grinnz_ and they all have their own systems probably :)
16:13 jberger FC was hard enough and it keeps it as lean as possible, trying to provide all the hooks would be even tougher
16:14 sri of course the /proc stuff in ReadWriteFork is "special"
16:14 sri that just shouldn't happen
16:14 jberger sri: I told batman that, but he seems to think it is important for some part of the application that he created it for
16:15 jberger I think that just means it isn't sufficiently genericized
16:15 neyasov_ joined #mojo
16:17 jberger I was thinking about trying to add two-way communication to FC via additional pipes, just as a thought
16:17 jberger it would be extremely tough handling the multi-fork problems though
16:17 sri realistically, nobody is going to write a proper module for Mojo::IOLoop, it would take me at least a month of solid research to get portability bits right... so better stick with POE and hook that into mojolicious
16:18 jberger agreed, for something as complex as this, POE is battle-tested
16:18 jberger anything new would need probably years to catch up
16:18 genio initdb -A md5 -E 'UTF-8' -Upostgres -W
16:18 genio ahh. damnit
16:19 sri (of course if you're looking for an excuse to send me barrels of money... ;p)
16:19 * preaction pictures Edgar Allen in hoplite armor
16:19 preaction Battle tested Poe!
16:20 sri http://lauragrb.com/wp-content/plugins/easy-contact/edgar-allan-poe-meme-513.jpg
16:20 Grinnz_ :)
16:21 jberger sri: rather than send you barrels of money, he might just: http://www.raymondibrahim.com/_admin/wp-content/uploads/2014/10/im-going-to-make-him-an-offer-he-cant-refuse.jpg
16:31 Ptolemarch joined #mojo
16:42 davido_ joined #mojo
16:55 yuni joined #mojo
17:16 neyasov_ joined #mojo
17:19 Nemix__ is the string DOOM! in NAME section intentional: http://mojolicio.us/perldoc/Mojo/Server/Morbo
17:20 sri http://cdn.meme.am/instances/250x250/54334727.jpg
17:21 sri or... to be more precise http://scienceblogs.com/startswithabang/files/2011/11/DOOM.jpg
17:25 * Grinnz_ needs to spend some time with netflix and its 10 seasons of futurama
17:26 Nemix__ sri:  got it...thanks
17:26 dod joined #mojo
17:36 dod joined #mojo
17:58 disputin joined #mojo
18:00 sri hmmm
18:00 sri Mojo::Pg could actually decode JSON automatically
18:05 fhelmberger joined #mojo
18:05 sri and possibly encode too
18:10 sri $db->with_json->query('select...', {foo => 'bar'})->with_json->hashes->first->{baz}{yada}
18:11 * sri shrugs
18:16 disputin joined #mojo
18:17 neyasov_ joined #mojo
18:17 tempire The with_json works. Consistent with the dollar_only
18:17 tempire I feel like auto-decoding is inevitable
18:23 sri the real problem is encoding
18:23 sri decoding is really easy, i just check the types of the returned rows and filter
18:24 sri but for encoding all i can do is maybe filter hashrefs passed to ->query
18:26 sri but that might clash with future DBD::Pg features
18:29 sri basically, for proper preprocessing of placeholder values i'd need new methods :S
18:30 sri $db->with('foo')->with_json(['bar', 23])->query('insert into foo values (?, ?)')
18:31 sri similar to ->dollar_only, prepare stuff for the next ->query() call
18:33 tempire I presume the with_json parameters would insert in the first json/jsonb field?
18:33 sri we don't know the field type
18:33 denis_boyun joined #mojo
18:33 sri it inserts in the second placeholder
18:34 tempire oh, with('foo') is the value for the first placeholder?
18:34 sri yes
18:34 stephan48 how is the current state of Mojo & POE? did i read the backlog correctly that POEs EV Implementation is currently buggy?
18:35 sri stephan48: unmaintained since 2008
18:35 stephan48 okey good
18:35 stephan48 or rather not good
18:37 sri oh well, i'd really like to bring nice json support to Mojo::Pg and am open for ideas
18:38 sri Mojo::Pg::Results can totally have an automatic json decode flag
18:38 sri ->query()->json->hashes is no problem
18:38 sri just the encoding part is complicated
18:39 sri ->query('...', [...]) is already special, since DBD::Pg automatically serializes postgres arrays
18:40 tempire ->with(text => "thing", json => {...}, int => 4), where text and int wouldn't really matter. But it would allow for future pre-formatting.
18:40 sri ->data(['just an array'], 'some text')->json_data(['actual json array'])->query('...') is totally possible
18:41 sri tempire: such verbose
19:11 firnsy joined #mojo
19:18 neyasov_ joined #mojo
19:32 jzawodn joined #mojo
19:34 genio SOAP is the worst thing ever created.  so much overhead
19:34 Grinnz_ a lot of bad things have been created, don't sell humanity short
19:40 firnsy joined #mojo
19:45 denis_boyun joined #mojo
19:50 denis_boyun_ joined #mojo
19:53 Ptolemarch joined #mojo
19:56 sri $db->values('foo', 'bar')->json_values({foo => 'bar'})->query('insert into foo values (?, ?)')
19:57 sri hmm, different names don't really make it better
20:00 dotandimet joined #mojo
20:01 skittles joined #mojo
20:03 skittles joined #mojo
20:08 Eke- joined #mojo
20:20 neyasov_ joined #mojo
20:23 firnsy joined #mojo
20:34 davido_ joined #mojo
20:34 dparry joined #mojo
20:36 dparry hi, I've seen the question asked online but no answer seemingly given, so what's the best/easiest way to prettify JSON output with mojo?
20:40 Grinnz_ use a different JSON encoder
20:41 tencendur joined #mojo
20:41 dparry ok, thanks Grinnz_
20:42 Grinnz_ use JSON::MaybeXS; $c->render(text => JSON->pretty->encode($stuff))
20:42 Grinnz_ oh you'll also want format => 'json'
20:43 dparry gotcha, thanks!
20:45 Grinnz_ sorry JSON->new->pretty->encode(...)
20:46 Grinnz_ if you want to apply it permanently to the whole project you can write a module similar to this (the source is very simple): https://metacpan.org/pod/Mojo::JSON::MaybeXS and add pretty => 1 to the constructor
20:47 Grinnz_ (but pretty printed JSON, nice for debugging, bad for bandwidth :)
20:49 Ptolemarch joined #mojo
21:14 denis_boyun joined #mojo
21:18 denis_boyun_ joined #mojo
21:23 neyasov_ joined #mojo
21:35 sri i guess Mojo::Pg::Results could also have a ->no_json method or so, to disable decoding
21:37 sri still doesn't help with the encoding problem :S
21:41 davido_ joined #mojo
21:48 punter joined #mojo
22:24 Ptolemarch joined #mojo
22:24 neyasov_ joined #mojo
22:33 disputin joined #mojo
22:34 espent joined #mojo
22:42 sri $db->with('foo', 'bar')->json({baz => 'yada'})->with('Z')->query('...?, ?, ?, ?...')
22:42 sri $db->values('foo', 'bar')->json({baz => 'yada'})->values('Z')->query('...?, ?, ?, ?...')
22:43 sri think that would work ok-ish with defaulting to always decoding json in results
22:44 sri $db->val('foo', 'bar')->json({baz => 'yada'})->val('Z')->query('...?, ?, ?, ?...')
22:45 sri $db->json({baz => 'yada'})->query('...?...')->hashes->first->{foo}{bar}[23]
22:59 mib_fedr6a joined #mojo
23:03 marmez joined #mojo
23:07 tencendur joined #mojo
23:17 * tempire back to fixtures defined in perl
23:23 dparry joined #mojo
23:24 Nemix__ I just posted an email seeking input on my first mojolicious program.  Feel free to give me feedback here if that is easier
23:25 sri to make sure it doesn't get lost, here's a partial Mojo::Pg JSON patch https://gist.github.com/anonymous/7409f3d24ae26208d533
23:25 neyasov_ joined #mojo
23:31 sugar__ joined #mojo
23:44 sri am i the only one who likes this json roundtrip example? https://gist.github.com/anonymous/7409f3d24ae26208d533#file-json-diff-L148
23:46 sri i guess another possible syntax would be $db->custom('select ?::json as foo')->json({bar => 'baz'})->run->hash
23:46 sri ->custom() returning a some query builder object
23:47 Grinnz_ i was thinking about how to make a render call return from the controller action automatically and i think i finally realize what those people were talking about regarding lisp call_cc or whatever
23:48 sri https://gist.github.com/kraih/6602913
23:49 Grinnz_ haha, yeah something like that could do it
23:49 sri that's how other perl frameworks do it
23:49 Grinnz_ cool
23:51 sri i better comment with the downside
23:51 Grinnz_ of course there's a downside :)
23:52 Grinnz_ i was wondering in general, what happens if render does get called twice, just both things get rendered in sequence?
23:52 Grinnz_ or does one override, or?
23:53 panzana` joined #mojo
23:53 Grinnz_ not something i plan to do but ive had things like that happen by accident... which is why i'm thinking about this :P
23:54 Grinnz_ ah, nonblocking of course
23:54 sri dammit... i want Mojo::Pg to feel more like Mojo::DOM

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