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

IRC log for #mojo, 2017-02-01

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

All times shown according to UTC.

Time Nick Message
00:03 Petru joined #mojo
00:16 litwol sri: thoughts on test2 ?
00:16 litwol ^ open to anyone really.
00:16 litwol mind you, i don't know anything at all about neither test nor test2. i just read about its existense from reddit.com/r/perl
00:26 eseyman joined #mojo
00:59 aborazmeh joined #mojo
01:11 sugar joined #mojo
01:23 bpmedley joined #mojo
01:26 tchaves joined #mojo
01:27 tchaves1 joined #mojo
02:27 sugar joined #mojo
02:47 ilbot2 joined #mojo
02:47 Topic for #mojo is now ???? nom nom | http://mojolicious.org | http://irclog.mojolicious.org | http://code-of-conduct.mojolicious.org
03:27 asarch joined #mojo
03:38 noganex joined #mojo
03:49 zach jberger: are there advantages to WebSockets externally facing?
03:50 zach jberger: I only briefly read about it today, but it sounded like the main advantage was clients becoming servers, which doesn't seem like something I'd expect to happen in a normal situation
05:04 dboehmer_ joined #mojo
05:29 inokenty-w joined #mojo
06:53 dod joined #mojo
06:59 dod joined #mojo
07:17 Vandal joined #mojo
07:21 mishanti1 joined #mojo
07:25 sdeseille joined #mojo
07:33 janus joined #mojo
07:59 AndrewIsh joined #mojo
08:27 kwa zach: Think about them differently. Low latency bi-directional communication *with* your server. e.g., chat server (https://github.com/kraih/mojo-pg/blob/master/examples/chat.pl)
08:36 Petru joined #mojo
08:51 trone joined #mojo
09:05 sugar joined #mojo
09:05 rshadow joined #mojo
09:10 foursixnine joined #mojo
09:17 Petru joined #mojo
09:21 nic just found I have a production box still using v3.72
09:21 * nic waves to 4 years ago
09:36 kwa nic: Time towrite a company-wide document on "upgrade paths". :)
09:38 dod joined #mojo
10:04 nic :)
10:24 rshadow joined #mojo
10:27 HtbaaPi question: Why has Mojo::Util::slurp been deprecated? Calling slurp() is so much more nicer than Mojo::File->new($path)->slurp;
10:28 HtbaaPi same goes for spurt() really
10:28 trone how I add content data to a $tx->req ?
10:29 xdg joined #mojo
10:29 nic trone: I'm not quite clear what it is you're asking
10:30 trone http://www.mojolicious.org/perldoc/Mojo/UserAgent/Transactor#form I see this. but I would add data (the "form" value ) to a pre-builded req
10:30 sri HtbaaPi: path($path)->slurp
10:31 sri trone: interesting idea, i'm open to good proposals
10:32 HtbaaPi sri: ah I see, that's not so bad. Still, I prefered the simple functions. But I guess it's to prevent fragmentation as Util starts to grow?
10:32 HtbaaPi also, in my config files I used app->home->rel_dir, but rel_file will give me the same results?
10:32 sri HtbaaPi: yea, we wanted all file io stuff in one place
10:33 sri HtbaaPi: pretty much, yes
10:34 HtbaaPi sri: ok, because I'm using it to get the relative path to a directory, not a file
10:34 panshin joined #mojo
10:35 sri rel_dir used catdir() instead of catfile(), only difference as far as i know is that catdir() removes trailing slashes
10:35 panshin hi all, all versions of mojo older than 7.27 are no longer available?
10:35 sri they are all on backpan
10:36 nic (and github)
10:37 panshin http://pastebin.com/n93tLyF4
10:38 panshin today all my deployment projects have broken.. :(
10:38 trone sri: I'm reading Mojo::UserAgent::Transactor::tx . I think my idea is about expose generators (_form|_json|...) to the users.
10:38 trone honestly I don't know if is a good idea, but that is the point
10:39 nic panshin: You probably want your own local cache of cpan stuff your projects rely on being able to download
10:40 nic panshin: Have a look at App::opan
10:40 sri panshin: that's your cpan/backpan mirror, not us
10:40 trone about these data content generators, why mojo set the content_type but not the content_length?
10:43 panshin nic: thx for idea, but i have no time to reconfigure it now
10:45 trone I was wrong. conten-length is auto-updated in req.
11:03 sugar joined #mojo
11:22 tchaves joined #mojo
11:33 panshin joined #mojo
11:39 Petru joined #mojo
11:49 sugar joined #mojo
12:28 dod joined #mojo
12:49 marty joined #mojo
12:57 Petru joined #mojo
13:07 bwf joined #mojo
13:10 bwf joined #mojo
13:10 Lee joined #mojo
13:12 sugar joined #mojo
13:13 ugexe joined #mojo
13:19 ksmadsen joined #mojo
13:24 schelcj joined #mojo
13:25 ksmadsen joined #mojo
13:26 bwf joined #mojo
13:32 inokenty-w joined #mojo
13:36 perlpilot joined #mojo
13:44 sugar joined #mojo
13:48 bwf joined #mojo
14:05 dod joined #mojo
14:10 gryphon joined #mojo
14:13 kes joined #mojo
14:16 kes I am trying to change arguments in the around action hook,
14:17 kes but it seems captures are not available yet
14:18 kes $c->param( 'id' ) is still undef
14:18 kes but in the action it is defined
14:19 ashimema joined #mojo
14:22 sugar joined #mojo
14:24 matt_p_ joined #mojo
14:25 matt_p_ I seem to be getting hit by this https://github.com/kraih/mojo/pull/964
14:25 matt_p_ but sri closed the PR as not needed
14:25 matt_p_ what am I doing wrong? It started happening after I made my routes async with Mojo::Pg
14:26 matt_p_ but i also upgraded from 6.34 to 7.22 as well so im not certain thats related
14:37 tchaves1 joined #mojo
14:57 Pyritic joined #mojo
14:59 Petru joined #mojo
14:59 ashimema joined #mojo
15:10 irctc192 joined #mojo
15:10 * jberger reads back, was busy all of last night (US time)
15:10 jberger litwol: Test2 is a great thing from my perspective
15:11 jberger and since it is (effectively) completely backwards compatible, if you don't need to know why, then it never has to affect you
15:12 jberger HtbaaPi: I think generally the move of slurp/spurt from a bucket of utils to a class of file-specific functionality is helpful as we continue to hone mojo into being a useful toolkit
15:13 jberger I'd almost say, ideally we'd like to move even more things from Util to proper places
15:13 jberger (speaking for myself at least)
15:14 litwol *gasp*. wording! it almost implies mojo is not useful already ;)
15:15 jberger heh
15:15 jberger but the other word is "toolkit"
15:15 jberger and that's what I mean
15:16 jberger Mojo and Mojolicious have been very useful web frameworks for a long time
15:16 jberger but I've been of the belief for quite some time that Mojo (and not Mojolicious, which is a web framework implementation on Mojo) could be useful outside of the web
15:16 jberger and we continue to march in that direction, albeit slowly and where well thought out
15:21 blonewolfs joined #mojo
15:24 Dandre1 joined #mojo
15:26 tyldis I use Mojolicious primarily for non-web things, just have the web framework as a handy way to provide an API
15:27 litwol Is there a page that describes .. something like 'success stories', to show what mojolicious /can/ be used for?
15:27 tyldis Very nice since I suck at frontends amd hate doing them. But this way I can just point someone to the API (documented with OpenAPI) and let them do the painful part.
15:28 litwol for example, after years of experience i finally /feel/ i reached a point where i can relatively quickly pick up new technologies.
15:28 litwol but, sadly, i am burdened by poor imagination skills.
15:28 litwol and for the life of me i can't easily figure out what can i use this wonderful tool for...
15:28 litwol other than the projects i've worked on before. which is frankly too late already, cause those old proejcts are done :-p
15:29 sh14 joined #mojo
15:29 tyldis litwol: Not that I am aware of. One use I have is to control a satellite dish for LEO satellites - http://ksat.no is my $orkplace.
15:29 litwol jebus
15:30 litwol that certainly feels more "real" and "relevant" than some websites i'm building :-
15:30 litwol :)
15:30 litwol cool stuff.
15:30 litwol would love to see more.
15:30 tyldis But in reality not ;)
15:30 jberger we have two of the Alexa top 100 sites :-P
15:30 jberger that we know of
15:31 jberger (by we I mean, Mojolicious)
15:31 tyldis I suppose Dancer has one or two there as well
15:31 jberger it might, I don't know
15:32 jberger I know that the BBC did an archival project using Dancer
15:32 jberger but, of course, I don't follow Dancer as closely
15:32 jberger convos is an interesting example
15:33 jberger https://convos.by/
15:33 tyldis My non-web usage was greatly inspired by Convos
15:33 tyldis Replace the IRC part with an antenna, and you are good to go ;)
15:34 jberger ah
15:34 jberger I have a rather silly home-project that I'll be publishing on perltricks soon
15:37 jberger and I forget how much I can say publically about how we use it at $work, but ... a lot ... and in cool ways :-P
15:38 jberger oh and going back to zach from yesterday
15:38 jberger I have no idea what you're talking about :-P
15:38 jberger internal vs external websockets isn't terminology that I understand
15:39 jberger and clients becoming servers doesn't sound right either
15:39 jberger I'm interested in continuing the conversation, but I need to understand first
15:53 sugar joined #mojo
16:23 sugar joined #mojo
16:34 disputin joined #mojo
16:52 dod joined #mojo
16:54 sugar joined #mojo
16:54 zach kwa: what about in the case of something like pandora as an example?
16:55 zach kwa: for the pandora web ui, playing songs from their stuff, would web sockets be a better idea than rest?
17:05 jberger I have no idea how their data streaming works
17:05 jberger websockets are good for when the server is going to push data to the client at unexpected times
17:05 jberger perfect example is a chat brokerage
17:06 jberger a chat can be written entirely on REST calls, but then you have to keep polling for new messages
17:06 sri yes, websockets should be more efficient
17:07 jberger with websockets, the server knows when there are new message that the client is interested in and just pushes them
17:08 sri streaming data on REST apis is always a hack
17:09 sri eventsource might be reasonable enough, but not widely supported
17:11 sri once you break the request/response mold, websockets are better
17:11 jberger its funny, but nothing taught me that better than Galileo, in which I basically implemented req/res on websockets
17:12 jberger the moral of the story, use the right tool for the job
17:19 sri btw. vote! https://github.com/kraih/mojo/pull/1046
17:33 pink_mist *you* vote!
17:33 pink_mist :P
17:34 Pyritic joined #mojo
17:34 matt_p_ sri:  https://github.com/kraih/mojo/pull/964 can you explain your reasoning here?
17:35 matt_p_ I'm getting the warning/error and I don't know why or if its an issue with my code or not
17:46 lluad joined #mojo
17:53 PryMar56 joined #mojo
17:55 sri matt_p_: it was considered a feature request, and didn't receive any votes, so was rejected
18:00 sri pink_mist: asking for more votes because i'm unsure and might give it a -1
18:01 sri easier to let it slide if there's more interest
18:03 kgoess is there a best way to connect a mojo app's logging to syslog?
18:04 kgoess best/commonly used/easiest?
18:05 sri log4perl prolly
18:05 kgoess right on, thanks
18:06 sri which reminds me, foursixnine, did you figure out your log4perl problem?
18:08 jberger kgoess: this is what we do: https://gist.github.com/jberger/961dbf907c7e62586542d7317043014b
18:09 Grinnz there is also https://metacpan.org/pod/Log::Dispatch::Syslog
18:09 jberger Grinnz: that's basically what ours is
18:10 Grinnz right, didnt look at your paste yet
18:10 sri not bad, make it a plugin
18:10 Grinnz ->on(message lets you customize Mojo::Log to log to any logger so that's nice
18:10 sri STDERR for development, syslog for production, i like it
18:10 matt_p_ sri: i seem to be tripping the same warning in my code and i have no idea why, would you have any ideas?
18:10 Grinnz you can also combine it with Log::Any or Log::Contextual, etc
18:11 jberger sri: I probably should, we have copied around that snippet to several projects
18:11 sri matt_p_: no
18:11 matt_p_ im using a delayed response but not calling $c->delay_render; is that necessary?
18:11 sri jberger: do it now!
18:11 sri matt_p_: if you can reproduce it with a minimal test case, perhaps you even have a bug
18:12 jberger I went to see if there was prior art
18:12 jberger found this: https://metacpan.org/source/SHOT/Catalyst-Plugin-Log-Dispatch-0.121/lib/Catalyst/Plugin/Log/Dispatch.pm
18:12 sri matt_p_: can't say, if it's a bug we'll fix it
18:12 matt_p_ aye. problem is i have no idea what mojos even doing with that class
18:12 matt_p_ alright, ill try to figure it out
18:12 Grinnz jberger: that looks way more complicated than necessary
18:12 jberger was just about to say: warning, don't read that if you care about your eyes
18:13 Grinnz jberger: a Log::Any plugin might also be of use, then you can use Log::Any::Adapter to set it to use any logger as the user
18:13 sri catalyst has very different extension mechanisms
18:13 jberger there are already Log::Any adapters
18:13 jberger but they seem to be focused one funneling logging in, not out
18:13 matt_p_ is it possible to do a ?pretty json->pretty encoding? I cant figure out how
18:14 Grinnz jberger: right, that's the other direction
18:14 Grinnz i mean, you could have Mojo::Log use Log::Any and then a Mojo::Log adapter but that's kind of pointless :P
18:14 sri that reminds me
18:14 sri Grinnz: i want perl -MMojo::JSON::MaybeXS=pretty
18:14 sri :)
18:14 Grinnz oooh
18:15 matt_p_ ya, you can monkeypatch Mojo::JSON, but how can you make it driven by uri param?
18:15 jberger why?
18:15 sri testing
18:15 jberger at the command line I pipe to jq .
18:15 jberger and in the browser there are prettifier extensions
18:15 Grinnz i've been wondering if Mojo::JSON in general could be influenced to make pretty output somehow, but i cant come up with a good way
18:16 matt_p_ I was overriding the json template handler but it was removed recently
18:16 sri Grinnz: would prolly cost a lot
18:16 Grinnz i mean just interface wise, is tricky
18:16 Grinnz and then something that Mojo::JSON::MaybeXS could also use
18:17 sri encode_json(..., {pretty => 1})
18:18 matt_p_ that would work
18:18 jberger I thought part of the reason Mojo::JSON was faster was that it didn't have optional functionality
18:18 sri that's correct
18:18 sri which is why i mentioned that i expect it to be expensive
18:19 jberger oh sorry, I missed that line
18:20 matt_p_ you could probably implement pretty with method modifiers on _encode_* .. maybe
18:20 kirby joined #mojo
18:20 jberger ./myapp get /something.json | jq .
18:20 matt_p_ function modifiers in this case
18:21 jberger and in the browser, currently I use https://github.com/tulios/json-viewer
18:21 matt_p_ jberger: it seems unreasonable to make it impossible to do server side
18:21 jberger why?
18:21 jberger you can do it server side if you want
18:22 matt_p_ how? a new handler?
18:22 jberger $c->render(data => Cpanel::JSON::XS::encode_json(\%data)) with some pretty option set
18:22 jberger I don't know how it works, but that does it
18:23 matt_p_ I guess
18:23 jberger I'm not saying I 100% oppose
18:23 jberger and I used to want it
18:23 matt_p_ id rather instruct the json handler to handle json how I want it to (even if that means replacing mojo::json with json::xs)
18:23 jberger but now that I have my tools, I don't need it, and so I'd rather have speed
18:24 matt_p_ yes, agreed, which is why I want to control it with ?pretty uri param
18:24 jberger I bet that could be a plugin fairly easily
18:25 matt_p_ https://metacpan.org/source/SRI/Mojolicious-7.23/lib/Mojolicious/Renderer.pm#L107
18:25 matt_p_ how do you introduce the request into this?
18:26 Grinnz use JSON::MaybeXS; $c->render(data => JSON->new->pretty->utf8->encode(\%data));
18:26 Grinnz would be how to do that
18:26 jberger http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Adding-a-handler-to-generate-binary-data
18:26 Grinnz you'd also need to set the content-type header
18:28 jberger I'd probably add a handler named pretty_json or some such
18:28 jberger and then you could optionally upgrade the handler in the before_render hook
18:29 jberger so if you forgot and used "json" rather than "pretty_json" it would notice and fix it
18:29 matt_p_ jberger: ok, thanks
18:29 jberger but again, consider if you really need to
18:29 jberger I used to want it
18:29 jberger but now I can pretty any json I want, and it doesn't cost my server anything
18:33 sri jberger: when you work with people and want to show them something by pasting a url, you want to turn on pretty json for the server
18:34 sri that's my use case
18:34 sri i don't want to tell them to install prettify tools
18:35 jberger well, that's true
18:35 jabberwok joined #mojo
18:35 jberger actually, in that case, a plugin might be really nice
18:36 jberger $app->plugin('Mojolicious::Plugin::Pretty::JSON') if $app->mode eq 'development' || $app->config('pretty');
18:36 jberger or some such
18:36 jberger anyway, I don't actually care as much as it seems like right now :-)
18:37 jberger all I meant to say is that I've found that I don't need it as much as I thought, others certainly will have a different experience
18:38 sri all implementations i cna think of cost performance
18:38 sri just "perl -MMojo::JSON::MaybeXS=pretty" is free
18:39 sri a before_render that checks $c->req->url->query->param('pretty_json') would be cute, but rather expensive
18:53 sugar joined #mojo
19:06 sri oh, the expanse is coming back with season 2 today :o
19:16 marty_ joined #mojo
19:16 howitdo joined #mojo
19:19 pink_mist today?! awesome :D
19:40 janl joined #mojo
19:45 bpmedley Have y'all seen the grid stuff in latest chrome?
19:46 bpmedley https://developers.google.com/web/updates/2017/01/css-grid
19:53 mcsnolte joined #mojo
20:52 disputin joined #mojo
20:55 disputin joined #mojo
21:00 disputin joined #mojo
21:03 tchaves joined #mojo
21:17 marty joined #mojo
21:42 sri not sure i like the new topics feature on github https://github.com/kraih/mojo
21:43 Grinnz huh, did you add those or did they come from somewhere
21:43 tianon that's kind of a distracting place to put those :/
21:43 sri i added those
21:43 Grinnz yeah not sure it really belongs there
21:49 sri hmm, so we've got 5 votes? https://github.com/kraih/mojo/pull/1046
21:49 stephan48 tianon: i agree
21:49 sri oh, didn't know you could request reviews for pull requests
21:50 stephan48 interesting feature actually
21:50 sri batman refuses to review
21:51 tchaves joined #mojo
21:52 Dandre joined #mojo
21:58 tchaves joined #mojo
21:59 jberger IIUC batman isn't very available atm
21:59 * sri shakes batman
22:02 ksmadsen joined #mojo
22:04 jberger I wonder if tempire would have an opinion?
22:07 disputin joined #mojo
22:12 sri well, he is now added as a reviewer
22:12 sri actually, as an experiment i'll add us all as reviewers
22:13 sri jberger: accidentally reset your accept
22:15 sri those reviews actually make it easy to have formal votes
22:15 stephan48 yea, you can easily see who should vote, who has voted and what their opinion was.
22:15 pink_mist yeah, that's great
22:16 sri jberger: please approve again :)
22:16 sri oh
22:16 sri i can do that
22:17 bpmedley sri : Should real-time be added as a topic feature?
22:17 sri bpmedley: no
22:17 nic it all looks fine till foreign malevolents hack the voting and suddenly there's a 52% majority for rewriting everything in python
22:18 sri we'll build a wall!
22:19 sri and make guido pay for it!
22:19 nic and make python pay for it
22:19 stephan48 you forgot fake news.
22:19 nic stephan48: see any of my previous posts in this channel
22:20 stephan48 if it was not so sad it would be material for a good comedy :D
22:22 sri this comes to mind http://www.theonion.com/article/fbi-uncovers-al-qaeda-plot-to-just-sit-back-and-en-35788
22:22 Grinnz heh
22:23 nic :D
22:23 bpmedley Gaw, we're the comic relief for the rest of humanity these next 4 years..
22:26 preaction is it bad that i hope, hope, hope that we're only a comic relief for 4 years?
22:28 Grinnz that depends on whether any election reform actually happens, and the major parties get their heads out of their collective behind
22:28 Grinnz the DNC got quite a wakeup call so it's possible
22:29 Grinnz the RNC would have, but trump made up with them
22:39 Petru joined #mojo
22:53 jberger looks like I've still been marked as approved
22:54 dikim joined #mojo
22:54 litwol This is depressing to read :-\ https://www.reddit.com/r/perl/comments/5nuxif/i_just_dont_get_it_why_is_devops_going_python/?st=iynjvfbj&sh=ce9559f7
22:54 jberger Google+ for the first time in forever sent me an email informing me of G+ posts I might like
22:54 jberger and it was such a rare occurance that I looked
22:55 jberger and guess what the account that sent it was?
22:55 jberger the official Android G+ account
22:55 jberger sigh
22:56 jberger litwol: yeah, I commented
22:57 bpmedley jberger : Is that a case of cat chasing its own tail?
22:57 jberger I only partially agree with my own statement, sysadmin/devops still should be very text-centric and the python I see written to do that always feels bolted on
22:57 jberger bpmedley: its a case of only google uses google+
22:57 litwol last 2 sentenses really nail it
22:57 jberger http://meme-lol.com/wp-content/uploads/meme/2014/12/--Social-Media-MEME-2015.jpg
22:58 litwol lol
22:59 Grinnz jberger: needs a tumblr one... "Here's an animation of a donut eating a donut"
23:00 jberger I was just thinking that post-election that thing should be updated with Twitter: Donuts are destroying this country!
23:00 Grinnz hahah
23:00 jberger actually even that sounds too food-centric
23:00 jberger maybe, Twitter: Donuts are for nazis
23:16 sri i hope this gem ends up in the history books https://twitter.com/realdonaldtrump/status/332308211321425920
23:18 Grinnz rofl
23:20 jabberwok Mr Trump has the haters by the nose.  Apparently nobody has a sense of humo(u)r anymore.
23:21 jabberwok “The whole secret lies in confusing the enemy, so that he cannot fathom our real intent.” -- Sun Tzu
23:24 marty joined #mojo
23:25 kermi joined #mojo
23:26 mswayne joined #mojo
23:26 mswayne Howdy, folks.  I was wondering if you could give me a hand with a problem.
23:27 bpmedley mswayne : Sure, we will try and help.
23:27 mswayne I am trying to add CORS headers to statically served files
23:28 mswayne I added the SecureCORS plugin and first tried to apply really liberal rules to all routes $app->routes->to( 'cors.allowfrommumble' => '*' )
23:29 mswayne OK:  Actual code:    my $r = $self->routes;   $r->to(qw/         cors.credentials        1         cors.origin             *   /)->cors();;
23:29 mswayne eff this client.
23:29 mswayne I hope that came through in a readable fashion.
23:30 Grinnz you can use gist.github.com to paste code
23:30 mswayne I really want to have something regex based, but for now, I would be happy with cors.origin * working.
23:32 mswayne https://gist.github.com/daotoad/af7ce353b2b66f0939f808e061c49c67
23:32 mswayne That's the startup from my toy/test app.
23:33 mswayne Here's the plugin I am trying to put to use: https://metacpan.org/pod/Mojolicious::Plugin::SecureCORS
23:35 jberger mswayne: I'm not familiar with that plugin, but I don't think you are using it correctly either
23:36 jberger though I could be wrong
23:36 jberger ->cors() looks funny
23:36 mswayne I tried adding that.  But it seems to behave the same with or without it.
23:38 jberger from my quick look at that api, I'd try setting those keys in the app's defaults
23:38 jberger (which is just opening it up, but you said that this is a first cut to get it working)
23:39 jberger you might want to check out the routes command on your app to see if OPTIONS routes have been added
23:40 jberger hmmm, the cors method there is a router shortcut
23:40 jberger an interesting choice
23:42 jberger wow, it re-walks the route tree to determine ... something?
23:42 tchaves joined #mojo
23:42 jberger I don't grok this plugin
23:44 mswayne cors('path') is supposed to enable the OPTIONS requests
23:45 jberger mswayne: can I ask a question that may sound condescending but I don't mean it that way
23:45 jberger have you done cors before / do you know how cors works?
23:45 jberger because how I help you will be very different depending on the answer
23:45 mswayne Yes, and I hate it because it feels backwards.
23:46 jberger hating cors is a good sign for understanding it yes
23:46 mswayne Don't worry about condescending.  I know I suck and can be stupid far too frequently.  But I own that
23:47 mswayne I'm trying to get cross domain webfonts working (served from inside a plugin).  And before you say "Don't do that", I'd love to have things simple.
23:48 mswayne But I have a big mess of intertangled webapps that all want to talk to each other and do weird frame things to each other.
23:48 mswayne I just want consistent styling...
23:48 jberger well, I'm not going to condescend even if you are humbly self-deprecating
23:48 jberger looking through this plugin, the only thing I can say is that it doesn't do things in a very idiosyncratically mojolicious way
23:49 mswayne Darn it.  I should have been all defensive and insulting.  I always miss these social queues.
23:49 * jberger punches mswayne in the teeth
23:49 preaction cues* :p
23:49 jberger too far?
23:49 * mswayne spits blood
23:50 mswayne I'm no mojo master, by a long shot.  But should I just write my own?
23:50 jberger in the end are you going to want CORS on lots of routes or just a few?
23:50 jberger I think I'm going to encourage you to write a simple cors handler in your app
23:50 jberger honestly that's what I've usually done
23:50 mswayne I haven't swallowed enough of the code to be sure.  I know I am going to need to have it work in the context of a plugin
23:51 mswayne and be repeatable
23:51 jberger as I'm sure you've seen, the other CORS plugin isn't really useful either
23:51 mswayne Yeah.  It's a prize.
23:51 mswayne I mean, if you just want to turn cors on and don't care about people using your assets, it's fine.
23:52 mswayne Say if you're making a CDN
23:52 mswayne Otherwise, just asking for it.
23:53 mswayne So, to wrap some lovely CORS headers around my content, roughly speaking, what's the right way to go.
23:54 mswayne That looks like a declarative, but it's really interogative.  My fingers got ahead of my brain.
23:55 jberger so, you could make a toplevel catchall route that handles options
23:55 mswayne Can I just do $r->options('/*)->to( handler => 'somemethod' ); ?
23:56 jberger $r->options('/*everything')->to(controller => 'MyController', action => 'cors_handler');
23:56 jberger yeah
23:56 jberger your * needs a name still
23:57 jberger I mean, you can do it inline with cb => sub { ... } too if you want
23:58 jberger part of the reason that plugin is so strange is that it is trying to kinda let you define the cors behavior by route while still kinda letting it be global
23:58 jberger the more I think about it, the more I understand why the plugin is the way it is
23:58 jberger hmmmm
23:59 mswayne I need to be able to be all corsy on GET requests too
23:59 mswayne because preflight is only half the stupid.
23:59 mswayne I mean spec

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