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

IRC log for #mojo, 2014-01-29

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

All times shown according to UTC.

Time Nick Message
00:04 davido_ Anyone have a suggestion on how we should be handling Mojo::JSON::error in a module that infects Mojo::JSON with JSON::XS (or Cpanel::JSON::XS)?
00:04 sri eval {json_decode()} and populate the error attribute
00:04 davido_ It's looking like calls that eventually get directed to JSON::XS's encode and decode will need to be wrapped in eval blocks.
00:04 davido_ Ok, so we're on the same page. :)
00:05 davido_ You're favoring using the functions interface to JSON::XS?
00:05 sri don't really care, just want the most compatibility possible
00:06 davido_ My goal is to pass the Mojo::JSON tests.
00:06 sri yea, that's not gonna work ;p
00:06 davido_ :)  I won't get there 100%.
00:07 davido_ I'm not to the point of running it through t/Mojo/JSON.t yet anyway, but as I get closer, that will at least tell me where I've got problems, and I can then decide how severe they are.
00:07 sri perl -MJSON::XS -E 'say encode_json {ohoh => 9**9**9}'
00:07 sri obligatory oneliner ;p
00:07 davido_ Oh I remember that one. :)
00:07 sri number detection semantics are different too
00:07 davido_ Wasn't that discussed here about a year ago?
00:07 sri yea
00:08 davido_ There's also the issue of true and false returning objects from the JSON::XS distribution, unless I wrap and re-issue Mojo::JSON objects.
00:08 sri but i guess you should be able to pass most tests
00:08 sri true/false shouldn't be a problem
00:09 sri just replace the two methods
00:09 davido_ Yes, that's what I've done.  I don't think people will mind that they get objects from the XS dist instead.
00:10 sri think it will even work with Mango::BSON.. where i reuse the Mojo::JSON constants for true/false (bson/json roundtripping and all)
00:10 sri :)
00:10 davido_ Anyway, I keep finding my time more limited than expected, but in a day or two I should have enough to go with to be able to put up a dev release on CPAN for people to try (or I can link the repo here when it's more ready)
00:11 davido_ So you're saying that Mojo::JSON::XS should return Mojo::JSON true and false, and not the true and false from JSON::XS's dist?
00:11 sri that't not what i said
00:11 davido_ Ok, good.
00:23 * sri wonders if he has a second use case for a before_render hook
00:25 sri hook before_render => sub { my ($c, $args) = @_;  $args->{json} = {exception => $c->stash->{exception}} if $args->{template} eq 'exception' && $args->{formar} eq 'json' };
00:41 sri tempted to add before_render and expose a few more methods in Mojolicious::Renderer
00:42 sri like _generate_template as template_for
00:42 sri maybe _detect_handler as template_handler
00:54 maxhq joined #mojo
01:01 maxhq1 joined #mojo
01:05 laouji joined #mojo
01:08 d4rkie joined #mojo
01:08 laouji_ joined #mojo
01:11 maxhq joined #mojo
01:20 maxhq1 joined #mojo
01:27 maxhq joined #mojo
01:29 sri considering this patch for more hackable rendering http://pastie.org/8677129
01:41 maxhq1 joined #mojo
01:44 good_news_everyone joined #mojo
01:44 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/3GAK3g
01:44 good_news_everyone mojo/master b26a795 Sebastian Riedel: added before_render hook
01:44 good_news_everyone left #mojo
01:56 marty joined #mojo
02:03 torbjorn wouldnt ie be nice with a "next" iterator on Mojo::Collection?
02:03 torbjorn I need to keep the first two children of a nod and discard the rest
02:05 torbjorn I can do that with each and a counter, but an iterator, or a list of objects in list context would have been nice
02:18 sri i would really like to extract some code from Mojolicious::Controller::respond_to into something like Mojolicious::Controller::accepts_formats or so
02:18 sri my @formats = $c->accepts_formats;
02:19 sri my $best = $c->accepts_formats('html', 'json', 'txt');
02:21 sri maybe start with my @formats = $c->app->types->accepts($c);
02:21 * sri nods
02:30 klapperl_ joined #mojo
02:34 dvinciguerra joined #mojo
02:40 ka2u joined #mojo
03:09 Akron joined #mojo
03:35 zM joined #mojo
04:15 laouji joined #mojo
05:00 laouji joined #mojo
05:09 good_news_everyone joined #mojo
05:09 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/BWNEPg
05:09 good_news_everyone mojo/master 5562abb Sebastian Riedel: added accepts helper to Mojolicious::Plugin::DefaultHelpers
05:09 good_news_everyone left #mojo
05:11 sri marcus, tempire, jberger, crab: review!
05:16 good_news_everyone joined #mojo
05:16 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/e2kU2A
05:16 good_news_everyone mojo/master c1cea55 Sebastian Riedel: fixed handling of unsupported formats
05:16 good_news_everyone left #mojo
05:17 laouji joined #mojo
05:19 good_news_everyone joined #mojo
05:19 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/MI2ydA
05:19 good_news_everyone mojo/master 4f6e1e3 Sebastian Riedel: show examples for unsupported formats in recipe
05:19 good_news_everyone left #mojo
05:21 laouji joined #mojo
05:28 ka2u joined #mojo
05:31 arpadszasz_ joined #mojo
05:36 ka2u joined #mojo
05:45 dotandimet joined #mojo
05:45 sri with format detection for bridges, before_render, and now accepts it feels a bit like pieces are falling into place :)
05:48 d4rkie joined #mojo
05:51 marty joined #mojo
05:54 irq joined #mojo
06:12 laouji_ joined #mojo
06:14 laouji joined #mojo
06:24 good_news_everyone joined #mojo
06:24 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/nKF0ew
06:24 good_news_everyone mojo/master 93165cf Sebastian Riedel: better descriptions for accepts method and helper
06:24 good_news_everyone left #mojo
06:26 laouji joined #mojo
06:31 laouji_ joined #mojo
06:49 Vandal joined #mojo
06:56 dotandimet joined #mojo
07:02 dpetrov_ joined #mojo
07:36 avb joined #mojo
07:37 avb Why the Content-Type for *.jpg and *.JPG is different? The Mojolicious::Lite app, serving static files from public.
07:38 hrupp joined #mojo
07:42 basiliscos joined #mojo
07:45 dod joined #mojo
07:52 marty joined #mojo
07:57 rawler joined #mojo
08:00 dod joined #mojo
08:06 arpadszasz_ joined #mojo
08:06 mil joined #mojo
08:19 trone joined #mojo
08:20 batman any reason why Mojo::UserAgent should _not_ use my proxy settings when i'm starting hypnotoad with MOJO_PROXY=1 ? "MOJO_PROXY=1 hypnotoad script/myapp"
08:26 batman guess not... :(
08:27 odc joined #mojo
08:34 batman crap. totally different issue. chown www /cache/dir :/
08:35 jack joined #mojo
08:39 laouji joined #mojo
08:44 Bravo13 joined #mojo
08:44 laouji joined #mojo
08:53 marty joined #mojo
08:55 maxhq joined #mojo
09:12 laouji joined #mojo
09:18 laouji joined #mojo
09:40 arthas joined #mojo
09:51 ver joined #mojo
10:05 voegelas joined #mojo
10:22 cleverfox joined #mojo
10:40 bowtie joined #mojo
10:45 laouji joined #mojo
10:54 marty joined #mojo
10:55 d4rkie joined #mojo
11:01 laouji joined #mojo
11:06 avb left #mojo
11:32 michael joined #mojo
12:08 zM joined #mojo
12:52 D4RK-PH0ENiX joined #mojo
12:56 marty joined #mojo
13:11 nicomen_ joined #mojo
13:20 d4rkie joined #mojo
13:26 dod joined #mojo
13:31 Negor joined #mojo
13:34 dod joined #mojo
14:07 asarch joined #mojo
14:21 arpadszasz_ joined #mojo
14:22 zivester joined #mojo
14:32 KindOne joined #mojo
14:38 bluescreen joined #mojo
14:41 mire__ joined #mojo
14:52 good_news_everyone joined #mojo
14:52 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/UzLI6A
14:52 good_news_everyone mojo/master e3eec57 Sebastian Riedel: put more usage information in SYNOPSIS
14:52 good_news_everyone left #mojo
14:53 sri nobody cares about the new render stuff? https://github.com/kraih/mojo/compare/8c1e90857948dc2e8bd57e754f00ec4957ed4f15...93165cfb04de15581424a4c6c855c8495569d09c
14:54 btyler joined #mojo
14:56 ka2u joined #mojo
14:57 sh4 joined #mojo
14:58 marty joined #mojo
15:00 Negor joined #mojo
15:01 good_news_everyone joined #mojo
15:01 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/t3U2qw
15:01 good_news_everyone mojo/master 7e8ac23 Sebastian Riedel: simplify finding the best representation
15:01 good_news_everyone left #mojo
15:15 rem_lex joined #mojo
15:15 dod joined #mojo
15:16 Bravo13 joined #mojo
15:17 good_news_everyone joined #mojo
15:17 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/Vc_Irw
15:17 good_news_everyone mojo/master db0d146 Sebastian Riedel: more links
15:17 good_news_everyone left #mojo
15:27 irq joined #mojo
15:32 memowe joined #mojo
15:41 marty joined #mojo
15:42 Adura joined #mojo
15:47 marty joined #mojo
16:00 bpmedley http://filebeagle.com/pricing.html  <-- Woohoo, my beta is done, I think.
16:00 plenum joined #mojo
16:01 davido_ bpmedley: Should the Contact footer be a link to the "Contact" page?
16:02 bpmedley Possibly.  It does take up a bit of space.  I'll put it on the todo list to see what it looks like with no footer.
16:03 davido_ Just make the word "Contact" in the footer live.
16:04 bpmedley Oh, I see.  Yeah, that's an easy add.
16:04 davido_ If anything in the footer takes up space unnecessarily it's the Fayetteville, AR, 72701, which is repeated on the contact page.
16:09 bpmedley Thanks for the advice.  I wlil consider the modificaiton as time goes on.  I did add the Contact href.
16:14 bd $ perl script/sparky
16:14 bd #!/usr/local/ActivePerl-5.16/bin/perl
16:16 bpmedley bd: Is there a problem?
16:27 arpadszasz_ joined #mojo
16:45 plenum joined #mojo
16:51 arpadszasz_ joined #mojo
16:53 plenum joined #mojo
16:59 memowe joined #mojo
17:08 nornagest joined #mojo
17:10 plenum joined #mojo
17:14 arpadszasz_ joined #mojo
17:18 zacts was mojolicious inspired by austin powers?
17:22 good_news_everyone joined #mojo
17:22 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/NyDVng
17:22 good_news_everyone mojo/master b4e2362 Sebastian Riedel: more defensive regular expression
17:22 good_news_everyone left #mojo
17:39 dotandimet joined #mojo
17:42 zacts https://github.com/zacts/Perl-Webcasts/blob/zacts_sketch/perl_webcasts
17:42 zacts a simple first mojo site I'm working on
17:42 zacts comments / suggestions are welcome
17:48 kanishka joined #mojo
17:57 dotandimet1 joined #mojo
18:08 nic hmm, I must have created an 'interesting' tangle.. after a redirect the flash is still flash (not stash)
18:08 nic I'll have to debug tomorrow
18:09 beyondcreed joined #mojo
18:14 moritz I don't think it should become stash
18:15 batman nic: the flash is just flash.
18:15 batman it's data stored in the session, but it's cleared from session when you read it
18:16 batman ^ maybe not the best explanation, but close enough :)
18:22 * sri wonders if there's no feedback for the new render stuff because nobody is interested or because it
18:22 sri 's a low week
18:22 sri *slow
18:22 sri argh!
18:26 batman sri: what's new?
18:26 purl hmmm... new is for creation, but that's not the only place to hook if you want instantiation
18:26 * batman has been too busy :(
18:26 * sri runs away screming
18:26 sri https://github.com/kraih/mojo/compare/8c1e90857948dc2e8bd57e754f00ec4957ed4f15...93165cfb04de15581424a4c6c855c8495569d09c
18:30 good_news_everyone joined #mojo
18:30 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/uJlgJA
18:30 good_news_everyone mojo/master d50abbb Sebastian Riedel: no need to return in oneliner example
18:30 good_news_everyone left #mojo
18:33 batman won't template_handler() be slow the first time since you're listing all the files?
18:33 sri so?
18:33 purl so is probably OptDeps
18:33 batman i thought that part of the code used to be less eager...
18:33 batman not sure if there's a point...
18:34 sri what are you trying to say?
18:35 batman just curious if it matters...
18:35 batman i guess no-one has 100000 templates :)
18:36 sri who cares, it's cached meta data?
18:37 batman true :)
18:38 batman i like accepts(). i'm not sure if i'm going to use the rest
18:39 batman at least i don't see when to use those methods now.
18:39 sri that's ok
18:39 batman first impression: looks like you've made some private methods public.
18:40 batman but i'm super tired, so i might be wrong :(
18:40 sri the renderer methods are for better test coverage and allowing the before_render hook to imitate more native renderer functionality
18:40 batman https://github.com/tonyskn/node-redis-timeseries/blob/master/src/timeseries.js # trying to convert this to mojo-redis now...
18:40 batman then i need to pack for vacation
18:41 batman "imitate more native renderer functionality" # don't understand what this means :(
18:41 sri my $default_template = $self->app->renderer->template_for($self);
18:41 sri you can guess what the renderer is going to do
18:42 batman ok.
18:42 sri say you want to append "_mobile" to any template name and there is none
18:42 sri you can generate the default now that otherwise the renderer would generate
18:42 sri giving before_render more power
18:43 batman i think i get it.
18:43 sri with template_handler you can guess the handler and perform other modifications based on it, like append "_mobile" for everything ep but not tt
18:43 batman sorry, i can't give any better feedback
18:44 sri accepts is the only real new feature, and you said you like it, that's enough
18:44 batman :)
18:45 batman i think it's super useful. i'm pretty tired of poking into $stash->{format}
18:46 sri maybe take a look at the exact accepts semantics and check if it's what you expect https://github.com/kraih/mojo/compare/v4.71...master#diff-65cf575515a0ad467194433b39cd30d3R355
18:48 batman crap. i forgot about that ... why will is this undef: /hello (Accept: text/plain)
18:48 batman s/will//
18:48 sri because "txt" is not in the list
18:49 batman oh.
18:49 batman of course :(
18:49 * batman want to be ignored
18:49 sri if you just want all formats there's my $all = $self->accepts;
18:49 sri which is what responds_to now uses internally
18:50 batman right
18:50 sri and /hello -> "html" is the default because the client has no preference whatsoever
18:50 sri (just picks the first then)
18:51 batman yup.
18:51 batman i might think that extension should be more important than Accept header
18:51 sri disagree
18:52 sri by default it only recognizes specific Accept headers as in one mime type
18:52 sri so the user took the time to make a custom Accept header
18:52 sri multiple accept headers are only supported for ajax, where once again user action is required to generate it
18:52 batman Accept: text/html and GET /foo.txt == "html" right?
18:53 sri right
18:53 batman i thought the browser always sent an accept header?
18:53 sri it does, but with a shitload of mime types
18:53 sri we ignore those
18:54 batman oh.
18:54 sri http://mojolicio.us/perldoc/Mojolicious/Types#accepts
18:55 batman i see
18:55 batman i still think .txt is more explicit, but that's just my opinion which is not based on any actual scenario or facts
18:55 sri same thing every other framework does basically
18:55 batman :)
18:57 sri while we are at it... here's a very wild before_render hack that changes how not_found is rendered when the format is "txt" :o https://github.com/kraih/mojo/compare/v4.71...master#diff-e2a0c883725613fcc0a693fda7a3d73dR24
18:58 sri intercepts a render call based on template name and changes the arguments
18:59 batman oooh! does that allow me to render another exception template?
18:59 sri sure
19:00 batman is $@ available in the hook?
19:00 sri $self->stash->{exception}
19:00 sri it's even documented
19:01 batman sweet
19:01 batman i now like before_render as well :)
19:01 sri :D
19:03 batman i would really like to render different exception templates based on the exception object/message
19:04 batman i could even throw https://metacpan.org/pod/HTTP::Exception
19:04 batman instead of just dieing
19:05 sri my first though was custom json not_found/exception responses with ->accepts('json')
19:05 sri $args->{json} = {exception => $self->stash->{exception}} if $args->{template} eq 'exception' && $self->accepts('json');
19:05 batman yeah. makes it cleaner than having templates/exception.json with %= j { error => "yikes" }
19:06 batman +1
19:06 purl 1
19:08 sri few weeks ago i played with around_exception and around_not_found hooks... but before_render is so much more versatile
19:08 sri you just have to grok that you're intercepting a render call that's already in progress
19:09 batman yup
19:09 batman i wonder how long it will take before people what that hook to be async ;)
19:10 sri doubt it
19:11 sri async bridges and around_hooks are more than enough for all use cases i can think of
19:11 batman :)
19:11 sri if you're thinking about reporting exceptions to web services... that's better done from the logger
19:12 trone joined #mojo
19:12 batman i'm not sure what i'm planning. my brain is on powersave mode
19:25 * sri wonders if the accepts method belongs more in Mojolicious::Renderer than Mojolicious::Types
19:26 batman i originally though every method in ::Types that use $c should be moved to ::Renderer
19:26 batman but i haven't looked at it for a while
19:26 sri it has no methods that use $c otherwise
19:27 batman oh.
19:35 good_news_everyone joined #mojo
19:35 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/FA3ueA
19:35 good_news_everyone mojo/master 15ec6c0 Sebastian Riedel: moved accepts method from Mojolicious::Types to Mojolicious::Renderer
19:35 good_news_everyone left #mojo
19:39 good_news_everyone joined #mojo
19:39 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/KaGWWw
19:39 good_news_everyone mojo/master 18b1b05 Sebastian Riedel: documentation tweaks
19:39 good_news_everyone left #mojo
19:40 good_news_everyone joined #mojo
19:40 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/JJ_cxQ
19:40 good_news_everyone mojo/master 24ef5e5 Sebastian Riedel: merged Changes entries
19:40 good_news_everyone left #mojo
19:48 webart joined #mojo
19:49 batman https://github.com/jhthorsen/mojo-redis-timeseries # \o/
20:10 bd bpmedley: no, not really
20:23 dod joined #mojo
20:37 lukep joined #mojo
20:51 webart joined #mojo
21:01 lukep joined #mojo
21:06 mire joined #mojo
21:27 good_news_everyone joined #mojo
21:27 good_news_everyone [mojo] kraih tagged v4.72 at d81c0cc: http://git.io/16jd7Q
21:27 good_news_everyone left #mojo
21:27 sri booyah!
21:45 good_news_everyone joined #mojo
21:45 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/-gEgmw
21:45 good_news_everyone mojo/master b2484c2 Sebastian Riedel: fixed typo in rendering guide
21:45 good_news_everyone left #mojo
22:44 rem_lex|pivo joined #mojo
22:58 bowtie joined #mojo

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