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

IRC log for #mojo, 2015-09-03

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

All times shown according to UTC.

Time Nick Message
00:00 jontaylor joined #mojo
00:22 iloveyou joined #mojo
02:05 mattp_ joined #mojo
02:05 iloveyou joined #mojo
02:09 noganex joined #mojo
02:15 mattastrophe joined #mojo
02:15 mattastrophe_ joined #mojo
02:18 sri hmm, looks like Devel::Cover doesn't work on mojolicious anymore
02:19 sri Mojolicious::Controller gets a coverage of 13%
02:19 sri Oo
02:20 sri that's impossible
02:20 Grinnz o_0
02:31 genio hrm. Gives me n/a for everything on this thing I'm working on.
02:41 Grinnz http://cpancover.com wow this is nice
02:42 sri oh, looks like Devel::Cover broke between Mojolicious 6.13 and 6.17
02:43 sri then it dropped from 90.18% to 82.37%
02:43 sri around 90% seems correct with all optional tests disabled
02:43 PryMar56 joined #mojo
02:46 sri https://metacpan.org/diff/file?target=PJCJ%2FDevel-Cover-1.20%2F&source=PJCJ%2FDevel-Cover-1.18%2F
02:46 sri version numbers in ever class are sooo helpful... not!
02:48 Grinnz they're not meant to be helpful, it's just the only way depending on a specific version of a module can work :/
02:49 Grinnz i don't see the point of the # VERSION comments there though
02:50 Grinnz ah, it's that dzil plugin that inserts your versions for you
02:50 Grinnz *sigh*
02:52 jberger Ye gods that diff is like entirely version number changes
02:52 Grinnz i'm not seeing much actual code change, it's mostly that and test changes
02:55 Grinnz apparently my plugin bundle has 21% test coverage, how is that even possible, i have one test which says the version of the module
02:56 srini joined #mojo
02:56 preaction 21% of the lines of code in the module were reached. sub declarations? use lines? the 1; at the end?
02:57 Grinnz a lot more than 21% of the lines of code are inside the configure sub
02:58 Grinnz er, other way around
02:59 preaction strange
03:02 genio is there a tutorial somewhere for Devel::Cover?  perl Makefile.PL  make  cover -test  gives me n/a for everything, but I have lots of tests and Pod coverage tests, etc.
03:03 kaare joined #mojo
03:07 preaction the perldoc should explain how to use it with EUMM. I believe it's PERL5OPT="-MDevel::Cover" make test
03:08 thowe joined #mojo
03:13 Grinnz the biggest change during tht time period appears to be perl 5.22. it seems likely to me something in that broke Devel::Cover
03:13 Grinnz but i guess that's easy to check in perlbrew
03:17 srini joined #mojo
03:21 genio Ah. It doesn't work on Windows/Strawberry Perl at all.  Same exact module on my mac ran the same way and I get coverage results
03:22 lsm joined #mojo
03:24 srini joined #mojo
03:28 iloveyou joined #mojo
04:06 melo joined #mojo
04:21 jb360 joined #mojo
04:37 iloveyou joined #mojo
04:38 inokenty-w joined #mojo
04:51 iloveyou joined #mojo
05:18 iloveyou joined #mojo
05:46 iloveyou joined #mojo
06:12 kivilahtio joined #mojo
06:15 dod joined #mojo
06:20 dod joined #mojo
06:55 inokenty joined #mojo
06:57 trone joined #mojo
07:02 iloveyou joined #mojo
07:05 eseyman joined #mojo
07:05 cpan_mojo MojoX-Mysql-0.17 by KOSTYA https://metacpan.org/release/KOSTYA/MojoX-Mysql-0.17
07:13 Vandal joined #mojo
07:20 AndrewIsh joined #mojo
07:44 ashimema joined #mojo
08:08 kivilahtio joined #mojo
08:09 iloveyou joined #mojo
08:22 kivilahtio joined #mojo
08:39 inokenty joined #mojo
08:47 kivilahtio joined #mojo
09:14 meshl joined #mojo
09:19 mattp_ joined #mojo
09:21 jontaylor joined #mojo
09:30 melo joined #mojo
10:21 iloveyou joined #mojo
10:23 cpan_mojo Swagger2-0.51 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Swagger2-0.51
10:24 asm35 joined #mojo
10:36 batman oh my! i'me giving a swagger2 talk tomorrow at the yapc :S http://act.yapc.eu/ye2015/talk/6404
10:37 Zoffix Sweet
10:37 * batman need to run off and prepare... didn't expect this :)
10:39 Zoffix There's both MojoX::Mysql and Mojo::mysql? 0.o "Mojolicious ♥ Mysql" indeed
10:43 batman Zoffix: they are very different though.
10:45 Zoffix "Mojo::mysql is a tiny wrapper around DBD::mysql that makes MySQL a lot of fun to use with the Mojolicious real-time web framework."
10:45 Zoffix "MojoX::Mysql is a tiny wrapper around DBD::mysql that makes Mysql a lot of fun to use with the Mojolicious real-time web framework."
10:45 Zoffix :D
10:48 iloveyou joined #mojo
10:49 stephan48 mh.
10:58 y1mmm joined #mojo
10:59 batman Zoffix: mine is async.
10:59 batman *can be*
10:59 Zoffix :)
11:24 neilhwatson joined #mojo
11:35 jberger batman: good luck!
11:35 jberger I take it there was some cancellation?
11:45 buu joined #mojo
12:04 batman jberger: Yeah. So... I couldn't say no, could I? :)
12:05 batman Thanks
12:05 jberger No you jump on those!
12:05 batman ...and hopefully it ends well-ish
12:05 batman Hehe
12:06 jberger Did you have a skeleton of a talk started at least?
12:06 batman It's so weird. Even when I practice for my self, I hear my voice change "pitch"
12:06 batman Goes into robot mode. (Not a fancy robot)
12:07 jberger batman++
12:07 batman Yeah. http://thorsen.pm/perl/programming/2015/07/05/mojolicious-swagger2.html
12:07 mst jberger: apparently a broken hip is going to be the official perl injury from now on
12:08 batman I've also created slides. (Link on the talk page)
12:08 Adurah Because Perl is no longer hip.
12:08 batman Adurah: It's very hip inside the echo chamber :)
12:08 batman mst: Oh! That's why :(
12:09 batman That sucks.
12:09 Adurah The Echo Chamber, that some sort of nightclub?
12:09 batman Adurah: "Amongs fellow per devs"
12:09 batman aka "the Perl community"
12:09 batman per = Perl
12:11 jberger mst: :o who this time?
12:11 jberger I guess that's where batman's time slot came from
12:20 mst jberger: drforr
12:21 genio aw, man.  that sucks
12:23 genio batman: reading your swagger2 page, I happened to see "collaberation"  s/ber/bor/  (only typo that jumped out during my scan)
12:25 batman genio: the blog post...? (where do is "the page" ?)
12:25 batman s/do//
12:25 batman genio: going to fix that later.... heading back to the conference. i hope i've prepared enough for the lightning talk now :)
12:25 genio http://thorsen.pm/perl/programming/2015/07/05/mojolicious-swagger2.html  sorry, I should have mentioned the one you linked to
12:26 batman marcus: i'll let you know how it goes http://act.yapc.eu/ye2015/talk/6405
12:26 genio good luck
12:26 batman genio: thank you!
12:26 jberger batman++
12:26 batman btw: the lightning talk != swagger talk
12:26 jberger Anyone know if there is a live stream?
12:27 mst no live stream, only the keynotes are recorded
12:28 mst the venue apparently wanted $$$$$$$$$$$$$$ for that
12:28 genio odd
12:39 hernanGOA joined #mojo
12:52 ajr_ joined #mojo
13:01 iloveyou joined #mojo
13:15 gryphon joined #mojo
13:16 HtbaaPi joined #mojo
13:34 CromeDome joined #mojo
13:41 cpan_mojo Mojolicious-Plugin-I18NUtils-0.16 by RENEEB https://metacpan.org/release/RENEEB/Mojolicious-Plugin-I18NUtils-0.16
13:56 jb360 joined #mojo
13:56 hernanGOA joined #mojo
14:29 Ptolemarch joined #mojo
14:35 iloveyou joined #mojo
14:47 asarch joined #mojo
14:51 Ptolemarch joined #mojo
14:51 asm35 joined #mojo
15:07 asarch joined #mojo
15:11 tyldum batman: Do another lightning with swagger, then :D
15:12 mattastrophe joined #mojo
15:13 mattastrophe_ joined #mojo
15:15 tyldum batman: Didn't notice that your friday talk would be swagger
15:18 Kogurr joined #mojo
15:25 tyldum Haven't seen the schedule change announced to include your talk
15:28 cpan_mojo Mojo-Webqq-1.4.4 by SJDY https://metacpan.org/release/SJDY/Mojo-Webqq-1.4.4
15:32 gryphon joined #mojo
15:32 cpan_mojo Mojo-IRC-Server-1.7.0 by SJDY https://metacpan.org/release/SJDY/Mojo-IRC-Server-1.7.0
15:36 * Grinnz_ is a little irked that dist took the Mojo::IRC::Server name
15:39 batman tyldum: i really, really, hate lightning talks.
15:39 batman i wish i knew why
15:40 tyldum batman: You did okay. I'm still pondering if I should do one or not
15:40 CromeDome joined #mojo
15:40 dexteruk joined #mojo
15:40 tyldum But you seem like someone I should talk to about swagger2.
15:40 batman tyldum: i wouldn't know if it's ok or bad, since i black out, haha
15:40 tyldum Hehe
15:41 batman tyldum: sure. come to the talk tomorrow or join #swagger
15:41 tyldum Yep, attending
15:41 batman \o/
15:43 tyldum I am in the process of developing a RESTapi and trying to figure out of mojo or dancer is my way forwards
15:44 tyldum Still typing it out in swagger
15:44 PopeFelix tyldum, Be hardcore - do it all with sockets.
15:45 tyldum WebSockets - to be WebScale of course
15:46 batman tyldum: so swagger2.pm can be used with either... there is a big difference in my opinion: one of them supports json in core :)
15:47 batman i'm also going (at some point, hopefully before 2016) expose the swagger api over websockets. it might not make too much sense, but i want to do it anyway, hehe
15:47 tyldum batman: I'm not expecting a totally unbiased conversation.
15:47 batman tyldum: just stating facts :)
15:47 tyldum Hehe, sure. I know too little of both options so I try to get some better insights
15:49 CromeDome joined #mojo
15:49 ashimema can swagger be used to describe rpc?
15:50 batman please join #swagger
15:57 Ptolemarch joined #mojo
16:11 asm35_ joined #mojo
16:12 asm35_ left #mojo
16:15 ZoffixWork joined #mojo
16:20 ZoffixWork I'm now officially a Windows Mojolicious user :O First time ever am I using perl on Windows for $work too... This will be interesting.
16:20 Ptolemarch joined #mojo
16:44 zackiv31 joined #mojo
16:50 meshl joined #mojo
16:52 PryMar56 joined #mojo
16:58 disputin joined #mojo
17:06 disputin1 joined #mojo
17:07 PopeFelix Can someone explain the difference between Mojo::UserAgent::Server::url and Mojo::UserAgent::Server::nb_url?  Or more accurately, how could I test that my application is using the proper URL?  Can I configure separate blocking and non blocking URLs?
17:20 dod joined #mojo
17:32 Ptolemarch joined #mojo
17:34 sri yea, i think i'm gonna pass on the official perl injury
17:34 sri MojoX::Mysql is weird
17:35 sri PopeFelix: one is for non-blocking requests
17:35 sri you do not configure that at all
17:36 sri it's an implementation detail
17:36 PopeFelix Gotcha.
17:36 PopeFelix So how would I test that?
17:37 sri test what?
17:37 tencendur joined #mojo
17:38 PopeFelix https://github.com/PopeFelix/Mojo-UserAgent-Mock/blob/master/lib/Mojo/UserAgent/Mock.pm
17:38 PopeFelix I have a mock_blocking attribute that configures whether or not to mock a blocking or non blocking URL.
17:38 sri oh, that seems completely unnecessary
17:39 PopeFelix You think so?
17:40 PopeFelix I wasn't sure what the point of it was myself, but as this is based on jberger's code, I thought he had a decent reason for leaving it in.
17:42 sri no, i mean the module so far seems unnecessary
17:43 sri nb_url/url is about which event loop to use for the server
17:43 PopeFelix I admit it's not much, but as someone new to Mojo, I think it would be useful to have a thing where I could mock an entire interaction.
17:44 sri it doesn't look like you're actually mocking anything
17:45 sri $ua->server->app(Mojolicious->new); $ua->server->app->routes->get('/' => {text => 'Test app!'});
17:45 sri it's all supported natively already
17:46 shadowpaste "PopeFelix" at 217.168.150.38 pasted "Mojo::UserAgent::Mock example" (50 lines) at http://paste.scsys.co.uk/498079
17:47 sri hash is a bad container for routes, since ordering matters
17:48 PopeFelix Yes, but for someone like me who is new to Mojo, it's easier to do $ua = Mojo::UserAgent::Mock->new(routes => { GET => { '/' => sub {} } })
17:48 PopeFelix OK, I'll change it to array.
17:48 * sri shrugs
17:48 berov1 joined #mojo
17:49 PopeFelix I'm trying to address some of the issues I encountered in learning how Mojo works.
17:49 sri with $ua->server->app you have actual access to the full app, and can use it just like you would in a real app
17:49 sri so all the docs apply
17:50 PopeFelix Right, and I've exposed the app as well, so you can throw a full app in there.
17:50 sri while with your mock object you have to learn a new way to define routes
17:50 * sri is trying to understand why you think that is easier
17:51 mattastrophe joined #mojo
17:51 PopeFelix If you know the "right" way to define routes, you can create an app, or just do $ua->app->routes(...)
17:51 PopeFelix It seems simpler to me to do ->new(routes => { '/' => sub { ... } })
17:52 sri i think what bugs me most is the name
17:52 sri since you don't actually mock anything
17:52 PopeFelix or ->new(routes => { GET => { '/path' => sub { ... } } })
17:52 PopeFelix Well, what would you suggest?
17:52 sri if it was Mojo::UserAgent::MyFancyRoutes i would not care at all :)
17:52 PopeFelix lol
17:53 PopeFelix The thing about just saying "MyFancyRoutes" is that it hides the fact that you don't have to use it to connect to a separate app.
17:53 PopeFelix Or maybe "external app" is a better word.
17:54 PopeFelix Which is something I didn't realize at first.
17:55 PopeFelix I could call it Mojo::UserAgent::CreatesAppForYou, but that's a mouthful.
17:56 PopeFelix And maybe you could use this to create a module that mocks a SOAP interaction from a WSDL.  The module would read the WSDL and create endpoints that respond appropriately.
17:56 zackiv31 joined #mojo
17:57 PopeFelix I'm not well-versed enough in WSDL to know if that's possible or not; it's just an idea.
17:58 hernanGOA joined #mojo
17:59 PopeFelix What this also does, though - and this is entirely jberger's doing; I can't take credit for that - is it rewrites the request URL and exposes the original request in an event, so you can look at it and make sure it looks like it's supposed to.
18:11 asm35 joined #mojo
18:12 amon joined #mojo
18:32 jberger :o
18:33 jberger PopeFelix: so the reason I hadn't yet released mine were the same reasons sri mentions
18:33 jberger I didn't think there was enough added value there
18:34 PopeFelix jberger, I found enough added value to think that it merited release.
18:34 jberger Mock objects often aren't well structured, in fact I would assume you would want minimal architecture so that you know for sure what it's doing
18:34 jberger I haven't looked at yours yet, leery me take a peek
18:35 PopeFelix OK
18:36 PopeFelix As a Mojo newbie, having this is going to make it easy for me to test my projects that use Mojo::UserAgent.
18:36 jberger PopeFelix: you know, there isn't much reason that it needs to be a subclass of the ua
18:36 PopeFelix easier, anyway.
18:37 jberger Perhaps it should just be a mock app
18:37 jberger And it could have a method that attaches to a ua and sets up the rewrite
18:37 PopeFelix jberger, that's certainly possible.
18:38 PopeFelix As I've said, I took your code and ran with it.
18:38 jberger $mock->attach($ua)
18:38 jberger Yeah I get that
18:39 jberger And yet seeing it at the point of release makes me see it in the light of "that really has very to do with the ua"
18:39 PopeFelix jberger, having it as a subclass of UA allows me to insert it directly into a thing where I'd otherwise use Mojo::UA
18:40 PopeFelix e.g. $class->new('ua' => Mojo::UserAgent::Mock->new(...))
18:40 PopeFelix Of course, by the same token, if I have access to the UA, I can do $mock->attach($obj->ua)
18:40 jberger Exactly
18:41 PopeFelix I don't know that there are compelling reasons to do one over the other, frankly.
18:41 PopeFelix They both accomplish the same goal.
18:42 jberger Right so when the merits are equal, composition trumps inheritance
18:42 PopeFelix Fair enough.
18:43 tempire curious: https://github.com/stripe/mosql
18:43 PopeFelix Hm.
18:44 PopeFelix I don't suppose replacing the app in the UA will particularly be a problem.
18:46 Grinnz_ tempire: is that an elephant with a mustache
18:46 Grinnz_ i don't think that's how mustaches work
18:46 jberger tempire: that is vaguely terrifying
18:47 tempire You can only talk if you've ever had a curly mustache
18:48 Grinnz_ well, i've never had a trunk
18:48 jberger tempire: I'm glad your website still has a bearded tempire on it
18:48 * jberger still sees tempire as: https://vimeo.com/40992416
18:51 jberger not really, I suppose, but I wish I did
18:51 jberger and a reminder to the new people, sri is a robot, he's not even kidding about that one
18:51 jberger marcus is only a passable viking
18:52 tempire he's actually much too nice to be a viking
18:52 jabberwok Two robots walk into a bar and sit down. First robot: "I had a Turing test today." Second robot: "Oh? How'd you do?" First robot: "I failed. On purpose."
18:53 Grinnz_ lol
18:53 tempire Actually, batman reminds me a little of invader zim
18:54 jberger tempire: exactly, he needs a little more pillage to be a real viking
18:57 jabberwok it takes a pillage ?
18:58 jabberwok ... anyone interested in promoting a mojo talk down here at http://fossetcon.org/ ?
18:58 jberger but batman is batman!
18:58 jberger http://www.great-kidsbedrooms.co.uk/media/wysiwyg/lego-batman.jpg
18:59 jberger jabberwok: hmmm, I'm going to be in florida already in Oct
19:00 Kogurr joined #mojo
19:01 jabberwok very good.  -- if you're passing thru Jacksonville (i-95) the newly revived Perl Mongers would be delighted if you could stop by.
19:01 genio jberger: in the Gainesville area?
19:02 jberger jabberwok / genio: sorry, no, flying into Miami and staying a long weekend in Marathon
19:02 genio Marathon is nice.  Going fishing?
19:02 jberger just beaching/fooding I expect
19:03 jberger but I could go for some fishing if the right opportunity presents
19:03 jberger the wife needs some beach time
19:03 jberger I don't suppose fossetcon provides travel expenses?
19:04 jabberwok print join(',',@fish, keys %sunshine);
19:04 genio I haven't been down to the Miami area for a while now.
19:07 tempire miami is the worst
19:07 Ptolemarch joined #mojo
19:08 jberger not staying in miami longer than it takes to collect our bags and rent a car
19:08 meshl joined #mojo
19:09 genio Miami's not all that bad in certain places
19:13 mishanti1 I had a blast in Little Havana.
19:14 tempire I'm just bitter from working there too long with developers who refused to learn english
19:14 mishanti1 Had some kind of triple-steeped coffee with something or whatnot in it. Tingly stuff. Made you vibrate.
19:14 genio good food places, terribly overpriced and fake (very plastic) places, fun beach places, etc.
19:14 tempire Try talking about abstract database concepts with basic words.
19:14 mishanti1 @tempire: like one would do with managers or toddlers? :)
19:15 tempire mishanti1: Have you taken over the Norwegian government yet?
19:17 mishanti1 tempire: Working on in. Got four municipalities. Soon got seven more (if all goes according to plan). And there are things being done centrally to let us spread further.
19:19 jberger mishanti1: when you take over the television station, I want "pink fluffy unicorns dancing on rainbows" on a loop until the coup is complete
19:19 trone joined #mojo
19:20 mishanti1 jberger: That would actually be HUGE upgrade from what is aired currently.
19:22 mishanti1 I mean, even a loop of https://www.youtube.com/watch?v=kw5zIEKgfOg would be a massive gain.
19:23 tempire Personally, I'd vote for icejjfish
19:23 tempire https://www.youtube.com/watch?v=iq_d8VSM0nw
19:24 jberger oh gods, this is getting out of control
19:25 jberger I ... can't ... look ... away
19:27 Ptolemarch joined #mojo
19:29 mishanti1 Well, he sings and dances far better than me, I'll give him that.
19:30 * jberger remembers not to watch mishanti1 sing or dance
19:31 genio great.  now that is going to be in my head all day.  "when I see a red light all I know is go!"
19:31 jberger the second song wasn't any worse ... and then
19:32 jberger for the long term safety of this channel, I don't think I can link to this one
19:32 mishanti1 "when I see a red light all i know is go" is sort of like "passed out chicks never say no" and "no no, is a yes"
19:32 mishanti1 jberger: I'll try to resist serenading you if we meet again.
19:33 genio I can't imagine being the video director having to hear that stupid song over and over as you're doing scenes and then editing.
19:33 genio sheesh
19:33 tempire I make no promises against serenading
19:33 jberger well we know you can dance at least!
19:41 ajr_ joined #mojo
19:59 mattastrophe joined #mojo
20:43 good_news_everyon joined #mojo
20:43 good_news_everyon [mojo] Grinnz created unicode_utf8 (+4 new commits): http://git.io/vG7lh
20:43 good_news_everyon mojo/unicode_utf8 fd6c7da Dan Book: add Unicode::UTF8 support to Mojo::Util encode and decode
20:43 good_news_everyon mojo/unicode_utf8 54b85f9 Dan Book: add Unicode::UTF8 optional dependency to version command
20:43 good_news_everyon mojo/unicode_utf8 cee76a0 Dan Book: document optional usage of Unicode::UTF8
20:43 good_news_everyon left #mojo
20:47 chansen Grinnz_: There is no need to "stringify" $bytes in Unicode::decode_utf8(); Unlike Encode, Unicode::UTF8 works correctly with MAGIC and will never fuck with callers data
20:49 mattastrophe joined #mojo
20:49 Grinnz_ chansen: note this channel is G-rated, and thanks
20:50 sri how much faster is it?
20:50 Grinnz_ with a naive benchmark perl -Ilib -Mojo -MMojo::Util=decode,encode -E'my $str = "\x{f1}"; n { decode "UTF-8", encode "UTF-8", $str } 1000000'
20:50 Grinnz_ it halves the round trip time on my system
20:51 sri and in a realistic benchmark?
20:51 Grinnz_ do you have one? :)
20:51 chansen sri: https://gist.github.com/chansen/254a01d69490d93297f4
20:51 sri i see
20:51 sri -1 from me i'm afraid
20:53 x86 joined #mojo
20:55 chansen 2K% faster than Encode::decode for english texts isn't something you sneeze at ;o)
20:55 x86_ joined #mojo
20:58 jberger Grinnz_: as far as implementation goes, I guess I'd like to see this expanded so that the compiler can constant fold to a single decision tree for either use case: https://github.com/kraih/mojo/compare/fd6c7da5621e%5E...f63e6fe024f3#diff-f794a3437aab8543fdc53904e356a38fR104
20:59 good_news_everyon joined #mojo
20:59 good_news_everyon [mojo] Grinnz pushed 1 new commit to unicode_utf8: http://git.io/vG7Ea
20:59 good_news_everyon mojo/unicode_utf8 5fed71e Dan Book: don't stringify values passed to UUTF8
20:59 good_news_everyon left #mojo
21:00 sri chansen: only if it is measurable in the greater scheme of things
21:00 Grinnz_ jberger: expanded how?
21:00 Grinnz_ i was trying other ways but perltidy kept screwing it up
21:01 x86 joined #mojo
21:01 chansen sri: It has been in my profiling when developing REST API's
21:01 jberger meaning one if statement checking the compile-time UUTF8 and another checking the runtime $encoding
21:01 Grinnz_ hmm
21:02 jberger I guess we could Deparse it to see if it can constant fold it as-is
21:05 Grinnz_ I don't see a way, it's going to have to checking the $encoding either way if UUTF8 is true
21:05 Grinnz_ I'm not sure I follow how this works though
21:06 chansen Yeah, since it uses Encode for other encodings
21:06 sri is "my $fallback = sub {die};" really good style?
21:06 Grinnz_ sri: i put sub {die} inside the statement and perltidy blew it up into 3 lines
21:07 chansen It's ok, he could have used <use warnings FATAL => 'utf8'> instead of the die in the $fallback
21:07 * sri also wonders how utf8::encode/decode compare performance wise
21:08 chansen You can modify the benchmark in the above gist to find out
21:08 sri i remember actually having those special cased for UTF-8 for a time
21:09 sri think they were removed again because in the bigger scheme of things it just didn't matter
21:10 chansen I'm sure you know the difference between utf8 and UTF-8? <http://stackoverflow.com/questions/31598938/benchmarking-utf8-file-read-explanation-of-the-differences/31627770#31627770>
21:11 sri i know it's a mess
21:11 sri so i'd rather not be dealing with it and leave all the hard decisions to Encode :)
21:13 chansen It's simple, utf8 is Perl's internal encoding which is a superset of UTF-8, for interchange we use UTF-8 because utf8 may contain code-points which are ill-formed in UTF-8
21:38 Grinnz_ sri: the main place i'd think it would make a difference is slurping of template files and rendering, dunno if we have a good way to benchmark those
21:42 sri since templates are cached, it will most likely be like slurping, and not matter at all
21:45 Grinnz_ for a JSON API if it's using Mojo::JSON and not Mojo::JSON::MaybeXS it would be a big difference
21:46 sri what was your original motivation for the patch?
21:47 Grinnz_ just that Encode is so slow and we're almost always using it for UTF-8
21:49 sri ok, so no specific use case
21:50 Grinnz_ not particularly, Mojo::Util::encode/decode are used in so many places
22:03 sri has someone tried to make Encode faster yet?
22:05 chansen Encode uses Perl's internal API for validating the utf8 which works correctly on ASCII and EBCDIC platforms
22:07 chansen Encode has one routine that's used for both UTF-8 and utf8 and same routine is used for both encoding and decoding (Thats why we get the cryptic error messages, XXX does not map to ....)
22:08 chansen https://github.com/dankogai/p5-encode/blob/master/Encode.xs#L322
22:13 mattastrophe joined #mojo
22:13 mattastrophe_ joined #mojo
22:14 Grinnz_ thanks for reminding me how much i hate reading C code :P
22:23 Grinnz_ jberger: this is what i get from Deparse on a dummy class i made https://gist.github.com/Grinnz/9d9266da7bc3982b2bab
22:24 Grinnz_ it looks like it folds the constant pretty well
22:35 chansen Grinnz_: I would remove the usage of $fallback and add "use warnings FATAL => 'utf8';" in the eval block above Unicode::UTF8::decode_utf8()
22:38 Grinnz_ that makes perltidy blow up the block again
22:38 chansen ahh
22:42 Grinnz_ I could just fatalize the warnings in that whole sub
22:42 Grinnz_ instead of the $fallback line
22:44 Grinnz_ Then _encoding->encode shouldn't need the CROAK parameter either, it's supposed to emit "utf8" warnings in default mode
22:46 chansen Nope, Encode doesn't follow the pragmas unless you instruct it
22:46 good_news_everyon joined #mojo
22:46 good_news_everyon [mojo] Grinnz pushed 1 new commit to unicode_utf8: http://git.io/vG7xr
22:46 good_news_everyon mojo/unicode_utf8 8eeb88c Dan Book: fatalize "utf8" warnings in Mojo::Util::decode, instead of using a $fallback
22:46 good_news_everyon left #mojo
22:46 Grinnz_ hmm?
22:46 Grinnz_ "If the data is supposed to be UTF-8, an optional lexical warning of warning category "utf8" is given."
22:50 PopeFelix joined #mojo
22:50 chansen $ perl -MEncode -WE 'say Encode::find_encoding("UTF-8")->decode("\xFF")'
22:51 Grinnz_ so the docs are just wrong
22:51 Grinnz_ that's always nice
22:52 PopeF joined #mojo
22:52 chansen Trust the source!!! ;o)
22:52 Zoffix :)
22:52 good_news_everyon joined #mojo
22:52 good_news_everyon [mojo] Grinnz force-pushed unicode_utf8 from 8eeb88c to 07a4fd1: http://git.io/vG7pN
22:52 good_news_everyon mojo/unicode_utf8 07a4fd1 Dan Book: fatalize "utf8" warnings in Mojo::Util::decode, instead of using a $fallback
22:52 good_news_everyon left #mojo
22:54 Zoffix What's the utility of MOJO_NO_UUTF8?
22:54 Zoffix Why would anyone want to disable the faster module, if they got it already?
22:55 Grinnz_ Zoffix: there is an env var like that for all optional modules, IMO it's good to have the option to avoid changes in functionality based on what's installed e.g. for testing
22:55 Zoffix Ah
22:55 Grinnz_ i'm not sure if there was another reason
23:00 sri optional modules tend to be used for very significant features, so disabling them makes sense
23:01 sri non-blocking resolver, TLS...
23:01 sri optional module for something insignificant is new
23:16 ajr_ joined #mojo
23:20 meshl joined #mojo
23:23 PopeFelix joined #mojo
23:28 thowe joined #mojo
23:30 thowe I have a Controller with a log method.  It logs some data to a database table.  I want to be able to also call the log function in a different Controller from this one.
23:31 thowe I apparently don't know how to do that...  Calls to MyApp::Controller::Service::log result in an exception "Cannot bind a reference".
23:32 thowe i don't know if it is important, but I am using Try::Tiny at the same time.  The call is in the finally block ( I don't know if that is relevant)
23:33 meshl joined #mojo
23:45 thowe can one call a method in one controller from another controller?
23:47 Grinnz yes, they're just objects; but consider extracting to a common module instead
23:47 jontaylor joined #mojo
23:48 thowe Well, I considered just having a log method helper, but I was under the impression helpers weren't available in other helpers and I didn't see an elegant way to hang onto my database connection.
23:48 Grinnz what gave you that impression?
23:48 thowe I don't recall now.
23:48 Grinnz you get the controller object in a helper, it has access to any other helper
23:49 sri many helpers literally depend on other helpers
23:49 thowe hm.  I'm operaing under a false assumtion then
23:49 thowe er operating
23:49 Grinnz half the custom helpers for my app at work depend on others
23:49 Kogurr joined #mojo
23:49 thowe well...
23:50 thowe that changes things for me then
23:50 Grinnz :)
23:52 thowe So, in a helper, you just $self->helpername ?
23:52 PopeFelix OK, here's my next stab at this thing: https://github.com/PopeFelix/Mojolicious-Quick/blob/master/lib/Mojolicious/Quick.pm
23:52 Grinnz you usually don't call it $self in the helper, since helpers aren't defined as controller methods
23:52 Grinnz but yeah
23:53 thowe well, in startup my first line is "my $self = @_;"  So I thought that was the thing to do...
23:53 Grinnz no no, that is the application object
23:54 Grinnz the helper receives the controller object as the first argument
23:54 Grinnz you don't want to touch the outside $self
23:54 thowe So, if I write a sub, then point my helper to that sub, the sub doesn't get the app object?
23:54 Grinnz also my $self = @_ would not work... should be my $self = shift; or my ($self) = @_;
23:55 thowe yeah sorry, it was $self = shift;
23:55 Grinnz in the helper, my $c = shift; then the app object can be retrieved with $c->app
23:55 sri $self is a naming convention for an instance of the current class
23:55 thowe $self->helper(myhelper => &subname)..    What kind of object is $c in that case?
23:56 Grinnz a controller object
23:56 thowe OK
23:56 Grinnz the one that called the helper, specifically
23:56 Grinnz in a controller action you might do $self->myhelper
23:57 thowe I can do "$self->helper(myhelper => &subname)"   ?
23:57 jberger PopeFelix: shouldn't rewrite url default to true?
23:57 Grinnz it would be \&subname
23:57 thowe ah
23:57 thowe I think I may have not been able to figure the syntax out the first time and gave up...
23:58 PopeFelix jberger, probably, now that you come to mention it.
23:58 thowe even though I think I have written code exactly like that for a log watching daemon one time...
23:58 jberger PopeFelix: also I might call it intercept_request
23:58 Grinnz $self->helper(name => sub { ... }) is also common
23:58 jberger Or something like that
23:59 thowe Grinnz, yeah, but it is going to be longer than 8 lines, so I feel I should not crowd my startup
23:59 jberger Because you don't arbitrarily rewrite it, you make it relative and thus internal
23:59 Grinnz for our work app, we have so many helpers that i moved them to another module :)
23:59 thowe perhaps I should actually use a method signature...
23:59 sri http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Adding-a-plugin-to-your-application

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