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

IRC log for #mojo, 2017-12-17

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

All times shown according to UTC.

Time Nick Message
01:18 jamesaxl joined #mojo
01:33 aborazmeh joined #mojo
02:03 marty joined #mojo
02:23 Leffe joined #mojo
02:40 aborazmeh joined #mojo
03:04 CandyAngel Hm.. maybe Berkeleydb and CHI shouldn't be used together. Second time I've had it just full on lock up any process trying to read it -.-
03:04 CandyAngel Thought it was just a Windows problem, but apparently not
03:05 Ya_ALLAH_Ya_Muhmd joined #mojo
03:05 Ya_ALLAH_Ya_Muhmd left #mojo
03:08 Ya_ALLAH_Ya_Muhmd_ joined #mojo
03:08 Ya_ALLAH_Ya_Muhmd_ left #mojo
03:50 Ya_ALLAH_Ya_Muhmd joined #mojo
03:50 Ya_ALLAH_Ya_Muhmd left #mojo
04:23 Leffe joined #mojo
05:12 mohawk_pts CandyAngel, was it one process at a time, or multi processes?
05:20 jberger "just make a little example app" he thought to himself
05:20 jberger oh gods
05:20 jberger this has spun well and truly out of control
06:00 * mohawk cackles
06:01 mohawk i'm just writing a benchmark for graphql-js because leebyron asked me to
06:01 mohawk how did that happen
06:11 Seth joined #mojo
06:27 Seth joined #mojo
06:40 Leffe joined #mojo
06:43 karjala_ joined #mojo
07:12 karjala_ joined #mojo
07:50 jberger ok, its finally done
07:50 jberger cripes, every time I think I'm just going to do something quick
07:50 jberger https://twitter.com/joelaberger/status/942300809093664768
07:50 jberger ok bed bed bed
07:50 purl hmmm... bed bed bed is made squigglier by putting on the same control panel is NOT the topic of vaginas, anal sex beads".
07:50 jberger :o
07:50 jberger purl, I think that's definitely against the SoC
07:50 purl jberger: huh?
07:51 jberger TFW you stumble on a purl factoid you never expected
07:59 mohawk my benchmark is all done too
07:59 mohawk jberger, what's the sample app?
08:03 Vandal joined #mojo
08:13 Leffe joined #mojo
09:24 trone joined #mojo
10:06 karjala_ joined #mojo
10:06 karjala_ joined #mojo
10:56 kes joined #mojo
11:16 sh14 joined #mojo
11:24 Leffe joined #mojo
11:48 CandyAngel mohawk: It was something running under morbo. Shouldn't have been having any writes, been working for like.. a month with no issues -.-
12:03 Leffe joined #mojo
12:49 sh14|2 joined #mojo
13:24 sri jberger: hahaha, you got my wishlist right!
13:27 geospeck joined #mojo
13:33 good_news_everyon joined #mojo
13:33 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vbKNT
13:33 good_news_everyon mojo/master 8f24ed1 Sebastian Riedel: mention common naming conventions for partial templates
13:33 good_news_everyon left #mojo
13:33 sri i guess the docs didn't actually recommend that
13:41 sri doesn't look like this is getting any votes https://github.com/kraih/mojo/issues/1159
14:03 good_news_everyon joined #mojo
14:03 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vbKAW
14:03 good_news_everyon mojo/master f60aa37 Sebastian Riedel: add home section to the tutorial (closes #1162)
14:03 good_news_everyon left #mojo
14:08 sri hard to find a good example
15:02 tyldis \o/
15:12 jberger sri++
15:36 Leffe joined #mojo
15:39 karjala_ joined #mojo
15:42 Leffe Hi
15:45 Ya_ALLAH_Ya_Muhmd joined #mojo
15:45 Ya_ALLAH_Ya_Muhmd left #mojo
15:50 karjala_ hi
15:51 ChmEarl joined #mojo
16:01 Leffe joined #mojo
16:06 Leffe I'm working in a project for embedded (linux) devices
16:07 Leffe these devices, mostly just show videos and pictures
16:07 Leffe each of them have a mojolicious server to upload files and schedule the show
16:09 Leffe They are supposed to work inside customer's safe network, but.. who knows?
16:10 Leffe I'm wondering if it's worth to setup SSL on each mojolicious server.
16:12 Leffe They are going to run inside an intranet ...
16:12 sri if you can deal with expiring certs, sure
16:12 Leffe thanks
16:13 sri might not be worth it
16:13 Leffe So the user will see messages like "certificate expired" ...
16:14 Leffe SRI: Are you the author of mojolicious?
16:14 sri the founder, yes
16:14 mohawk CandyAngel, huh
16:19 mohawk makes me think of locking
16:19 Leffe Wow! I really admire the work you have done. I've never done anything serious (big project) with perl until now, with mojolicious, and I really find it very elegant.
16:21 Leffe The way you can transition from a Lite app, to a complex app it's great. Step by step.
16:22 sri glad you like it :)
16:24 Leffe Loved it.
16:25 Leffe Something I miss, is some guidance for unit testing. I would like to test controllers isolated, for example.
16:26 Leffe Do you recomend me to mock the controller? with Test::MockObject for example? or is there a better way?
16:28 sri i don't test controllers isolated
16:28 sri you might be suffering from fat controllers
16:29 sri to make apps unit testable i try to put as much logic as possible outside of controllers, into models and helpers
16:30 sri controllers like routing are meant to be integration tested
16:31 sri rule of thumb, put as little logic as you can into controllers
16:32 Leffe Yes, I agree.
16:37 Leffe Do you recommend passing the Mojolicious Logger to the Model? This what I'm doing now.
16:38 Leffe I'm even thinking about making my Model objects Mojo::Base objects. Is this a good idea?
16:39 jberger Leffe: re passing the logger, yes I think this is generally a good idea
16:39 jberger re Mojo::Base, yes it is a good base class, if you get all you need from it
16:40 jberger I usually use it for most of my classes
16:40 jberger but you can use Moo if you prefer
16:41 jberger back to passing to models
16:41 Leffe And the Exceptions? Can I extend from Mojo::Exception?
16:41 Leffe I mean in my own model?
16:42 jberger (re: passing to model) I've been playing with some patterns to see if I can find one I recommend for reuse, not sure I'm perfectly happy with it yet though
16:42 jberger re exceptions, sure
16:48 geospeck joined #mojo
16:48 Leffe Thank your very much for your help (sri, jberger)
16:48 jberger always happy to
16:49 Leffe back to logging, what if I put it in a global variable and use it? too dirty?
16:53 marty joined #mojo
16:59 jberger https://twitter.com/joelaberger/status/942439118025445376
16:59 sri Mojo::Exception is not really a general purpose exception class
17:00 jberger Leffe: because of nonblocking, a global logger can be a little tricky
17:00 jberger sri: I thought we were recommending Mojo::Exception more generally now?
17:00 jberger I'll defer to you of course,
17:00 jberger s/,$//
17:01 sri i guess it mostly works
17:01 sri but it's main purpose is still parsing information from perl exceptions for us
17:01 sri not being a container for exceptions
17:02 sri how i wish perl had core exception classes...
17:02 jberger yeah
17:02 jberger definitely a (rare, IMO) case that python is out in front
17:02 sri yea
17:02 * sri likes python exceptions
17:03 * jberger too
17:03 Leffe sri: yes, I really miss this. So do you recomend any exception strategy?
17:03 jberger personally, I don't see any reason not to use Mojo::Exceptions in your model
17:03 jberger especially as the application would then catch them and render them nicely during development
17:03 sri i generally just use Carp::croak
17:04 jberger but their utility outside of a Mojolicious application will be less than inside of one
17:04 sri there is just no real point to making exception classes at the moment
17:05 jberger I guess Mojolicious will upgrade that to a Mojo::Exception in the application anyway
17:05 jberger so ... perhaps you're right
17:05 * sri has been thinking of making up his own exception system with some sort of tagging and tag hierarchy
17:05 jberger (I should probably keep my head in my blogging :-p )
17:05 jberger (I could get caught up into that :D)
17:09 sri it's really sad how much effort the moose folks have put into exceptions, and it's still shitty
17:10 sri https://metacpan.org/pod/distribution/Moose/lib/Moose/Manual/Exceptions.pod
17:11 sri like seriously, you have a million exception classes and the best you can still only do is if ( blessed $e && $e->isa('Moose::Exception::ExtendsMissingArgs') ) {
17:11 sri how sad is that
17:11 mohawk graphql-js uses exception objects as a thing that can be returned, and identified as an error as opposed to successfully-generated data
17:11 sri if i was perl pumpkin that would be top of my priority list
17:12 mohawk arguably they should commit to just using the exception mechanism more
17:12 sri just do what python does, it is good
17:12 mohawk my first go at curing non-pure issues with how they do it now was a bit less than ideal (20% slowdown)
17:13 mohawk (but as a plus, i've made an actual benchmark for them)
17:13 mohawk sri, i'll look that up now!
17:14 sri https://docs.python.org/3/tutorial/errors.html#handling-exceptions
17:14 sri else is a bit quirky
17:15 sri but try, except and raise are solid
17:16 sri and of course you need a good core hierarchy https://docs.python.org/2/library/exceptions.html#exception-hierarchy
17:17 sri so if you except Warning you also catch DeprecationWarning and so on
17:17 Leffe As a user, what I do want to do with exceptions is to bubble them to the controller. Maybe wrap them inside more general Exceptions in the way up, and stringify them. To a stack trace o to a redable form.  Nothing more.
17:18 Leffe Is there anything as simple as this I can use?
17:20 sri just Carp::croak your errors, mojolicious will give you a trace on the error page
17:24 sri perl -Mojo -E 'a(sub { $_->render(inline => "test\nA\n% die q{test error};\nB\nC") })->start' daemon
17:24 mohawk sri, "except Blah" reminds me of java exceptions
17:25 sri Make Exceptions Great Again
17:25 Leffe sri: what is this? <sri>perl -Mojo -E 'a(sub { $_->render(inline => "test\nA\n% die q{test error};\nB\nC") })->start' daemon
17:25 mohawk it seems like the perl "try" thing could be made to have multiple "catch" clauses
17:25 mohawk MEGA
17:25 mohawk Leffe, a demo of mojolicious exceptions
17:26 sri we like do demonstrate stuff with one-liners
17:26 mohawk actually TryCatch has this already
17:26 sri s/d/t/
17:28 sri Try::Tiny has all the mindshare for some reason
17:28 jberger <3 one liner demo apps :-P
17:29 jberger I guess I need to do that for a blog post too
17:30 * sri really really wants to find a creative solution for exceptions in perl
17:31 sri this was almost good enough https://metacpan.org/pod/autodie#EXCEPTIONS
17:31 sri but smartmatch :(
17:31 jberger and indeed that module's use of them has actually prevented fixing smartmatch
17:32 sri it's so close to good it's infuriating
17:33 sri another problem is that autodie is incredibly slow
17:33 sri like making perl code 25% slower or so
17:34 sri don't remember the exact number when i tested it in mojo, but it made my jaw drop
17:34 jberger the closest that probably exists is https://metacpan.org/pod/Syntax::Feature::Try#catch-error-class
17:35 Leffe aha, didn't know that, :D, wrong path again .. :D (autodie slow)
17:35 jberger Syntax::Keyword::Try handles some other things better, than Syntax::Feature::Try, however it skips class based catching
17:46 mohawk i feel like the start of this would be to make a perl patch creating perldoc perlexception
17:46 mohawk https://metacpan.org/pod/Exception::Class is interesting too
17:47 mohawk i wonder why autodie is so slow
17:47 mohawk shurely that's a fixable thing
17:47 Leffe I usually write my own Application Exceptions: I generally group them in two categories: Exceptions I care and I can handle for example: DiskFullException extends "ApplicationException", and SystemExceptions.  Model layer catches 'bare' exceptions, build ApplicationExceptions, i.e DiskFullException(IOException, @info)->new
17:48 Leffe The controller then manage ApplicationExceptions if he can, or just let the framework logs them.
17:49 Leffe This is the kind of exception management I'm looking for .. :)
17:50 mohawk sri, do you have sample autodie-using code i could have a play with NYTProf on?
17:50 mohawk (and indeed benchmark it)
17:50 mohawk i feel a b.p.o blogpost coming on
17:50 sri mohawk: i activated it in Mojo::Base so it's always on across mojo and ran all our tests
17:51 mohawk nice
17:51 mohawk just "use autodie" in M::Base?
17:51 sri don't rememeber what it took
17:51 sri autodie->import to get it into the caller i guess
17:52 mohawk gotcha
17:53 mohawk Leffe, perl idiom might be Exception::Application::DiskFull, etc
17:53 sri Leffe: i don't know anyone who does that for mojo apps
17:54 sri but if you find a nice way blog about it
18:00 Leffe I'll do it if I find a way to make this work in perl. This idiom worked for me, I added relevant info in the ApplicationException 'decorator' such as the parameters I passed to the function file, file_size, user ... anything that could help to find the error cause ...
18:02 good_news_everyon joined #mojo
18:02 good_news_everyon [mojo-pg] kraih pushed 1 new commit to master: https://git.io/vb6L6
18:02 good_news_everyon mojo-pg/master 530db71 Sebastian Riedel: bump version
18:02 good_news_everyon left #mojo
18:04 good_news_everyon joined #mojo
18:04 good_news_everyon [minion] kraih tagged v8.08 at eff584a: https://git.io/vb6LH
18:04 good_news_everyon left #mojo
18:04 good_news_everyon joined #mojo
18:04 good_news_everyon [minion] kraih pushed 1 new commit to master: https://git.io/vb6LQ
18:04 good_news_everyon minion/master 437c3d7 Sebastian Riedel: bump version
18:04 good_news_everyon left #mojo
18:05 sri release all the things
18:18 jberger \o/
19:13 geospeck joined #mojo
20:25 Leffe joined #mojo
21:08 Grinnz https://metacpan.org/pod/release/DBOOK/Mojo-Promise-Role-Futurify-0.001/lib/Mojo/Promise/Role/Futurify.pm
21:09 Grinnz the other direction is significantly harder, since Mojo::Promise doesn't have a way to react to cancellation
21:09 Grinnz but the other direction probably also isn't very useful anyway
21:18 Grinnz hmm, the bot did not pop in for the [mojo] release commits
21:54 karjala_ joined #mojo
22:11 trone joined #mojo
22:37 Grinnz https://metacpan.org/release/DBOOK/Mojo-IOLoop-Subprocess-Sereal-1.000 and https://metacpan.org/release/DBOOK/Mojolicious-Plugin-Subprocess-1.000 now 'reimplemented' in a much nicer role-y way, sri++ for the simple Mojo::IOLoop->subprocess change
23:19 good_news_everyon joined #mojo
23:19 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vb60Y
23:19 good_news_everyon mojo/master 722f46a Sebastian Riedel: mention the purpose of the Mojo class
23:19 good_news_everyon left #mojo
23:20 ChmEarl joined #mojo
23:20 Grinnz i was gonna suggest that but forgot, +1
23:21 sri Grinnz: couldn't you consider cancellation as a rejection?
23:21 Grinnz you could, but it'd be ugly
23:21 Grinnz cancellation should not run failure handlers
23:23 Grinnz any solution i come up with gets stuck on that point
23:25 sri it's rare for promise implementations to have a cancel feature
23:26 sri biggest i've found might be bluebird, but even there it's diabled by default
23:26 Grinnz it adds complication, but also utility IMO
23:55 itaipu joined #mojo

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