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

IRC log for #mojo, 2016-02-26

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

All times shown according to UTC.

Time Nick Message
00:13 sri heh, actually i do have an idea for untangling Mojo::Exception now ;p
00:15 sri the _detect method needs to be split up
00:16 sri then it actually becomes pretty straight forward
00:19 zivester joined #mojo
01:00 bf joined #mojo
01:05 sri even found a bug
01:05 sri haha
01:06 good_news_everyon joined #mojo
01:06 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v20Ey
01:06 good_news_everyon mojo/master 73c0bc6 Sebastian Riedel: add inspect method to Mojo::Exception
01:06 good_news_everyon left #mojo
01:06 sri jberger: i think it's generic now \o/
01:06 sri the key was to make the whole context finding stuff not implicit
01:08 good_news_everyon joined #mojo
01:08 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v20ut
01:08 good_news_everyon mojo/master 1c1c77b Sebastian Riedel: blessed is not needed anymore
01:08 good_news_everyon left #mojo
01:09 sri the whole blessed/isa dance was actually hiding bugs
01:10 sri one might argue that Mojo::Exception->throw doing ->inspect is not generic enough yet though
01:13 Kermit joined #mojo
01:16 good_news_everyon joined #mojo
01:16 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v20zq
01:16 good_news_everyon mojo/master 65255be Sebastian Riedel: mention the default message
01:16 good_news_everyon left #mojo
01:18 acamari joined #mojo
01:28 good_news_everyon joined #mojo
01:28 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v20gM
01:28 good_news_everyon mojo/master 13f621a Sebastian Riedel: clear the context
01:28 good_news_everyon left #mojo
01:32 good_news_everyon joined #mojo
01:32 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v202Y
01:32 good_news_everyon mojo/master 0256fc0 Sebastian Riedel: mention the message
01:32 good_news_everyon left #mojo
01:38 mcsnolte joined #mojo
02:32 bf joined #mojo
02:46 good_news_everyon joined #mojo
02:46 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v206N
02:46 good_news_everyon mojo/master 1c9f97e Sebastian Riedel: a few exception tests
02:46 good_news_everyon left #mojo
02:47 sri Mojo::Exception really fell through the cracks
02:58 PryMar56 joined #mojo
03:15 hernan604 joined #mojo
03:24 acamari hi, I have some 'code' (a subclass of Mojo::Pg::Transaction), that implements savepoints/rollback_to_savepoints, is there any interest in that kind of feature in Mojo::Pg itself?
03:58 sri acamari: came up before https://github.com/kraih/mojo-pg/pull/10
03:58 noganex joined #mojo
04:28 inokenty-w joined #mojo
04:29 taichi joined #mojo
04:35 good_news_everyon joined #mojo
04:35 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2090
04:35 good_news_everyon mojo/master 2b4a100 Sebastian Riedel: add filename attribute to Mojo::Exception
04:35 good_news_everyon left #mojo
04:42 good_news_everyon joined #mojo
04:42 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v20HT
04:42 good_news_everyon mojo/master 6808d61 Sebastian Riedel: remove filename attribute again
04:42 good_news_everyon left #mojo
04:44 taichi joined #mojo
04:56 taichi joined #mojo
04:56 good_news_everyon joined #mojo
04:56 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v20QC
04:56 good_news_everyon mojo/master 05903ed Sebastian Riedel: we have multiple sources
04:56 good_news_everyon left #mojo
04:59 good_news_everyon joined #mojo
04:59 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v20QV
04:59 good_news_everyon mojo/master 85b0fbd Sebastian Riedel: mention additional sources
04:59 good_news_everyon left #mojo
05:04 acamari sri: oh... I see
05:11 acamari sri: maybe if it's better implemented? my use case is to enable some batch process inside a transaction when some of them might fail reporting that all stuff failed and specifying why some of them failed (not the upsert case)
05:12 sri acamari: better implemented?
05:13 sri implementation of the old pull request seems very reasonable
05:14 sri it's just the lack of good use cases, easpecially regarding documentation examples
05:14 sri personally, i don't mind the feature, if it gets the votes i'll merge a patch
05:15 acamari I'm thinking about my eval { my $db = pg->db; my $tx = $db->begin; for (@stuff) { my $sv = $tx->savepoint; # use default _mojosavepointXYZ #; $db->query('do'); # query failed, autorollback_to_savepoint } }
05:15 acamari about eval*
05:15 sri if the use case is good enough i'll even fasttrack it
05:16 sri oh, you mean more scope guards
05:17 sri that's quite a bit of additional complexity
05:17 acamari well, just to mirror the $db->begin use...
05:17 taichi joined #mojo
05:17 sri for that the use case has to be extra good ;p
05:17 acamari I'ts pretty hard right now to get the SQLSTATE string
05:18 acamari sorry, thats other topic
05:18 sri i guess for me it all depends on how pretty you can make a documentation example for it
05:18 acamari buts that my use case, so will put it anyway:
05:19 taichi joined #mojo
05:23 acamari my @errs; eval { my $db = pg->db; my $tx = $db->begin; for (@stuff) { my $sv = $tx->savepoint; # use default _mojosavepointXYZ #; eval { $db->query('do') };  if ($@) { push @errs, $db->dbh->state } else {push @errs, 0; $sv->savepoint} } }
05:25 acamari # thats not about the prettines
05:26 taichi joined #mojo
05:26 acamari but my use case
05:28 acamari i reread the pullreq
05:28 acamari i'm rereading*
05:30 acamari will try to think how to phrase it better for the docs,
05:31 acamari thanks!
05:55 melo joined #mojo
05:59 bf joined #mojo
06:13 jberger sri: I'll have to look tomorrow when I'm not so tired, but yay I hope you're right that your work has made it more general
06:14 jberger Tonight we had a very nice Chicago.pm in which jabberwok talked about Imager and did so via a Mojolicious app which generated his example images on the fly
06:15 jberger A very cool way to demo
06:15 jberger jabberwok++
07:00 bf joined #mojo
07:11 melo joined #mojo
07:19 melo1 joined #mojo
07:19 taichi joined #mojo
07:28 taichi joined #mojo
07:31 McA joined #mojo
07:49 taichi joined #mojo
08:01 bf joined #mojo
08:15 osfabibisi joined #mojo
08:18 dhg joined #mojo
08:20 Vandal joined #mojo
08:20 trone joined #mojo
08:22 kes joined #mojo
08:25 kivilahtio Hi! When i start the hypnotoad daemon, how can I rename the hypnotoad process to 'hypnotoad'?
08:26 kivilahtio now we have '/home/koha/kohaclone/api/v1/script.cgi'
08:26 kivilahtio which is less cool than 'hypnotoad'
08:33 Lee $ENV{HYPNOTOAD_APP} looking at the source
08:34 * Lee installed mojo on his pi zero last night
08:34 Lee took 10 minutes :D
08:34 batman kivilahtio: i don't think you can rename the manager process. but you can rename the workers with Mojo::IOLoop->next_tick(sub { $0 = 'hypnotoad' });
08:35 batman kivilahtio: just rename or symlink your script.cgi to something *cooler*
08:35 kivilahtio Lee: I tried that in previous version of Mojolcious and the hypnotoad failed to start
08:35 Lee ah
08:35 batman it would be very difficult to know which application is running if all of them was called "hypnotoad" :P
08:35 kivilahtio Lee: mabe it works with other servers
08:35 kivilahtio batman: I understand, we have only one app
08:36 kivilahtio batman: so any better uggestions on how to rename them?
08:36 batman nope.
08:36 kivilahtio ok
08:36 kivilahtio batman: so if you have 10 mojolicious app running on the same linux box...
08:36 Lee you probably *want* them to have the name of the script
08:37 kivilahtio Lee: yes
08:37 kivilahtio Lee: but not the whole path to the script
08:37 * Lee would prefer abs path
08:37 kivilahtio Lee: it looks bad on 'ps aux' and top
08:38 Lee just hit 'c' on top :D
08:38 kivilahtio thanks :)
08:39 kivilahtio Lee: actually I am trying to use htop, but it is harder to remember than top
08:40 Lee htop++
08:40 Lee must remember to install it on our prod servers
08:40 AndrewIsh joined #mojo
09:02 bf joined #mojo
09:04 vanHoesel joined #mojo
10:03 bf joined #mojo
10:30 cpan_mojo Business-Payment-SwissESR-0.12.0 by OETIKER https://metacpan.org/release/OETIKER/Business-Payment-SwissESR-0.12.0
10:44 kivilahtio Mojo::IOLoop is very kewlö
10:44 melo joined #mojo
10:45 dod joined #mojo
10:49 arthas joined #mojo
10:57 ashimema Anyone in here ever tried profiling thier controllers?
10:58 ashimema I've been using the NYTProf plugin, but the navigation around the profile always seems to get somewhat stuffed.
10:58 ashimema I'm wondering how others try to do it?
10:59 ashimema and the "statement level" profiling seems to not work at all?
11:00 ashimema vs's running code under perl -d:NYTProf directly at least
11:01 ashimema but of course.. running as above I miss the controller code altogether as it's exec'd?
11:01 ashimema any thought Lee?
11:01 ashimema any thought Lee
11:03 bf joined #mojo
11:10 vanHoesel1 joined #mojo
11:38 ashimema anyone?
11:39 ashimema 'tis all quiet in here today
11:43 CandyAngel Sorry, distracted by POGL2 stuff. Not that I'd be much help if I wasn't, I haven't profiled any of my Mojo apps
11:50 jkramer joined #mojo
11:50 jkramer Ahoy!
11:50 Lee ashimema: the plugin starts/stops the profiling using hooks, so you may well be missing some info
11:51 Lee you can play around with the hooks in the config for the plugin, but even weirder things might happen
11:51 CandyAngel Heyas jkramer
11:51 jkramer May I propose some tiny but useful changes to Mojolicious? I wouldn't want to create issues for them before asking for your opinions.
11:52 CandyAngel jkramer: Pretty sure you are welcome to discuss them. Go for it :P
11:53 CandyAngel If you are suggesting new functionality, a few independent use-cases is handy to have
11:53 jkramer First of all I'd like to have a helper in DefaultHelpers that simply returns the log object, ie. helper log => sub { shift->app->log }; That's the first thing I always do in every Mojolicious app because it's just cumbersome to get ->app for all the log messages
11:54 jkramer So I can type $c->log->debug instead of $c->app->log->debug. I'd even prefer $c->debug, but maybe people might object helper pollution
11:55 Lee ashimema: https://github.com/G3S/mojolicious-plugin-nytprof/commit/5ec7b18efc8d03b0bc3343b7c6f7bbcef889b0f6 # possibly needs a tweak, but so far i've not seen a problem myself
11:55 Lee if you're doing async stuff then yeah, strange stuff may well happen
11:56 jkramer And another thing that'd propbably have a bigger impact on things: Apply DefaultHelpers (and all plugins in general) to Mojolicious::Commands, just like for Mojolicious::Controller.
11:57 jkramer Currently in a Mojolicious::Command::something::run I have to do $self->app->someplugin_method instead of $self->someplugin_method. Is there any reason not to do that for commands?
11:58 CandyAngel I've asked that before, I think it is because commands have no controller, but some helpers expect one
11:59 CandyAngel But I'm not sure
11:59 CandyAngel e.g. the 'include' helper
12:01 CandyAngel The first/second suggestion sounds like a plugin you could write, if you want to elevate log methods
12:01 jkramer Hmm, true, didn't think about that. But maybe some default helpers that are used all the time could be integrated in Mojolicious::Command. I'm mostly thinking about the yet-to-be-added default helper ->log as well as ->ua, ->config and ->dumper
12:01 HtbaaPi joined #mojo
12:03 jkramer At least those are the ones I use all of the time. I admit that it's just laziness that makes me not want to write $self->app-> all the time, but then again programmers are supposed to be lazy and it'd just make the code nicer and tidier
12:03 CandyAngel Don't worry, I totally understand the ->log one :P
12:04 CandyAngel I'm coding a voxel engine that uses the building blocks of Mojo
12:04 bf joined #mojo
12:04 mcsnolte joined #mojo
12:05 CandyAngel So I have to pass the app to the various systems and do $self->app->log->debug() everywhere
12:05 CandyAngel Nothing stopping me writing some wrappers in the base class though :)
12:05 jkramer Hmm and about plugins in commands: How about manually loading plugins/importing plugin methods in commands? I.e. in run: $self->plugin('config'). Or globally: has plugins => [qw( config )]
12:07 melo joined #mojo
12:09 taichi joined #mojo
12:09 ashimema sorry.. was getting a cuppa
12:09 ashimema just reading back
12:09 CandyAngel I think that would require a different namespace? Not tried anything like that
12:10 CandyAngel Same thing really.. some plugins expect $app
12:10 jkramer You mean a different namespace for plugins? Don't think so. I mean as a workaround for plugins that except a controller you just could explicitly import some plugins into the command. If you import plugins that need a controller, it's your fault
12:11 jkramer Well ->app is available in a command, so that would still work
12:12 kaare joined #mojo
12:17 ashimema So..
12:18 ashimema is Lee still about?
12:18 ashimema I have my hooks set to 'before_routes' and 'after_render'.. as something in the swagger plugin meant that it was missing my controller altogether otherwise
12:24 melo joined #mojo
12:25 rwp joined #mojo
12:42 Lee does that fix your profiling?
12:46 sri jberger: i do think it is rather generic now http://mojolicious.org/perldoc/Mojo/Exception
12:47 sri Mojo::Exception->new('Message!') no longer does stuff with the message
12:47 sri it's just a container
12:47 sri and you call ->trace and/or ->inspect to add more information
12:57 good_news_everyon joined #mojo
12:57 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2ES0
12:57 good_news_everyon mojo/master 1c2396d Sebastian Riedel: mention trace behavior
12:57 good_news_everyon left #mojo
13:01 sri jkramer: a log helper has come up before, i think it was too slow
13:03 batman jkramer: if you don't mind the slowdown, you can use https://metacpan.org/pod/Mojolicious::Plugin::Logf
13:05 asarch joined #mojo
13:40 sri oh noes, minion dropped off the metacpan leaderboard, and mojo::pg is about to :(
13:41 * batman just added ++ on Minion
13:44 sri \o/
13:44 neilhwatson joined #mojo
13:45 batman (already did that for Mojo::Pg)
13:45 batman :)
13:54 zivester joined #mojo
13:55 jkramer sri: How is a log helper slower than doing app->log manually all the time?
13:56 sri jkramer: AUTOLOAD is crazy slow
13:56 jkramer Whut? helpers are resolved with AUTOLOAD?
13:56 sri you could do $c->helpers->log to be fast... but that's even more typing ;p
13:56 jkramer I thought they're just patched into the controller class
13:58 sri most of the time AUTOLOAD overhead doesn't matter at all, but for logging it feels weird
13:59 ramortegui joined #mojo
13:59 jkramer Using AUTOLOAD feels weird in general :D Is there a reason why helpers are not simply monkey-patched into the controller class?
14:01 batman jkramer: one mojo app doesn't have to share the helpers with another mojo app
14:01 sri yes, controller methods have a higher precedence
14:01 Trelane joined #mojo
14:02 sri we can add helpers without having to worry about anything
14:02 sri because they stay out of the way, your old controller methods keep working
14:02 jkramer But then the helper can't be used at all anyway. You could just check for existing conflicting methods when loading the plugin
14:03 jkramer Would be even better because then you could issue a warning about the conflicting names
14:04 sri controllers are loaded at runtime on demand
14:04 sri and then there's the security aspect, helpers need to be hidden from the router
14:05 sri in case of /:controller/:action
14:05 ncham joined #mojo
14:05 jkramer Ah
14:05 sri if you want and can redesign the helper system to work with all of those problems and be faster, knock yourself out!
14:05 batman ...and helpers can't be global (classes are global)
14:06 sri that is correct too
14:06 sri the same app may be mounted twice
14:06 sri with different helpers
14:07 batman sri: do you have tests for the security issue regarding /:controller/:action ?
14:07 sri batman: yes
14:08 batman cool. i want to test something out...
14:08 sri also need to protect from /foo/attr and the like ;p
14:08 sri from Mojo::Base
14:14 good_news_everyon joined #mojo
14:14 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2Ehj
14:14 good_news_everyon mojo/master 3e83927 Sebastian Riedel: test inspect method too
14:14 good_news_everyon left #mojo
14:16 bwf joined #mojo
14:16 good_news_everyon joined #mojo
14:16 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2Ej2
14:16 good_news_everyon mojo/master 1becada Sebastian Riedel: no need to call inspect so much
14:16 good_news_everyon left #mojo
14:34 melo joined #mojo
15:07 nnms joined #mojo
15:07 osfabibisi joined #mojo
15:22 mcsnolte joined #mojo
15:23 good_news_everyon joined #mojo
15:23 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2uOJ
15:23 good_news_everyon mojo/master 3f6f1ec Sebastian Riedel: test verbose output as well
15:23 good_news_everyon left #mojo
15:32 good_news_everyon joined #mojo
15:32 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2usc
15:32 good_news_everyon mojo/master 5ae4a30 Sebastian Riedel: more tests for verbose exceptions
15:32 good_news_everyon left #mojo
15:34 sri these kinds of cleanups are exactly what donations are great for
15:34 disputin joined #mojo
15:35 sri nobody would have ever touched Mojo::Exception, it was so entangled in complicated Mojo::Template internals
15:36 jberger oh you are counting these as donation time? very cool
15:36 * jberger pulls up a net diff
15:36 sri indeed
15:36 melo joined #mojo
15:37 sri we got rid of a lot of technical debt there
15:37 sri now it's rather easy to maintain in the future
15:37 jberger does this look right? https://github.com/kraih/mojo/compare/d9600327f006744fb55d9627e698c38ddb233c29...master
15:38 sri yea
15:41 sri i totally understand that most folks want their donation to go towards a flashy feature, but having a few additional unconditional hours to clean up these dark corners is so valuable long term
15:42 taichi joined #mojo
15:42 jberger yeah, absolutely
15:42 jberger that's a great addition to the "toolkit" narrative
15:44 Grinnz_ joined #mojo
15:44 taichi joined #mojo
15:45 bf joined #mojo
15:52 disputin joined #mojo
15:53 zivester joined #mojo
15:57 sri so, should the first or last name win? https://github.com/kraih/mojo/issues/920
16:00 jkramer Just say it's "undefined behavior" somewhere in the documentation :)
16:00 orev logically first match seems to make more sense to me
16:00 sri if it's not in the docs it's by definition undefined behavior
16:00 jkramer See? :)
16:01 jkramer Wouldn't bother with this at all. If people are using identifiers for different things several times they're asking for trouble
16:02 orev leaving things undefined is always bad because people start to rely on the undefined behavior
16:03 orev undefined doesn't mean people won't so it, it means they will play around with it to see if they can determine a rule, then will assume that rule is the truth
16:03 orev /so/do/
16:04 sri best reason i have for changing it is to make it consistent with automatically generated names, where the first one already wins
16:06 orev first match makes sense because the general flow of many kinds of rules is first match.  doing last match makes you think that every route needs to be scanned before anything can be acted upon, so if you were trying to optimize a simple operation before a complex one, you'd want the simple one to be first
16:06 jkramer orev: Yeah, doesn't mean you have to "fix" your stuff because the way they use it relies on undefined stuff
16:09 good_news_everyon joined #mojo
16:09 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2u8J
16:09 good_news_everyon mojo/master ae4609a Sebastian Riedel: fix url_for bug where routes with custom names would not match in the same order as routes with automatically generated names (closes #920)
16:09 good_news_everyon left #mojo
16:09 batman i think i would like the first to win. it's the same with "conflicting" routes: the first defined wins
16:09 batman conflicting = one route that is more greedy than another
16:10 sri for GET/POST parameters it's the opposite, last one wins ;p
16:10 batman nice ;)
16:10 batman jberger: did you see the screenshot in #convos ?
16:10 sri we actually changed that at some point, because last one wins was how every other framework worked
16:12 * batman pops a beer to celebrate that both the first and the last can be winners
16:12 batman :)
16:14 jkramer New slogan: "With Mojolicious everyone's a winner!"
16:14 pink_mist lol
16:15 batman jkramer: no, no. You're a looser if you come second ;)
16:15 jkramer Oh :(
16:17 jkramer "With Mojolicious, it's not defined who's the winner if your routes have conflicting names."
16:17 Adura When you want to be a tightener?
16:18 jkramer Or better: "With Mojolicious, you really should not rely on random undefined behvaior or you'll be a loser."
16:20 * sri thinks mojolicious is now only like 30 lines of code bigger than catalyst core :)
16:21 batman and it has 1000x more functionality :)
16:21 jkramer \o/
16:21 jkramer I think I'll have a beer for celebration now too :)
16:22 jberger Mojolicious::Plugin::DoLessStuff
16:22 twinhooker joined #mojo
16:22 jnbek ...and the tests run exponentially faster :)
16:25 sri think for the 7.0 release i'll add some diagrams to the blog post, with lines of code removed over time, server performance increase over time and the like, that should be fun
16:25 jberger sri++
16:26 sri although, at our current release rate, it will be 2017 by then ;p
16:27 disputin joined #mojo
16:29 sri jberger: what did you want to use Mojo::Exception for btw.?
16:30 osfabibisi joined #mojo
16:31 * batman is using Mojo::Exceptions @work
16:31 jberger when I get to the point of wanting exception objects I want some way to mechanically test the type of exception, I want a stack trace available
16:31 batman can't remember what for right now though :P
16:32 jberger might be kinda nice to have a data bucket field available
16:32 sri batman: was about to say that maybe you should look at the diff then... but if you don't remember ;p
16:32 jberger obviously I could subclass Mojo::Exception and then test ->isa
16:32 batman sri: will search for it on monday...
16:32 jberger but it might also be easy to just attach an error type/code in a data field and test that
16:32 * batman is in convos mode now
16:34 bradjm joined #mojo
16:35 sri Mojo::Exception::inspect is a little quirky, since it tries so many ways to get context data, but we need it that way
16:50 sri jberger: don't see how we could make exceptions types easier
16:51 sri even if we went so far as to add a type attribute and allowed $e->is_type('foo'), you'd still have to do the ->isa dance to check the object type
16:51 sri s/s//
16:54 jberger probably I'd make an ephemeral method that would do that
16:55 jberger my $_check = sub { my $e = shift; return unless blessed($e) && $e->isa('Mojo::Exception'); return $e->data->{type} eq shift };
16:55 jberger then later if ($@->$_check('MyErrorType') { ... }
16:56 taichi joined #mojo
16:56 sri use Mojo::Exception qw(throw_x is_x); eval { throw_x foo => {some_more => 'metadata'}; }; say "gotcha!" if is_x($@, 'foo_exception');
16:56 sri guess you'd have to build the whole toolchanin to make it remotely nice
16:56 jberger yeah, I'm not sure how general you can make that
16:57 jberger but having arbitrary data makes a lot of it easier
16:57 jberger there might be other data I'd want to attach anyway, application specific
16:58 jberger basically the same bucket-data like Delay has
16:58 jberger this is just wishlist of course
16:58 jberger it isn't necessary
16:59 jberger hmmm, but it would be hard to amend the ->throw to make that convenient too
17:02 jacoby joined #mojo
17:02 sri and that's the real problem, nobody knows what a convenient exception looks like ;p
17:15 good_news_everyon joined #mojo
17:15 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2uKM
17:15 good_news_everyon mojo/master f43f5fd Sebastian Riedel: all Mojo::Template exceptions need to be verbose
17:15 good_news_everyon left #mojo
17:20 jacoby joined #mojo
17:24 jacoby joined #mojo
17:28 good_news_everyon joined #mojo
17:28 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2uPL
17:28 good_news_everyon mojo/master aa8f6cf Sebastian Riedel: handle custom exceptions gracefully
17:28 good_news_everyon left #mojo
17:49 good_news_everyon joined #mojo
17:49 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2u5R
17:49 good_news_everyon mojo/master 0405c04 Sebastian Riedel: use CORE::die consistently
17:49 good_news_everyon left #mojo
17:52 PryMar56 joined #mojo
18:05 disputin joined #mojo
18:08 dod joined #mojo
18:14 sri jberger: or maybe ->throw shouldn't act as a constructor?
18:15 sri it seems kinda limiting moving forward
18:17 jberger throw on an instance (rather than the class) could just inspect(2) trace and die
18:17 sri think i'll remove throw completely until we know what we want exactly
18:18 jberger I think inspect(2) trace and die aren't really contentious
18:18 jberger leaving only instantiation
18:19 sri inspect is a little contentious too
18:19 jberger sub throw { die +(ref $_[0] ? shift : shift->new(shift))->trace(2)->inspect }
18:20 jberger and if and until there would be other data to set (like a data bucket) there isn't much else that you would do anyway
18:20 sri but what if there was a data bucket
18:21 sri wouldn't having a half baked throw limit the options going forward?
18:21 jberger then I'd do Mojo::Exception->new($msg)->data($data)->throw
18:22 sri allwing throw on objects breaks the docs
18:22 sri how do you explain the behavior?
18:23 jberger "trace and inspect the current location and die"
18:23 sri eww
18:23 sri that settles the removal for me ;p
18:24 jberger "throw the exception object or create and throw a new one"
18:26 trone joined #mojo
18:30 good_news_everyon joined #mojo
18:30 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2zt9
18:30 good_news_everyon mojo/master df394cd Sebastian Riedel: remove throw method from Mojo::Exception
18:30 good_news_everyon left #mojo
18:30 sri now we start from scratch
18:32 good_news_everyon joined #mojo
18:32 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2zqI
18:32 good_news_everyon mojo/master 3773959 Sebastian Riedel: trace needs to be called manually
18:32 good_news_everyon left #mojo
18:34 sri it's now the most minimalistic api we need
18:35 jberger I still think that throw is a helpful convenience method
18:35 sri of course
18:35 sri i want it back
18:35 jberger oh ok
18:35 jberger so the question is arguments and documentation still
18:35 jberger also, is a data bucket on the table?
18:35 sri but now we have all the time in the world to figure out what exactly we want
18:36 sri everything is on the table
18:36 * jberger sits on the table compliantly
18:38 jberger what about inspect on throw is contentious?
18:39 good_news_everyon joined #mojo
18:39 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2zYy
18:39 good_news_everyon mojo/master a64c10e Sebastian Riedel: test the rendered exception
18:39 good_news_everyon left #mojo
18:41 sri additional sources for throw as a constructor
18:41 jberger I've never used that
18:41 jberger what context is that helpful in?
18:41 sri it's for passing generated code, like templates
18:41 cpan_mojo MojoX-Mysql-0.18 by KOSTYA https://metacpan.org/release/KOSTYA/MojoX-Mysql-0.18
18:42 jberger ah
18:43 sri if it can't find a real file for the error message it falls back to those
18:43 jberger can I see where that is used?
18:44 sri https://github.com/kraih/mojo/blob/master/lib/Mojo/Exception.pm#L27
18:44 jberger I'm assuming in the template renderer I guess or else _development
18:44 sri one line
18:44 sri nope, only Mojo::Template
18:44 sri https://github.com/kraih/mojo/blob/master/lib/Mojo/Template.pm#L106
18:45 sri for more than one file, like there, it even puts the appropriate line from both files into ->line/lines_after/lines_before
18:46 sri which is what the exception template uses to allow you to look at the template and the generated code
18:47 sri $e->line([23, 'the actual template line', 'the generated code'])
18:49 jberger would it make sense to have a sources attribute?
18:49 jberger rather than passing them to inspect?
18:49 sri seems like a waste of memory
18:49 sri inspect only extracts what it needs and discards the rest
18:50 sri which is at most 11 lines of code fro each source
18:51 jberger hmmm true
19:10 neilhwatson joined #mojo
19:33 jb360 joined #mojo
19:50 mike_o joined #mojo
19:52 mike_o In what component of a mojo app would you recommend creating a DB connection and handler? The controller? In the file where the routes are defined?
19:53 sri https://github.com/kraih/mojo-pg/tree/master/examples/blog
19:53 Grinnz_ use a connection handler like Mojo::Pg, and store it in a helper like ^
19:54 mike_o Perfect, that's just what I was looking for. Thanks.
20:04 good_news_everyon joined #mojo
20:04 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2z2R
20:04 good_news_everyon mojo/master 0a58220 Sebastian Riedel: documentation tweaks
20:04 good_news_everyon left #mojo
20:04 sri ok, think i'll leave Mojo::Exception alone for now
20:05 sri and wait for extension proposals
20:55 mike_o left #mojo
21:16 vervain joined #mojo
21:29 captbipto1 trying to install mojo on a linux vagrant box and it gave weird error. https://paste.perldancer.org/cF6KRqvzBl7P
21:30 sri does that error happen every time you try to install>
21:30 sri ?
21:30 captbipto1 yes
21:30 sri interesting
21:31 sri test 91 is the last one the file
21:32 sri what does the actual test output look like?
21:33 captbipto1 Here's all the output:  https://paste.perldancer.org/gII7HwPgWUOl
21:33 sri the test in question is really unspectacular, which makes it a very weird fail
21:35 captbipto1 yeah, seemed unimpressive enough to feel confident to use cpanm -f
21:35 sri yea, it should be totally harmless
21:37 captbipto1 puzzling
21:37 sri the test result makes no sense to me at all
21:37 batman hmm... https://paste.perldancer.org/ vs http://p.thorsen.pm
21:38 sri the string "Internal Server Error" is nowhere near that test
21:39 sri captbipto1: could you run "MOJO_USERAGENT_DEBUG=1 prove -v t/mojolicious/longpolling_lite_app.t"?
21:39 captbipto1 sorry, paste.perldancer.org is bookmarked, new project
21:39 captbipto1 ok with MOJO_USERAGENT_DEBUG=1
21:39 sri it's actually a really long time since we've seen such a random test fail :)
21:40 sri captbipto1: wait, the test passes? Oo
21:40 captbipto1 no, just running it
21:40 sri ah
21:40 sri i want to know the http request/response exchange
21:41 captbipto1 must be inside perlbrew somewhere. got to hunt it down
21:43 sri you could just unpack the dist and run it https://cpan.metacpan.org/authors/id/S/SR/SRI/Mojolicious-6.48.tar.gz
21:43 captbipto1 true that would be much simpler than hunting. forgot about the old days
21:44 Grinnz_ or try: cpanm --look Mojolicious
21:44 batman captbipto1: oh! no need to be sorry (if that was what you were sorry about) - just curious if i could make mojopaste even more "attractive" :)
21:44 sri i'm not really surprised that the test can fail in rare circumstances, what's puzzling is Internal Server Error as message body
21:45 sri if that comes from the server it would be super weird
21:48 sri oh, maybe not so weird https://github.com/kraih/mojo/blob/master/t/mojolicious/templates/exception.html.epl
21:49 sri the app mode is development though
21:50 captbipto1 Part of test code that contains error: https://paste.perldancer.org/6LUvOdgWSH2a
21:50 sri wait, do you have a MOJO_MODE=... in your environment?
21:50 sri or PLACK_ENV=...?
21:50 captbipto1 oops
21:51 ashimema joined #mojo
21:52 asarch joined #mojo
21:53 captbipto1 here's the message with DEBUG set: https://paste.perldancer.org/PNosRHzhERh1
21:54 good_news_everyon joined #mojo
21:54 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2gLP
21:54 good_news_everyon mojo/master 3cd17df Sebastian Riedel: use a better error message for mode specific tests
21:54 good_news_everyon left #mojo
21:55 vervain joined #mojo
21:55 sri captbipto1: http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#Do-I-need-to-clean-my-environment-before-testing-Mojolicious
21:56 good_news_everyon joined #mojo
21:56 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2gt3
21:56 good_news_everyon mojo/master cf9c204 Sebastian Riedel: fix typo in FAQ
21:56 good_news_everyon left #mojo
21:56 captbipto1 PLACK_ENV is probably set. I suppose I could clear and then retry test
21:57 PryMar56 joined #mojo
21:57 sri it will pass
21:57 sri that error message was a really bad choice though :)
21:57 captbipto1 ooh, that was much easier than expected. nice
21:57 captbipto1 Thanks so much for help
21:58 sri next time it will be much easier to spot
22:05 sri also interesting how that is the only test that fails with PLACK_ENV
22:09 sri tempted to just change it, but with a good error message it seems like a decent env canary :)
22:10 jberger since lots of other env vars will cause test failures I don't see any reason to eliminate one
22:12 captbipto1 yeah, doesn't make sense but I suppose if the company keeps encountering this problem then we make a wrapper script to clear those standard envs before installing and then restore afterwards.
22:13 jberger I once got it into my head to try to make sure that the tests cleared up the environment before testing, it was going to be a TON of work
22:13 jberger better to just use a clean environment :-P
22:14 sri only 322 results when searching the dist for MOJO_
22:15 sri ;p
22:15 captbipto1 clean environment is something a little harder to achieve than you might think for some places
22:17 sri the test in question exists since july 2014, so it can't be that bad :)
22:17 sri you're the first to bring it up at least
22:18 sri actually quite remarkable, i wonder if most people just install with cpanm -n
22:20 captbipto1 funny but this still produces nothing: mojo generate app FouledUp
22:20 captbipto1 even tried mojo --help and -h and still nothing
22:20 sri no output at all?
22:23 captbipto1 none, surprising isn't it?
22:23 captbipto1 surprised me too
22:23 sri sounds like there's a broken "mojo" binary on the system
22:24 Grinnz_ `which mojo`
22:25 captbipto1 doing it under perlbrew which put it in /home/vagrant/.perlbrew/libs/perl-5.16.3@ats-applink/bin/mojo so maybe the @ causes a problem (if I were to guess)
22:25 Grinnz_ don't know why it would
22:46 good_news_everyon joined #mojo
22:46 good_news_everyon [mojo] kraih tagged v6.49 at 446d188: https://git.io/v2glt
22:46 good_news_everyon left #mojo
22:46 vervain joined #mojo
22:47 good_news_everyon joined #mojo
22:47 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2glW
22:47 good_news_everyon mojo/master 27d93f0 Sebastian Riedel: bump version
22:47 good_news_everyon left #mojo
22:48 jberger sri: you are releasing Mojo::Exception without throw?
22:48 sri yea
22:48 jberger ummmm, breakage?
22:48 sri didn't look like anyone was still working on it
22:48 sri it was never tested
22:51 Grinnz_ http://grep.cpan.me/?q=Mojo%3A%3AException-%3Ethrow
22:55 dhg joined #mojo
22:58 * sri awaits proposals for bringing it back
23:00 jberger https://github.com/kraih/mojo/commit/df394cded540c4ee1fb3fd5b9e3de7a9a6daa931#diff-dfdd29f22a9c282605481c84cd1b0e15L19
23:00 jberger I don't understand how this isn't tested
23:00 sri that entire file never existed in a release
23:00 sri i made it yesterday
23:00 sri :(
23:00 jberger oh
23:00 jberger sorry
23:01 jberger well ok, if the clock is ticking now, I guess I'm back onto proposals for it
23:02 sri if there had been any proposals now, i would have tried to make a followup release quickly... but the tone here is degrading again, and i don't appreciate that
23:02 sri so i'll be off doing other stuff now
23:03 jberger yes, well I'm sorry that this one did frustrate me
23:03 jberger I'm sorry if that puts you off
23:03 jberger I didn't realize a release was imminent
23:03 jberger I thought it was clear that this was something we were still working on
23:06 sri it was in master, not a working branch
23:10 sri i'll admit that we might have a qa problem though, with so many core devs being inactive
23:11 jberger I guess I just would have appreciated a heads-up on this one, not saying that's always necessary but to me (at work) it didn't seem like the issue had really dropped just that we were considering how to address the points in question
23:11 jberger and admittedly I didn't say "ok I need to let it soak in the brain for a few hours while I work" I did actually think that
23:13 jberger actually my real failing was not reacting when you removed it
23:13 sri maybe we should rotate core team member in and out more dynamically
23:13 sri +s
23:13 sri have an inacive list
23:13 jberger possibly, though anyone in the chat can comment at any time
23:14 jberger there were no votes taken
23:14 jberger which is really the only thing core member vs non core member means in this context
23:15 jberger I do agree it would be nice to have more active core membership generally
23:15 jberger one way or the other
23:15 sri how do you get people more involved, more quickly?
23:16 jberger not sure, though to support your point, I know I stepped up my involvement when I was invited onto the core team
23:17 sri https://github.com/kraih/mojo/pull/921
23:19 jberger no idea what that is for :-P
23:19 jberger though it is in that same area kes was questioning a few weeks back
23:19 CandyAngel get Liam Neeson to give them a call. "I don't know where you are. I don't know what you're doing. If you're looking to avoid me, I can tell you I don't have patience. But what I do have are a very particular set of skills, skills I have acquired over a very long career. If you contribute now, that'll be the end of it. But if you don't, I will look for you, I will find you.. and I will make you vote"
23:19 jberger my initial suspician is that its addressing that same issue (whatever that was)
23:20 sri maybe we should have an MVP title to hand out more liberally or so
23:21 CandyAngel MMP = Most Mojolicious Person
23:21 sri :D
23:22 bpmedley I don't know if this would help; however, perhaps core "support" people..
23:22 cfedde Mojolicious Mojoliciouser Mojoliciousist
23:22 nic titles are all well and good, but cake is the only real currency
23:23 cfedde the cake is a lie.
23:23 Adura The title of Deborah Kagan...!
23:24 jberger there are some who call me .... Tim
23:25 CandyAngel Totally Into Mojolicious?
23:26 jberger well anyway, now that breakage is implied on the throw method, I guess I could just propose it as a literal shortcut for die $e->trace(2)->inspect
23:26 jberger oops I missed the important part
23:27 jberger sub throw { die $e->trace(2)->inspect(@_) }
23:27 CandyAngel On a totally unrelated note, I accidently pulled a drive out of my server that was having a chmod done on a big directory. Plugged it back in.. it carried on. That is several shades of awesome :|
23:27 sri why inspect(@_)?
23:27 Adura Catalyst of Mojoliciousness!
23:27 jberger the sources?
23:27 bpmedley What kind of drive is it?
23:27 sri i bet nobody has ever in the history of mojolicious used that argument right
23:27 jberger hehe
23:28 sri why is it important enough for a shortcut?
23:28 sri what about future extensions?
23:28 CandyAngel bpmedley: SATA?
23:28 bpmedley Fascinating
23:28 jberger mostly because I don't want to have to think about trace level
23:28 sri don't you want ->throw('Exception!', {type => 'whatever'}) in the future?
23:28 jberger the nice thing about throw was that it would automagically trace at the right level
23:29 CandyAngel bpmedley: it's running fsck on it right now, just in case. but there were not complaints anywhere except dmesg noting its removal/readd
23:29 jberger no, I do, but I thought the contentious point was @sources
23:29 jberger so I was conceeding that
23:29 sri if you want @sources why do you need a shortcut?
23:29 sri why not the long form?
23:29 jberger I'm happy to make users use the full form if they want to use sources if that ok by you
23:29 sri it's already verbose
23:29 jberger I was always ok with that
23:30 sri you were the one proposing it ;p
23:30 sri i never cared
23:30 sri in fact, i hated it
23:30 sri so yea, i guess i cared
23:30 jberger ha
23:31 jberger ok well I guess we talked past each other then
23:31 jberger that was why I mentioned a sources attribute to get it out of the way
23:31 sri i was almost ok with your earlier proposal actually, just the docs bit annoyed me
23:32 sri when ->throw does two things, it needs a good description too
23:32 jberger the one with the class/instance method?
23:33 sri die ref $_[0] ? $_[0] : shift->new(shift)->trace(2)->inspect
23:33 jberger right
23:33 jberger so the odd thing about that (that I thought up later) is that the second argument is ignored if it is an existing instance
23:34 jberger that seems inconsistent
23:34 jberger oh and for the sake of clarity, the round braces make it sub throw { die +(ref $_[0] ? $_[0] : shift->new(shift))->trace(2)->inspect }
23:34 sri yea, but if you have an instance already, odds are there's data inside already
23:35 jberger sure, I can agree to that but it makes the documentation even that much harder
23:35 sri oh, think i disagree with that one
23:35 sri forcing trace and inspect again, not nice
23:36 sri kinda defeats the purpose
23:36 jberger I guess I can see that
23:36 sri if you append a ->throw; then you wanted a very custom exception
23:36 jberger the only other way to have the nice shortcut and still get data in (if there were a data bucket) would be to allow new to take two arguments
23:37 jberger ->new($msg, $data)
23:37 sri sure, that's open for the future
23:38 sri honestly, it looks like sub throw { shift->new(shift))->trace(2)->inspect } would take care of the most common case just fine
23:38 jberger in that case making throw a shortcut for die on an instance is probably not worth it
23:39 jberger maybe just make it sub throw { shift->new(@_)->trace(2)->inspect }
23:39 jberger but yeah either one
23:41 jberger (that way truly makes it an alias for new (with all its args) and trace and inspect
23:41 jberger ) # ocd of course
23:44 jberger maybe new should be a slight bit smarter
23:44 sri i don't like smarter
23:44 jberger yeah, I couldn't work out the logic anyway :-P
23:44 sri the old implementation was trying way too hard to be smart
23:45 sri the goal now is simple
23:45 sri in bold
23:45 sri SIMPLE
23:46 jberger I was trying to think of a way for it to do "one non-reference argument is message and all other argument forms are as normal" but you can still basically do that anyway
23:46 sri another question, does the ->inspect make it less generic?
23:47 jberger inside throw?
23:47 sri yes
23:47 sri ->inspect is a bit of an odd feature
23:47 sri more for pretty guis
23:48 jberger you know, I really didn't think so until you asked the question
23:48 jberger now I'm not sure how I would ever use that other than exactly as we are
23:48 sri funny thing is, without ->inspect it wouldn't work for the one case in core where we could use ->throw
23:49 jberger no, I'm ok with it I think
23:49 jberger its a shortcut for "make me an exception object that knows lots of stuff"
23:49 sri well, you could do say $e->verbose(1)
23:50 jberger but is it too late to get the context then?
23:50 jberger perhaps not
23:50 jberger since it gets that from the stack
23:50 sri you have the context already if throw calls ->inspect
23:50 jberger but if it didn't
23:50 sri then you might be screwed
23:50 jberger because of sources?
23:51 sri i've been thinking about making ->inspect a thing called later on by the consumer
23:51 sri but that just doesn't work
23:51 sri with @sources and all, it's something that wants to be done by the producer
23:51 CandyAngel :| I uhh... I've broken ASDA's website. Helpz
23:52 jberger well, yeah if you don't know for sure if the error has come from a generated source especially
23:53 jberger ASDA?
23:53 CandyAngel Supermarket
23:53 CandyAngel If I click their logo, so my browser goes to "http://www.asda.com/#", then click Groceries, I just get a mostly blank page
23:54 CandyAngel Works fine if it doesn't have the "/#".. it might be my adblocker though, works on my laptop
23:54 jberger works for me
23:54 jberger it is a rather ugly url for something as simple a clicking "groceries" though
23:55 CandyAngel http://groceries.asda.com/#?cmpid=ahc-_-ghs-_-asdacom-_-hp-_-nav-_-ghs
23:55 CandyAngel Oh.. it does eventually load? That's really weird..
23:55 sri around here we still physically go to grocery stores
23:55 PryMar56 joined #mojo
23:56 jberger sri: do robots need groceries?
23:56 * CandyAngel also needs a new mouse
23:56 jberger I guess you could still go to the store
23:56 lluad joined #mojo
23:56 CandyAngel My middle click stops working in the evenings :(
23:56 sri you have the weirdest problems
23:56 jberger in the evenings?!
23:57 jberger I ... uh
23:57 CandyAngel What if you went to the store and instead of having a store front, the whole front of the building was just solid white :P
23:57 CandyAngel sri: Yes. yes I do!
23:57 vervain joined #mojo
23:57 CandyAngel That's why I'm so good at testing stuff :P
23:59 CandyAngel And yes, it works until about 7 pm, then it goes weird and I have to keep clicking to get it to register. Such a lazy mouse

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