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

IRC log for #mojo, 2016-06-06

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

All times shown according to UTC.

Time Nick Message
01:10 aborazmeh joined #mojo
01:18 bpmedley https://cal.events <-- What everyone is waiting for.. a calendar service that still in its infancy.. :-P
02:38 noganex_ joined #mojo
02:45 lluad joined #mojo
04:23 cpan_mojo Mojo-UserAgent-CookieJar-ChromeMacOS-0.01 by FAYLAND https://metacpan.org/release/FAYLAND/Mojo-UserAgent-CookieJar-ChromeMacOS-0.01
04:28 inokenty-w joined #mojo
05:31 kes joined #mojo
06:37 McA joined #mojo
07:13 Vandal joined #mojo
07:14 andrew_ joined #mojo
07:26 Lee joined #mojo
07:33 trone_ joined #mojo
07:39 bpmedley http://www.tiobe.com/tiobe_index <-- Perl is #8.. :)
07:42 coolo objective-c got a big hit - aren't iphone apps that?
07:43 bpmedley coolo: Isn't Swift replacing objective-c in the ios app market?
07:44 coolo if it did, it didn't take the -2.64% objective-c lost
07:45 coolo but I have no idea about ios at all, so my info is old :)
08:14 che-quest joined #mojo
08:16 cosimo joined #mojo
08:25 osfabibisi joined #mojo
08:42 punter joined #mojo
10:02 McA2 joined #mojo
10:07 meshl joined #mojo
10:23 kaare joined #mojo
10:54 dvinciguerra joined #mojo
10:55 Kripton joined #mojo
11:15 tchaves joined #mojo
11:37 lluad joined #mojo
11:49 cpan_mojo Mojo-YR-0.05 by MRAMBERG https://metacpan.org/release/MRAMBERG/Mojo-YR-0.05
11:57 * sri yawns
12:06 cpan_mojo Mojo-YR-0.06 by MRAMBERG https://metacpan.org/release/MRAMBERG/Mojo-YR-0.06
12:22 jberger I stumbled onto my trailing callback helper the other day, I still wonder if it is worth foisting upon the world somehow
12:22 jberger sub cb { (ref $_[-1] || '') eq 'CODE' ? pop : undef }
12:23 jberger then in a possibly non-blocking sub you can just do:
12:23 perlpilot joined #mojo
12:23 jberger sub my_method { my $cb = &cb; my ($self, @args) = @_; ... }
12:36 anparker ref on undef should return an empty string. `|| ''` part probably isn't needed.
12:39 * anparker hates writing methods that can be both blocking and non-blocking
12:41 sri what would you do instead?
12:44 batman sri: just write it non-blocking ;)
12:44 anparker go with only one option, if it's possible
12:44 batman blocking is for the old, haha
12:45 * jberger waves to batman
12:45 sri that would make Mojo::UserAgent suck
12:45 sri and Mojo::Pg
12:45 * batman waves back
12:46 batman sri: indeed it would.
12:46 anparker it would. but it doesn't make implementing such approach less annoying.
12:49 batman i often start out with non-blocking for my web server and then i have to go back and do it over when i need to just write a script :)
12:49 batman but for cpan stuff i write the Mojo:: things both ways, while the Mojolicious::Plugin:: stuff (often) just one way
12:50 sri the difference between blocking and non-blocking in Mojo::UserAgent is these few lines https://github.com/kraih/mojo/blob/master/lib/Mojo/UserAgent.pm#L51-L60
12:50 CW joined #mojo
12:52 anparker sri: it's ok, if you don't need to do anything with response. just return it ether blocking or not.
12:53 anparker but if you need to pre-process it. where to put code for that?
12:53 sri ?
12:53 anparker so it won't repeat twice
12:53 batman anparker: pre-processing stuff are almost always blocking
12:53 batman so you just call a method before you "dispatch" to (non-) blocking
12:53 sri i don't understand the question
12:55 anparker post-process than
12:56 anparker you received responce (non-)blocking. do somethenig with it and return to user
12:56 sri how is that a problem?
12:58 anparker if it's non-blocking you'll receive responce in a callback. if it's not, as direct return from sub
12:58 anparker where to put code for post-processing?
12:59 sri i think you're misunderstanding something
12:59 ramortegui joined #mojo
12:59 anparker maybe
12:59 sri if you're building an api around Mojo::UserAgent you can whatever you want to
13:00 jberger anparker: normally I abstract the postprocessing in a separate function and call it from both the blocking and nonblocking code branches
13:00 jberger its the best you can do
13:00 anparker if I use Mojo::UserAgent yes. I ment, if I implementing API
13:00 sri or attach a finish event to the transaction
13:01 jberger sri: yes in that case that's true
13:03 gizmomathboy joined #mojo
13:04 sri both, Mojo::UserAgent and Mojo::Pg have hooks for post-processing stuff, i really don't see the problem
13:04 sri in many different ways
13:05 sri the transaction/results apis are also post-processing
13:05 sri $ua->get(...)->res->json
13:06 sri $pg->db->query(...)->hashes->first
13:06 anparker and if I need non-blocking?
13:07 sri you need to be more specific
13:11 anparker return $ua->get(...)->res->json and $ua->get(... => sub { $user_cb->(shift->res->json) })
13:11 anparker now you need to wrap that in one method
13:12 anparker I don't have specific problem. Just try to voice my arguments why both at the some time are troublesome
13:29 jberger anparker: in those cases I just have an "if ($cb) { ... } else { ... }" and I try to keep them as tight as possible
13:37 sri oh, i thought there was a problem to solve, i have no time for arguing
13:39 anparker heh, sorry about it
13:40 jberger anparker: general non-blocking patterns are a bit of a pain and it takes some time to get used to them
13:40 jberger but because of the way continuation passing works there isn't a great way to avoid having to handle both cases
13:40 jberger that said, once you get comfortable with it, it isn't very hard, just a little extra code here and there
13:45 rgrinberg joined #mojo
13:47 ramortegui left #mojo
14:06 zz_Foxcool joined #mojo
14:06 Bean joined #mojo
14:46 icjs joined #mojo
14:57 zivester joined #mojo
15:10 mcsnolte joined #mojo
15:17 Grinnz_ Future avoids handling both cases, but not so much for the Mojo::UA case specifically where blocking and non-blocking use different event loops
15:18 sri no it doesn't, Future is flow control for the non-blocking case
15:18 sri that the blocking Mojo::UserAgent api uses an event loop internally is an implementation detail
15:18 Grinnz_ it can be run blocking, just not when the event loop is already running
15:19 sri don't make promises sound like magic
15:19 sri that annoys me so much
15:20 sri "continuation style apis are blocking, because you can call Mojo::IOLoop->start/stop yourself!"
15:21 sri +passing
15:22 sri that's what i hear
15:24 disputin joined #mojo
15:34 user_936 joined #mojo
15:34 GabrielVieira joined #mojo
15:35 user_936 my $tx = $self->ua->post('http://somesite.com/');
15:35 user_936 $tx->req->json doesn't exist in that case, right?
15:35 user_936 only $tx->res->body
15:35 user_936 because they site does reply with json, but $tx->req->json is not initialized.
15:36 bpmedley user_936: are the response headers set correctly?
15:36 bpmedley Also, are you mixing req and res?
15:37 user_936 i usually only use $tx->req->json for restful service, but i tried if that does hold any data.
15:37 Grinnz_ user_936: req is the request, not the response
15:38 user_936 I see, does $tx->res->json exist?
15:38 Grinnz_ both exist, but will return undef if the message is not json
15:42 user_936 ok nice, it works now :)
15:42 user_936 i just need to be careful with "print" and use instead $self->app->log->debug.
15:42 PryMar56 joined #mojo
15:43 user_936 i had it right before, but it did not print, while other trivial stuff is printed with "print"
15:44 Grinnz_ right, STDOUT is not reliable for logging between different deployment modes
15:54 odc joined #mojo
15:58 user_936 $ua->connect_timeout(5);
15:58 user_936 does this include ns resolving?
15:59 bpmedley user_936: also, app->dumper is very useful
16:59 rgrinberg joined #mojo
17:22 sri talking about promises
17:23 sri Grinnz/jberger: what happened to the async/await thingy we were talking about a few months back?
17:23 sri did leonerd give up again?
17:23 Grinnz_ I don't think LeoNerd has done anything more with it since
17:23 sri too bad
17:25 dod joined #mojo
17:47 GabrielVieira joined #mojo
17:54 mpapec joined #mojo
18:25 disputin joined #mojo
18:28 gizmomathboy joined #mojo
18:43 simcop2387 left #mojo
18:55 orev joined #mojo
19:14 jnbek joined #mojo
19:35 orev joined #mojo
19:52 orev in a config file loaded using Mojolicious::Plugin::Config, can I reference other configs within the same config file?  like: x = 1,  y = $x+1
19:52 sri it's just perl
19:53 orev yeah, but it looks like a big hash, and I'm loading the hash at the time it's being read, and also wouldn't know the name of the variable it's being saved in?  or am I not seeing something right
19:54 sri it's a perl script returning a hashref
19:55 orev ok, still being as terse as the docs and not helpful here.  I don't see how I can reference other hash elements from within a hash while that same hash is being constructed
19:56 orev { x => 1, y => $????->x+1 }
19:56 bpmedley orev: most of us just use config with just one hash
19:56 orev er, no, { x => 1, y => $??? + 1 }
19:57 orev yeah, but I'd like to do something like define a domain name, then have other config elements that use that domain variable instead of having to duplicate them all over
19:58 orev maybe I make that domain var outside of the { } as a regular my scalar
19:58 sri there is no need to be rude
19:58 sri i'm just trying to help
19:59 sri or rather, was trying to help
20:03 orev sri: thanks, I appreciate it.  sometimes terse answers can be too terse
20:04 rgrinberg joined #mojo
20:52 cfedde orev: at the risk of sounding rude. Maybe making a small example script that demonstrates the problem would be helpful.  It's hard to see the code through the dialog.
20:56 inokenty joined #mojo
21:02 bpmedley https://gist.github.com/brianmed/358911826baa2451ec84a4991a05a84a <-- orev: maybe something like this?
21:06 orev bpmedley: thanks.  I suppose it would work but adds more complication than just duplicating the data
21:32 disputin joined #mojo
21:34 dvinciguerra joined #mojo
21:39 Adura joined #mojo
21:50 rgrinberg joined #mojo
22:47 bpmedley orev: I'd would need an example for further discussion and clarification..
22:48 Grinnz_ sri: https://html.spec.whatwg.org/entities.json apparently exists now, might be usable for the entities generation, also apparently they added the entities without semicolons back ~_~
22:49 genio I don't like that last part
22:50 Grinnz_ not sure why 'codepoints' is an array, do some entities expand to multiple codepoints?
22:50 Grinnz_ oh, found some
22:51 Grinnz_ "&NotSquareSubset;": { "codepoints": [8847, 824], "characters": "\u228F\u0338" },
23:02 sri wait, does that mean we have to make entity handling slow again? :S
23:03 sri been quite some time since the change actually https://github.com/kraih/mojo/commit/27a61f7a0e91e20b0cc70caf07059922e93d25a9
23:05 Grinnz_ it still says "The name must be one that is terminated by a U+003B SEMICOLON character (;)." in the section above
23:07 Grinnz_ and at multiple points saying such a construct would be a parse error
23:08 jberger I wonder if anyone is going to YAPC::NA this year that wants to give a mojo blurb  sri
23:08 jberger https://www.reddit.com/r/perl/comments/4mu86b/call_for_velociraptors_represent_your_perl5/
23:08 sri doubt i'll be there
23:08 jberger Stupid phone, sorry didn't mean to highlight you
23:09 jberger It did that trying to paste the link
23:09 jberger :s
23:09 sri your phone likes me
23:11 sri guess we'll not do anything about entities until the situation is clear
23:11 Grinnz_ i can't find an absolute declaration of this but at the least I think the \w could be changed to [a-zA-Z0-9]
23:12 Grinnz_ it just says that for "ambiguous ampersands"
23:18 Grinnz_ the only reference I can find to parsing entities without the semicolon is the part starting with "If the character reference was consumed as part of an attribute..." section in https://html.spec.whatwg.org/multipage/syntax.html#character-reference-state
23:19 Grinnz_ and that is a very scary paragraph
23:22 Grinnz_ https://github.com/whatwg/html/issues/324 looks like the entities were omitted by mistake :s
23:24 jberger https://goo.gl/photos/MpfpB39gRBV1iyPD9
23:25 jberger \o/
23:28 good_news_everyon joined #mojo
23:28 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vokq5
23:28 good_news_everyon mojo/master e31dfdb Sebastian Riedel: semicolons are optional again
23:28 good_news_everyon left #mojo
23:33 disputin joined #mojo

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