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

IRC log for #mojo, 2016-01-27

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

All times shown according to UTC.

Time Nick Message
01:11 disputin joined #mojo
01:35 asarch joined #mojo
01:36 binlei joined #mojo
01:39 binlei joined #mojo
02:01 mattp joined #mojo
02:57 binlei joined #mojo
03:00 jberger tempire: why don't you have fancy mojolicious stickers?
03:13 genio just... wow:  https://gist.github.com/maxrice/2776900
03:15 sri \o/ https://gist.github.com/maxrice/2776900#gistcomment-1647356
03:19 sri jberger: i think we mostly know now how we could refactor it, at least with Mojo::Codec
03:19 jberger without delaware .. nice
03:20 jberger and that's where it starts going down hill
03:20 * jberger is currently building out the command infrastructure for his letsencrypt client
03:29 c--_ joined #mojo
03:38 asarch A very good books to learn CSS and Ajax?
03:39 noganex_ joined #mojo
03:40 sri http://www.htmlandcssbook.com/
03:41 binlei joined #mojo
03:41 sri http://javascriptbook.com/
03:57 binlei joined #mojo
03:58 asarch Thank you!
03:58 asarch Thank you very much :-)
04:36 binlei joined #mojo
05:38 inokenty-w joined #mojo
05:56 jacoby_ joined #mojo
06:16 c-- joined #mojo
06:19 dave__ joined #mojo
06:43 sugar joined #mojo
06:59 dod joined #mojo
07:01 McA joined #mojo
07:04 dod joined #mojo
07:10 * sri wonders if we should have a squish validation filter too
07:17 ashimema joined #mojo
07:20 good_news_everyon joined #mojo
07:20 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vzyhz
07:20 good_news_everyon mojo/master 2936ea6 Sebastian Riedel: more links
07:20 good_news_everyon left #mojo
07:50 sri one of these days i want to get profiling data like that for a mojolicious issue :o https://github.com/npm/npm/issues/11283#issuecomment-175246823
07:53 Vandal joined #mojo
08:08 * sri decides to get the netty book to learn more about how they did abstraction
08:09 bowtie_ joined #mojo
08:19 sri interesting stuff
08:20 sri already learned that netty uses a group of event loops, with each running in its own thread
08:20 sri and that they use channels as the lowest layer api, which are pretty much the same as Mojo::IOLoop::Stream
08:21 sri but they have an attribute called pipeline, which basically contains an array of input and output filters
08:22 sri those filters are the protocol handlers
08:22 bd sri: re profiling: http://danluu.com/perf-tracing/
08:25 binlei joined #mojo
08:31 AndrewIsh joined #mojo
08:37 trone joined #mojo
08:38 binlei joined #mojo
08:41 sri hmm, so protocol up/down grades happen by modifications of the pipeline in netty
08:41 sri each of the filters can change the pipeline
08:41 sri even remove itself from it
08:42 sri (it's not really called a filter, but ChannelHandler, but filter describes the behavior better)
08:43 sri so an http filter could replace itself with a websocket filter after an upgrade succeeded
08:49 sri so if ->read is called on the first filter that filter gets to decide what happens next, it can call ->read on any of the following filters on the pipeline if it wants to
08:50 sri that's how they do StartTLS
08:50 sri it's just one of the filters
08:52 sri so, if your http filter sees a "Upgrade: TLS/1.0, HTTP/1.1", it can decide to pass along all data to the StartTLS filter, which then does its thing
08:53 sri or something simpler
08:53 sri you could have a filter in the pipeline that does the MOJO_USERAGENT_DEBUG=1 thing
08:53 coolo sri: why are you awake anyway? :)
08:54 sri coolo: i'm in europe currently, it's breakfast time
08:55 coolo sri: ah, welcome to the continent ;)
08:56 coolo (and it's only breakfast time if your kids don't have to be in school at 8 am :)
08:58 binlei joined #mojo
09:00 binlei joined #mojo
09:02 jamadam joined #mojo
09:15 binlei joined #mojo
09:16 odc joined #mojo
09:17 jamadam hi. has anyone recently seen the warning '(in cleanup) Can't use an undefined value as a symbol reference at lib/Mojo/Asset/File.pm line 45 during global destruction.' ?
09:22 jamadam Since mojo v6.37 I pretty often encounter this but haven't been able to reproduce it with minimal code.
09:23 sri umm... https://github.com/kraih/mojo/blob/v6.37/lib/Mojo/Asset/File.pm#L45
09:25 nic does "symbol reference" refer to ->cleanup in line 42?
09:26 nic jamadam: while you're on the line, is your legacy mojolicious now inactive?
09:27 jamadam oh i'm not working on mojo-legacy long time..
09:28 nic ta
09:28 jamadam sri sorry it was File.pm line 43
09:29 jamadam $self->handle sometimes returns undef
09:31 jamadam sri I'm not so sure but this code seems to reduce the warnings > close $self->handle if $self->handle
09:32 sri sorry, i'm not really participating, still busy with learning netty
09:33 sri just had a quick look and wanted to point out that there was something vert wrong with the error message
09:33 sri s/t/y
09:36 jamadam it's not urgent and it could be my fault so i'm ok if you look into it later
09:37 sri so, in netty TLS is merely one of the filters (usually the first in the pipeline)
09:39 berov joined #mojo
09:48 jamadam joined #mojo
09:50 vanHoesel joined #mojo
10:10 good_news_everyon joined #mojo
10:10 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vzScj
10:10 good_news_everyon mojo/master e1720a6 Sebastian Riedel: add parse_message method to Mojo::Transaction::WebSocket
10:10 good_news_everyon left #mojo
10:10 sri that will also help with the refactoring
10:10 sri and testing obviously
10:11 sri the channel/codec or whatever can just call $tx->parse_message($frame) and leave all the high level stuff as is
10:16 sri back to netty, it's crazy how much they throw at their pipeline
10:16 sri handlers, codecs, compressors...
10:17 sri it's kinda what i wanted from Mojo::Channel :)
10:18 sri bytes go in on one side, transactions come out at the other
10:19 sri i guess you could say netty is middleware for sockets
10:28 sue joined #mojo
10:41 jontaylor joined #mojo
10:42 Shaeto joined #mojo
10:48 sri ok, think i get it now, good book :)
10:49 sri Netty in Action
10:50 sri bottom line is that they have very similar problems to us
10:50 sri and they decided to turn everything into a pipeline/middleware
10:51 jamadam joined #mojo
10:52 sri a few interesing bits (to me), the argument passed to ->read and ->write are arbitrary, and change from filter to filter
10:52 denny joined #mojo
10:53 sri you just need bytes on side, the other side has no requirements
10:53 denny Heyla.  Is there a better way of doing this?  my $base_url = $self->req->url->to_abs->scheme . '://' . $self->req->url->to_abs->host; $base_url .= ':' . $self->req->url->to_abs->port if $self->req->url->to_abs->port;
10:53 sri bytes -> http message -> high level http message -> ...
10:54 sri and the pipeline can change, so after the websocket handshake, they remove all the http steps
10:55 sri regarding http/2, as far as i can see there is nothing special about it
10:55 sri they just hide the details in pipeline steps
10:55 sri abstract http requests come out, and abstract http responses go back in
10:56 nic the pipeline sounds elegant
10:56 sri honestly, it's a mess :)
10:57 sri imo... because the pipeline can change completely at any given time
10:57 pink_mist denny: just use $url_for in your controller?
10:58 pink_mist err $c->url_for
10:58 sri and steps in the pipeline can introspect all the other steps and pick a specific one they want to pass control next
10:59 sri [tls, http, http-compression, websocket]
10:59 nic denny: you could do one call to ->to_abs and drop everything after the first single slash
10:59 sri the http step could find the "Upgrade: TLS" header, and decide to pass control back to the tls step
11:00 denny pink_mist, that returns a Mojo::URL object doesn't it?  It renders as a boolean, not a string, unless I missed something.
11:00 sri now the tls step fails negotiation, and decides to remove itself completely from the pipeline, to optimize performance :)
11:00 denny nic: Hrm, yeah.
11:00 sri that stuff is encouraged in netty
11:01 pink_mist denny: what? no
11:01 pink_mist well I mean, sure, it returns an object, but it renders as the link if you stringify it
11:01 * denny eyes his test code
11:01 denny okay, I'll try again  :)
11:02 sri denny: http://mojolicious.org/perldoc/Mojo/URL#stringify
11:03 denny quoting it didn't work for me, maybe something to do with surrounding code.  I'll try the explicit method - thanks.
11:08 good_news_everyon joined #mojo
11:08 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vzSuH
11:08 good_news_everyon mojo/master 5108bab Sebastian Riedel: a few more examples
11:08 good_news_everyon left #mojo
11:09 sue joined #mojo
11:21 sri jberger: yea, Mojo::Codec is a bad name ;p
11:22 sri guess we'll stick with Mojo::Channel
11:45 binlei joined #mojo
12:31 disputin joined #mojo
12:38 Akron joined #mojo
12:51 punter joined #mojo
13:05 PryMar56 joined #mojo
13:15 mcsnolte joined #mojo
13:24 ajr_ joined #mojo
13:24 binlei joined #mojo
13:36 kaare joined #mojo
13:39 berov joined #mojo
13:46 neilhwatson joined #mojo
13:47 vicash hello. anyone have experience with using Mojo::Pg with hstore ? I am wondering how to write a prepared query. Does passing an array automatically work correctly ?
13:58 sri yes, just works
13:58 jamadam joined #mojo
14:04 vicash sri: so a prepared query call would look like this ? $c->pg->db->query(q{ INSERT INTO mytable(mystore) VALUES(hstore(?))},  {key => value} );
14:05 vicash or do I need to set the dollar only setting to use ? and not be ambiguous in the query ?
14:12 Shaeto left #mojo
14:34 good_news_everyon joined #mojo
14:34 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vz9TK
14:34 good_news_everyon mojo/master 034ece4 Sebastian Riedel: merge client_close and server_close
14:34 good_news_everyon left #mojo
14:39 jberger sri: should that documentation contain "low level method"?
14:43 good_news_everyon joined #mojo
14:43 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vz9LT
14:43 good_news_everyon mojo/master 4ea4b70 Sebastian Riedel: mention low-level status of some methods
14:43 good_news_everyon left #mojo
14:43 orev joined #mojo
14:44 sri not sure that does anything though
14:46 sri there is one tricky spot in the code remaining
14:46 sri https://github.com/kraih/mojo/blob/master/lib/Mojo/Server/Daemon.pm#L236-L241
14:47 sri that $tx->has_subscribers('finish')
14:47 sri it's a performance hack
14:47 sri otherwise we don't really need to interact with the transaction
15:10 jberger how much performance gain is it?
15:13 sri 3-5%
15:13 jamadam joined #mojo
15:13 sri it used to be more when Mojo::IOLoop::Stream was less efficient
15:14 jamadam joined #mojo
15:22 sri hmm, there's actually websocket tests failing without it now :o
15:23 absolut_todd joined #mojo
15:32 vicash sri: in Mojo::Pg can I have a prepared statement with variable parameters ?
15:32 jberger vicash: Mojo::Pg is mostly just a wrapper around DBD::Pg
15:32 jberger unless I'm very mistaken anything you can do with DBD::Pg you can do with Mojo::Pg
15:33 vicash I am having trouble getting hstore to work using prepared statements. INSERT INTO mytable(mystore) VALUES(?::hstore)  doesn't work when providing the argument with either an array ref or a hash ref . i have tried other combinations such as hstore(?) or hstore(ARRAY[?])
15:34 vicash the only one that seems to work is hstore(ARRAY[?,?]) with one pair of key,value
15:34 vicash I looked at the Mojo::Pg::Database code and that supports JSON. DBD::Pg code has no visible support for hstore. THere is a DBD::Pg::hstore but not sure if that is needed
15:36 vicash I guess for now I can dynamically create a prepared statement with the correct number of ?s in it but that doesn't seem right.
15:38 pink_mist "DBD::Pg code has no visible support for hstore." <-- until it does, I don't think you'll have a good experience
15:42 Grinnz vicash, that's what i have to do every day in mysql anyway. welcome to the slog. :P
15:43 * vicash accepts the status quo
15:43 Grinnz my $in_str = join ',', ('?')x@foos; my $query = '... IN ('.$in_str.')'; # basically an idiom in my code at this point
15:44 PopeFelix Oh yeah. I did that quite a bit when I was doing DBI stuff.
15:52 AndrewIsh Hey guys, I'm creating a small proxy and need to pass through all GET parameters, is there a shortcut for getting them (ideally as a & delimited string), or a key/value hash or something?
15:53 AndrewIsh Ah, would this be the recommended way? my $param = $self->req->params->names;
15:57 jamadam sri: I found simple way to reproduce the warnings on Mojo::Asset::File https://gist.github.com/jamadam/b608cf5ad73c190bde03
15:57 Grinnz $self->req->query_params gets you a https://metacpan.org/pod/Mojo::Parameters of just the query string parameters
15:57 jberger AndrewIsh: http://mojolicious.org/perldoc/Mojo/Parameters
15:58 jberger and Grinnz beat me to it, don't assume that there are only query parameters, you might want to consider the case with both query and body parameters
15:59 AndrewIsh jberger: Good point, thanks for the suggestion
15:59 AndrewIsh Grinnz: Thanks very much, exactly what I need! :)
16:01 good_news_everyon joined #mojo
16:01 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vz90U
16:01 good_news_everyon mojo/master 455e66e Sebastian Riedel: trade a little performance for reliability
16:01 good_news_everyon left #mojo
16:01 gtodd joined #mojo
16:01 sri so, it was actually hiding a bug
16:01 sri still pains me a little to let go of performance :S
16:02 jberger we've gotten lots of performance bumps in the years that I've been around
16:02 sri at 1600 rps it's a difference of about 20-40 rps
16:03 jberger 1.9%
16:03 asarch joined #mojo
16:04 gtodd did Mojolicious once upon a time ship with a pod viewing app (like https://github.com/mfontani/Leguminous) or just the plugin?)  ... I thought there was once a Mojolicious::Command::perldoc   ?
16:04 gtodd I must
16:04 gtodd have installed it from somewhere
16:07 jamadam joined #mojo
16:07 sri wondering if there are ways for us to get those 1.9% back
16:07 sri perhaps more Mojo::IOLoop::Stream optimizations
16:07 sri to make the drain event roundtrip smoother
16:08 jberger gtodd: you can get most of the way there with a one-liner
16:08 jberger perl -Mojo -E 'plugin "PODRenderer"; app->start' daemon
16:10 jamadam joined #mojo
16:10 gtodd :-)
16:12 disputin joined #mojo
16:13 jberger would be kinda nice if you could pass in the path or even a route object to hang the perldoc route from
16:13 jberger perl -Mojo -E 'plugin PODRenderer => { path => '/' }; app->start' daemon
16:13 gtodd jberger: I think I had grabbed and hacked up something like Leguminous ...  copied Mojolicious css/js and over the years had come to believe it was part of the distribution :-P
16:14 jberger gtodd: :P
16:15 gtodd probably because it looked too professional for a hack ... heheh ... then I rm'ed thinking I would find it online again
16:15 disputin joined #mojo
16:18 jberger back to PODRenderer, for the most part now when I make plugins that define routes I try to allow passing in a string route or a route object
16:18 jberger if they don't pass one in the plugin can just pull in app->routes
16:19 jberger but it lets you do things like authenticate first if you allow passing in a route
16:19 gtodd right
16:20 jberger plugin PODRenderer => { route => app->routes->under('/with_auth' => \&check_auth) };
16:20 jberger of course my most recent one explicitly doesn't :p
16:20 jberger https://github.com/jberger/Mojolicious-Plugin-ACME/blob/master/lib/Mojolicious/Plugin/ACME.pm#L18
16:20 gtodd I remember needing to use  ~ParamsAuthenticate~ or something a long time ago
16:20 jberger but that's because the ACME spec defines the endpoint
16:21 jberger I'm so excited about this acme plugin
16:21 jberger I've been staying up too late working on it
16:22 gtodd perldoc is one thing but heh if someone could render *perltoc*  to html  nicely  :-D
16:22 good_news_everyon joined #mojo
16:22 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vz922
16:22 good_news_everyon mojo/master 299b8b5 Sebastian Riedel: no need to write twice
16:22 good_news_everyon left #mojo
16:23 gtodd the first line of perldoc perltoc  should be "DO NOT PANIC"  :)
16:24 jberger perltoc?
16:24 sri_ joined #mojo
16:24 upasana joined #mojo
16:24 jberger hunh
16:24 jberger I didn't know about that page
16:24 PopeFelix jberger, the companion piece to perltic
16:24 jberger and it doesn't render on http://perldoc.perl.org/
16:25 jberger PopeFelix++
16:25 esh joined #mojo
16:25 gtodd jberger: there's probably a good reason for that :-D
16:25 stephan48 joined #mojo
16:25 * PopeFelix is always happy to help out with a bad joke.
16:25 gtodd so M::Command::acme is going to do everything?!
16:26 upasana_ joined #mojo
16:26 jberger gtodd: yup
16:26 jberger the important thing is that the plugin adds the route that handles the challenge to the app
16:26 gtodd everything (for certs)
16:26 jberger and when the challenge is issued it calls over to the running command to get the response
16:27 jberger gtodd: as much as possible
16:27 gtodd when I heard about ACME (I haven't used it) my hope was it could help stop self signing
16:27 jberger (the command itself starts a server which serves (locally) the challenge responses so that your app can know how to respond)
16:28 jberger gtodd: that's the idea
16:28 jberger well, I'm not issuing certs
16:28 jberger this is an ACME client
16:28 jberger sigh, I wonder if I should include that in the naming
16:28 jberger :S
16:29 jberger gtodd: I already have the plugin far enough along that it will issue certs btw
16:29 jberger now I'm just cleaning up and making it friendly
16:29 crab joined #mojo
16:29 jberger and there are no tests at all yet :'(
16:29 jberger been coding it "happy path"
16:30 gtodd good it is needed because what happens is .... you self sign certs to last 10 years when you are 35 years old and have a new machine and can not imagine your future 45 year old self dealing with the problem :)
16:30 jberger haha
16:31 jberger well part of the deal with letsencrypt is that the certs are only issued for 90 days
16:31 jberger this is done intentionally to encourage automation
16:31 jberger which is what I'm trying to do
16:31 good_news_everyon joined #mojo
16:31 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vz9V4
16:31 good_news_everyon mojo/master 880f4a6 Sebastian Riedel: check for handle first
16:31 good_news_everyon left #mojo
16:31 sri_ jamadam: that should take care of it
16:31 gtodd yeah ... and maybe self-signing is just not good for security anyway
16:32 ajr_ joined #mojo
16:32 sri_ jamadam: i do wonder in what context you actually stumbled over that though
16:35 jamadam sri: the original code was very complicated
16:37 jamadam sri: the code was like https://gist.github.com/jamadam/5d22fc50688d89b1bd3d
16:38 jamadam but the $ua is subclassed from Mojo::UserAgent so it still could be my fault
16:39 jberger sri: did 299b8b5 get the performance back?
16:39 sri_ no, that was the user agent
16:40 jberger oh, missed that
16:40 jberger looked so similar I didn't see the context had changed
16:41 gtodd jberger: hmm since it was launched letsencrypt.org  has gained some "traction" with sponsors ... so encryptiSwan encyrptionon is cool
16:42 jberger encryptiSwan/
16:42 good_news_everyon joined #mojo
16:42 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vz9om
16:42 good_news_everyon mojo/master 0928de8 Sebastian Riedel: more consistent formatting
16:42 good_news_everyon left #mojo
16:42 sri_ so, anyone got new mojolicious sticker photos?
16:43 dod joined #mojo
16:43 jberger no, mine didn't show up yesterday, USPS says today ... again
16:43 * jberger weeps
16:43 sri_ :o
16:44 gtodd jberger: s/Swan encyrption//g
16:44 gtodd jberger: not sure what that was
16:44 Kogurr joined #mojo
16:45 jberger sounds like a good name for a business
16:45 jberger the google search results are null!
16:45 jberger great opportunity for SEO
16:46 gtodd hehe so that would've read "encryption is cool" ... I wonder why since it gets disparaged in  the press all the time
16:46 jberger encryption? because the NSA is actively campaigning against it
16:47 gtodd the Snowden effect
16:47 jberger its more like the gunowner effect
16:47 jberger if they ban encryption then only the bad guys will have encrypted transmissions
16:47 jberger (now if they add backdoors to all then encryption methods ...)
16:48 jberger s/then/the/
16:49 jamadam joined #mojo
16:51 gtodd yeah ... the "effect" has  been around a while ...
16:54 disputin joined #mojo
17:00 ajr_ joined #mojo
17:01 good_news_everyon joined #mojo
17:01 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vz9XG
17:01 good_news_everyon mojo/master 1bfe20d Sebastian Riedel: no need to write twice
17:01 good_news_everyon left #mojo
17:12 bowtie joined #mojo
17:51 bradjm joined #mojo
18:00 lsm joined #mojo
18:10 disputin joined #mojo
18:40 sri_ hmm, might also be possible to optimize this a bit https://github.com/kraih/mojo/blob/master/lib/Mojo/EventEmitter.pm#L29-L42
18:46 vicash jberger: it is more the FBI and local law enforcement that are campaigning against encryption. NSA official Mike Rogers has officially said recently that encryption benefits the nation. it is a red herring really. many corporations who get govt contracts have built complex data mining software and encrypted comms. makes their product useless
18:46 vicash jberger: in reality, they're just mining data to sell ads and for other stuff
18:46 genio Why is wrapper defined on its own line and then assigned as opposed to all in one? (I realize this isn't an optimization, just curiosity about something I don't understand)
18:47 sri_ try it :)
18:47 jberger vicash: corp data mining doesn't need encryption protection
18:47 jberger their tracking cookies and javascript do it just fine
18:48 jberger sri_: __SUB__
18:48 jberger also, lets bump mojo to 5.16
18:48 vicash jberger: deep packet inspection...
18:49 genio sri_: my $foo = sub { say "bar" };  $foo->();    works just fine.  I feel like I'm missing something very simple
18:49 jberger genio: $foo is inside the sub
18:49 jberger my $foo = sub { say $foo }; $foo->();
18:50 genio ooooohhhhhhhhhhh. yea.  I _completely_ overlooked that
18:50 vicash genio: closures are awesome that way
18:51 jberger now try this: my $foo = sub { say __SUB__ }; $foo->()
18:51 jberger works just fine
18:51 jberger need to use v5.16;
18:52 genio or caller()... *shrugs*
18:52 sri_ for the record, __SUB__ looks like a performance gain
18:53 jberger could conditionally use it if we can __SUB__
18:53 sri_ just 1%
18:53 jberger meh
18:53 mullagain Is there a way to force 404 errors to generate a default json response rather than the barfing raptor. My project is a rest/json api
18:55 jberger sri: I thought there was a polyfill on cpan somewhere
18:55 sri_ perl needs more good polyfills :(
19:03 Grinnz_ mullagain: https://metacpan.org/pod/Mojolicious::Guides::Rendering#Rendering-exception-and-not_found-pages see the third example block
19:08 disputin joined #mojo
19:14 disputin joined #mojo
19:31 disputin joined #mojo
19:51 jamadam joined #mojo
20:07 vervain joined #mojo
20:08 cpan_mojo Mojo-mysql-0.13 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-mysql-0.13
20:18 jberger sri: https://rt.cpan.org/Ticket/Display.html?id=111466
20:19 jberger LeoNerd seemed amenable to the idea
20:21 jberger batman++ Mojo::mysql update
20:36 PopeFelix Does Mojo::Message do any kind of conversion when you call to_string?
20:37 PopeFelix I'm getting an error from the remote service I'm talking to that says there's an invalid UTF-8 start byte (0xFF), but I don't see any FF bytes in the text portion of the request.
20:37 PopeFelix I'm writing the request to a file with Path::Tiny::spew_raw.
20:40 punter joined #mojo
20:49 genio jberger: Any objection to me posting this to my newly-minted blogs.perl.org space? https://gist.github.com/genio/50e7ac4216fa90af88bf  Also, any critiques left if you have no objections?
20:53 jberger genio: looks good to me
20:53 jberger one stylistic thing
20:53 jberger I'd make the mock app like my $mock = Mojolicious->new
20:53 jberger then once it's defined do $ws->ua->server->app($app)
20:54 jberger otherwise it looks ugly having all those dereferences each time in a row
20:55 genio Updated.  Thanks.
20:55 jberger said differently: make it look like you are clearly defining a mock service and attaching it, rather than manipulating something that exists deep in a dereference tree (even if that's not what you're doing)
20:55 jberger genio: take it further
20:55 jberger set the log level and define the routes on $app first
20:56 jberger make this line the last in the mock block: $ws->ua->server->app($mock); # point our UserAgent to our new mock server
20:58 genio done.
20:58 jberger genio: oh, and once you do that you should also take the tests out of the nonblocking callbacks
20:58 jberger because you can't guarantee that those will be run at all
20:58 genio ah. true.  let me fix that.
20:59 jberger in fact that's probably worth explaining in your post
21:04 genio Maybe I should pull the non-blocking tests out?  It will add to the length a bit to explain and show that
21:13 jberger I always think its impressive to show non-blocking testing
21:13 jberger but then again, for people who aren't familiar, perhaps it is overwhelming
21:15 genio Is that test set better?
21:15 genio still no explanation yet
21:16 jberger getting closer
21:16 jberger I see you abandoned delays
21:16 jberger that's a judgement call
21:16 jberger wait means you don't have to do all the start stop manually
21:16 jberger but maybe that confuses people
21:16 jberger I also don't do all that assignment later
21:17 genio That's where I was hesitating. about wait
21:17 jberger in the callback do this
21:17 jberger (undef, $error, $response) = @_;
21:17 jberger or just use the short names
21:17 jberger but you don't need to unpack and then assign
21:17 genio ah, right
21:20 genio and now with more comments
21:20 genio I think I like the delay syntax better though
21:24 jberger you know
21:24 jberger try it once where you leave the tests like they are, then copy the last test block and show it again with delay
21:24 jberger explain it and mention how it is exactly the same
21:31 genio how about that.  yet again, no explanations yet
21:33 jberger well, its shift->begin not shift->delay()
21:33 genio crappp
21:33 genio had the word delay stuck in my brain I guess
21:33 jberger and I wouldn't show the delay/error before the success/callback
21:33 jberger but yeah
21:34 jberger work them from easiest to grok to best practices as they go through the article
21:43 genio Thank you for all of the pointers.  I know it's annoying to keep having to fix my stupid.  it's been re-worked a bit more following your suggestions.
21:47 genio by the way, keep pointing out things if you see them. :)
21:51 jamadam joined #mojo
21:52 jberger genio: so this last change I don't like because you now would need to reset the lexicals each time, which you are not doing
21:52 jberger personally I think its just be better to define each one in its own block (subtest?) like you were doing before
21:53 jamadam joined #mojo
21:58 genio fixed
22:04 genio At this point it feels like you've done quite a bit more work on it than I have.  If you want to post it rather than me, please feel free
22:25 disputin joined #mojo
22:46 jberger genio: not at all
22:46 jberger It's your examples and that is the hardest part
22:46 jberger I just have tweaks
22:46 jberger Fill in the text and post that sucker
22:50 kablamo joined #mojo
23:22 sri_ hahahaha https://twitter.com/wiersdorf/status/692487786054705155
23:22 Grinnz_ nice
23:23 genio ugh.  movable type is annoying.
23:24 Grinnz_ and when a movable type meets a stoppable force...
23:28 PopeF joined #mojo
23:37 melo joined #mojo
23:38 zax joined #mojo
23:40 zax can somebody help me please ?
23:41 zax i need to <℅= include "a URL" %> inside a template and i havê not found a way. to do it
23:43 genio How does anyone edit a post and view it with this terrible preview interface?
23:43 Grinnz_ zax: what problem are you having?
23:44 Grinnz_ no need to PM me, explain in the channel... there is nothing special about a URL vs any other kind of string in a template
23:45 Grinnz_ oh, perhaps you are looking for https://metacpan.org/pod/Mojolicious::Plugin::DefaultHelpers#url_for
23:45 PopeF joined #mojo
23:48 zax i did it, but i makes a link, dont get(URL)
23:49 Grinnz_ what are you trying to get?
23:51 zax the link html
23:52 Grinnz_ you can use https://metacpan.org/pod/Mojolicious::Plugin::TagHelpers#link_to to make an <a> link
23:53 genio Meh.  forget it.  can't even get a proper code block on this thing
23:54 * genio just lost all enthusiasm due to a terrible tool
23:54 Grinnz_ :/
23:55 zax im probably not explaining myself right... i need a template to make a call to a route só it can be processed by a controler before return the processed request
23:55 Grinnz_ template call a route?! this sounds like a terrible idea
23:57 zax ikr, anyway how can i do it ?
23:58 Adurah You want templates to make requests?
23:58 Grinnz_ don't; put the code in a helper then you can call it from the template or the controller
23:58 Grinnz_ from both routes
23:58 genio says it does markdown, yet won't allow code blocks.  try with <code> and that tries to work, yet screws up with newlines.  wrapping it in a <pre> tag kind of works, but no syntax highlighting for you.  Blockquotes also messes up newlines.  how is MT a thing?
23:59 Grinnz_ genio: <pre><code> ?
23:59 Grinnz_ thats the html5 way
23:59 asarch joined #mojo
23:59 Grinnz_ also if it's markdown why is there html in it

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