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

IRC log for #mojo, 2016-02-25

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

All times shown according to UTC.

Time Nick Message
01:26 bradjm joined #mojo
01:26 zivester joined #mojo
01:51 bradjm joined #mojo
01:59 acamari joined #mojo
02:24 bf joined #mojo
02:55 sri ohoh, looks like Mojo::Util::files has windows bugs
02:55 sri http://www.cpantesters.org/cpan/report/e73fb988-6bf3-1014-a4f1-6ad0780c26e1
02:59 sri so, does File::Find always use a slash on windows too?
03:02 noganex joined #mojo
03:09 good_news_everyon joined #mojo
03:09 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v28gw
03:09 good_news_everyon mojo/master d20f2a4 Sebastian Riedel: normalize paths for comparison
03:09 good_news_everyon left #mojo
03:09 sri think it has to be like that, windows testing would be appreciated
03:31 mcsnolte joined #mojo
03:40 meredith i just dropped in strawberry 5.20.1.1 and cloned mojo @ d20f2a4 and t/mojo/util.t passes the test in question, but i think something else may be weird with this setup because a bunch of content-check tests fail but comparisons look the same, making me think i've got something weird with encoding here
03:42 sri Oo
03:44 sri meredith: does the commit before that fail?
03:48 meredith yeah.  and v6.48/7, so i'm thinking it's just something here.  i don't generally do perl on windows, and just lazily installed what was available on a package manager.  i'll try with the current release
03:49 sri and the util.t test does fail before the change too?
03:54 meredith actually didn't wait that long before hitting ctrl-c on the tests, since they started to fail early.  i've already removed that version and dropped in 5.22.1.2
03:55 meredith and i'm observing the same behavior.  maybe it's me
03:56 meredith that said, i can confirm the test fail @ line 435 on commit 21c34d8, and no more at d20f2a4
03:56 sri \o/
03:56 sri meredith++
03:59 noganex_ joined #mojo
04:03 meredith oh i bet i know what's up.  git dinked with line endings "helpfully"
04:03 meredith i do all my dev work on unixes so i'm not used to the pitfalls
04:09 meredith alright, there we go. fully passing at d20f2a4
04:09 meredith now i have core.autocrlf = false in my global config too, at least
04:17 zivester joined #mojo
04:41 inokenty-w joined #mojo
04:42 flingtoad left #mojo
05:17 melo joined #mojo
06:00 bf joined #mojo
06:02 GnuYawk joined #mojo
06:02 GnuYawk Hey guys! Is it possible to redirect to a url using POST instead of GET?
06:22 Mikey it will follow a redirect response with a GET but depends on the browser implementation i'd bet
06:24 Mikey if i were you i'd give it a try in IE, Firefox, and Chrome and see if it works for what you're trying to do
06:24 Mikey status code 307 is supposed to redirect w/ the same method and data if that's what you're trying to do
06:26 jberger GnuYawk: http://programmers.stackexchange.com/q/99894/206817
06:27 jberger ah Mikey beat me to it
06:27 jberger yes, POST redirects as GET using common redirection status codes, but using 307 it won't
06:27 Mikey its one of those grey areas where browser vendors are likely to deviate from RFC for security reasons
06:27 Mikey but who knows.
06:28 Mikey it'd certainly be easy to justify a decision to not implement 307
06:28 jberger https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection
06:28 jberger see 307/308
06:29 jberger note also that mojo can let you override the method using a _method query parameter
06:29 jberger http://mojolicious.org/perldoc/Mojolicious/Guides/Routing#HTTP-methods
06:30 jberger so I imagine you can use that as a kind of fall-back for unruly browsers
06:32 GnuYawk joined #mojo
06:36 GnuYawk jberger, the _method query parameter is great! thank you! seems to be exactly what i was looking for
06:42 jberger I'd try 307 or 308 statuses too
06:42 jberger It really is "the right way to do it" if possible
06:42 jberger But I'm glad something will work for you
07:01 bf joined #mojo
07:30 dod joined #mojo
07:32 taichi joined #mojo
07:33 Floyd-ATC ugh... finally sorted the utf8 problem and it was more stupid than I had imagined
07:33 Floyd-ATC I had changed the default charset for the tables but the column was still tagged as latin1 *facepalm*
07:34 taichi joined #mojo
07:36 dod joined #mojo
07:36 Floyd-ATC About the post/redirect issue, don't rely on it working
07:37 taichi joined #mojo
07:37 Vandal joined #mojo
07:38 Floyd-ATC I needed to redirect a post containing an uploaded file and there were so many concerns I ended up solving it with a javascript hack on the client side
07:53 taichi joined #mojo
08:02 bf joined #mojo
08:04 taichi joined #mojo
08:06 dod joined #mojo
08:15 AndrewIsh joined #mojo
08:15 berov joined #mojo
08:25 trone joined #mojo
08:43 ashimema I'm sure I read somewhere about increasing workers and decreasing connections or somesuch when you have blocking code.. for hypnotoad that is.. but I can't lay my fingers on it.. anyone fancy pointing me at the doc page if the happen to know where it is?
08:45 taichi joined #mojo
08:47 ashimema hmm.. perhaps this was it: http://mojolicious.org/perldoc/Mojo/Server/Hypnotoad#workers  thouhg I thought there was a more in depth explanation somewhere.  Oh well, it's a short term fix whilst I work out how to make this non-blocking anyways
08:47 taichi joined #mojo
09:03 bf joined #mojo
09:04 taichi joined #mojo
09:06 taichi joined #mojo
09:06 osfabibisi joined #mojo
09:08 kes joined #mojo
09:12 nic ashimema: I haven't checked, but perhaps it gets mentioned also on the wiki's performance page
09:12 taichi joined #mojo
09:30 n16gel joined #mojo
09:48 trone joined #mojo
10:01 CandyAngel Candy's tip for the day! Don't do this: http://codepad.org/lt7l2JdW
10:04 ashimema ah.. that could be it nic
10:04 bf joined #mojo
10:04 ashimema I have a love/hate relationship with the mojo docs
10:04 ashimema when I can find what I wan't they tend to be pretty darn good..
10:04 ashimema but i often can't find them
10:12 mdom joined #mojo
10:19 melo joined #mojo
10:22 denny joined #mojo
10:26 n16gel joined #mojo
10:56 n16gel joined #mojo
11:04 bf joined #mojo
11:25 batman ashimema: kill TTIN or kill TTOU $hypnotoad_pid
11:25 batman https://metacpan.org/pod/Mojo::Server::Hypnotoad#MANAGER-SIGNALS
11:27 nic heh, I keep forgetting those exist, which is daft considering how awesome they are
11:27 * ashimema is lost by that comment
11:28 ashimema nope.. still confused
11:30 ashimema What I 'think' I was thinking about was upping workers adn dropping clients to 1.. so, for now I've 'fixed' the performance of my poorly written app but setting workers => 200, clients => 1
11:30 batman ashimema: oh. i thought you wanted to dynamically increasing number of workers
11:30 ashimema that'll keep the customer happy for a little while whilst in testing
11:31 ashimema and whilst I re-examine my reliance on DBIx::Class which is of course blocking
11:32 ashimema If I were a clever man, I'd likely work out some magic to do it dynamically without inadvertantly making the system fall over..
11:32 ashimema but I'm not feeling too clever at the moment.. so have a feeling I'd end up dong something widly wrong using those at the minute ;)
11:32 nic I have an important app that has deveoped a conflict of interests
11:33 nic There are users viewing realtime business-critical data
11:33 nic and now there are other users doing big blocking ops like uploading/transferring large files
11:34 batman ashimema: i would figure out which of the dbic queries that's super slow and 1) fix them 2) fork them off using Mojo::IOLoop::ForkCall
11:34 nic (or other examples where the worker is blocked by say a 3rd party interface)
11:34 batman preferably #1 with indexes or caching
11:34 batman and then when you write new stuff, use Mojo::Pg, Mojo::mysql, ... if you can
11:34 nic I'm thinking I should have a throttle, to spit out "sorry, there are already much peeps using this [blocking] service, please try later"
11:34 ashimema I've done allot of fixing the dbic calls..
11:35 ashimema aha.. Mojo::IOLoop::ForkCall was what I was currently searching for though :)
11:35 ashimema I should probably bite the bullet at some point and throw away dbic and use Mojo::Pg instead..
11:35 ashimema I have a love hate relationship with dbic..
11:35 nic Ideally I'd split the app into realtime and leisurely, but I don't think that's an option in this case
11:36 denny nic: I was about to say, can't you hand the blocking things off to a queue or similar
11:36 ashimema it's made my development so much faster.. but I'm paying for it now by having to do lots of optimising
11:37 ashimema denny snap
11:37 batman i don't have a hate relationship with dbic, it's just that it's simply not non-blocking, so it doesn't fit in the way i program anymore
11:37 batman (in 99.9% of the cases)
11:37 vanHoesel joined #mojo
11:37 ashimema yeah.. dbic is still awesome for allot of my uses..
11:37 pink_mist ohh, fork it and make DBIx::Class::Async :P
11:38 ashimema just doesn't play too nice with non-blocking frameworks..
11:38 ashimema haha.. If I even had the fantest idea how to do dbic::async.. I would ;)
11:38 nic I think one commonly used approach is to use a satellite server, so eg, file uploads go from client's js directly to additional service [cors]
11:39 ashimema though to start.. I was thinking of just piling SQL::Abstract onto Mojo::Pg.. as that accounts for allot of my usage..
11:39 ashimema though i'm sure I'd quickly find I'm using way more relationships that I initially thought ;)
11:48 kaare joined #mojo
12:05 bf joined #mojo
12:07 dragos batman: You're missing a semicolon at the end of https://metacpan.org/source/JHTHORSEN/Mojo-APNS-0.07/lib/Mojo/APNS.pm#L30
12:10 batman dragos: thanks.
12:11 batman not enough to make a new release, but i fixed it upstream: https://github.com/jhthorsen/mojo-apns/commit/8bc064f5df5b670dae7cb0ad2ecd514d6b7e336c
12:32 dragos batman: Got a question regarding your Mojo::APNS package.
12:35 dragos batman: Will try to explain, but you have to deal with me, I'm not exactly sure how to explain it. I am getting Mojo::Reactor::Poll: I/O watcher failed: Can't locate object method "loop" via package "Mojo::APNS" at lib/VoApns.pm line 30. That's where $apns->on(drain => sub { $apns->loop->stop }); is. I thought maybe it should be ioloop, not loop. That error stopped, but now I am getting Mojo::IOLoop already r
12:35 dragos unning at lib/VoApns.pm line 37. Which is where the start is $apns->ioloop->start;
12:36 batman dragos: oh! another typo :(
12:36 batman it should have been $apns->on(drain => sub { $apns->ioloop->stop });
12:36 dragos batman: So I guess it never stops and the on=> drain never gets fired since it says it's already running.
12:36 dragos Any idea?
12:37 batman dragos: did you read my answer..?
12:37 dragos batman: Yes, I already said I changed that.
12:38 batman ah. thanks for pointing that out
12:38 dragos batman: After modifying to ioloop I am now getting Mojo::IOLoop already running
12:38 dragos batman: And notification is not being sent.
12:38 batman dragos: are you using this in a Mojolicious application?
12:39 dragos batman: Yes
12:39 batman ok. let me improve the synopsis...
12:39 batman i'll be back soon
12:39 dragos batman: Cheers!
12:40 batman can you read a Mojolicious::Lite example and translate that to whatever you are using?
12:42 dragos batman: Sorry what?
12:43 batman are you writing a Mojolicious full or lite app?
12:43 dragos batman: It's a full app.
12:43 batman ok. so if i write a "lite app" example, will you be able to read it?
12:44 dragos batman: Yeah, sure. I mean, I got it to work - if I don't care about the feedback. If I scrap the ioloop altogether, and it sends. But obviously I'd like to use the feedback.
12:46 dragos batman: If I only use the send method it's fine. Problem appears with that ioloop and Mojo::IOLoop already running.
12:52 asarch joined #mojo
12:54 batman dragos: can you check out the documentation here: https://github.com/jhthorsen/mojo-apns ?
12:54 batman #feedbackwanted
12:55 dragos batman: makes more sense :) allow me to test it and see if I also receive the notification
12:57 batman dragos: sweet! i'll make a new release when you tell me it works/does not
12:57 batman err.. i won't make a new release until it works of course, hehe
13:02 bpmedley dragos : Sorry for my confusion, did you get the Mojo::APNS working under an ioloop?
13:03 batman bpmedley: i think the problem is that the SYNOPSIS told you to start/stop the IOLoop
13:03 batman which should not happen in a mojo app
13:04 dragos batman: It sends the notification, but now I am getting this repeatedly Mojo::Reactor::Poll: I/O watcher failed: Can't call method "emit" on an undefined value at /home/dragos/.plenv/versions/5.20.2/lib/perl5/site_perl/5.20.2/Mojo/APNS.pm line 248.
13:04 bpmedley I see.  Would the situation be easier if Mojo::APNS was ran in a script outside of the app?
13:04 batman dragos: the object probably goes out of scope
13:04 batman bpmedley: no.
13:05 batman dragos: you need to store $apns in $c->stash->{apns} or some other place where it doesn't get garbage collected
13:05 batman dragos: the example uses "state" to prevent that the object goes out of scope
13:06 dragos batman: I used "state" as well, but for some reason I went back to "my". Let me fix that and will provide feedback.
13:06 bf joined #mojo
13:06 dragos bpmedley: Yeah, I am trying to get it to work with a full mojo app.
13:08 dotan_ joined #mojo
13:09 dragos batman: Alright, sorted. That works beautifully.
13:10 bpmedley batman : I can't remember if I ever told you.. I'm using Mojo::APNS, as well.. works awesome.
13:10 batman dragos: sweet!
13:10 batman bpmedley: cool :)
13:10 dragos batman: Not sure if you should keep the old synopsis as well, I imagine not everyone would run it in a Mojo App.
13:13 batman dragos: yeah. added a new version of the old synopsis as well
13:14 * batman goes 1.0 :S
13:15 dragos batman++
13:16 batman thanks all
13:16 batman best reason ever ;) https://github.com/jhthorsen/mojo-apns/blob/master/Changes#L4
13:16 cpan_mojo Mojo-APNS-1.00 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Mojo-APNS-1.00
13:17 dragos batman: Purrfect.
13:18 batman hehe
13:20 ashimema 🐯
13:20 ashimema or should that be 🐈
13:31 arthas joined #mojo
13:35 zivester joined #mojo
13:39 sri anyone disagree? https://github.com/kraih/mojo/pull/916#issuecomment-188788433
13:44 neilhwatson joined #mojo
13:45 dragos batman: I've just tried to install Convos. Got 2 issues with it so far: First carton will fail to install some packages on first run, I had to run it twice.
13:46 batman sri: it sounds sane to me.
13:46 batman dragos: which one?
13:47 batman dragos: nevermind. join #convos on freenode or #batcode on irc.perl.org
13:47 batman (i would prefer freenode)
13:49 sri batman: he's partially right though
13:51 batman sri: yeah. i looked at the spec, which seems to be in favour
13:51 batman why do you say "partially" ?
13:52 sri because he wants to generate input elements like <input name=foo type=checkbox value=on>
13:52 sri that's actually wrong
13:52 sri the spec defines the default value if there is no value attribute
13:53 arthas joined #mojo
13:53 sri <input name=foo type=checkbox>
13:53 batman oh. does that mean that the browser should actually handle this part?
13:54 sri yes
13:55 arthas joined #mojo
13:55 batman right... this is really why i didn't comment. my head is not quite in the right place today :/
13:56 batman then i'm -1 on the pr
13:56 batman it actually makes a lot of sense when i think about it
13:57 sri i'm making a different patch
13:58 batman sri: not sure if it really needs fixing
13:59 batman i don't get why the programmer can't simply specify value if that is really important
13:59 good_news_everyon joined #mojo
13:59 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v245d
13:59 good_news_everyon mojo/master 127b20d Sebastian Riedel: the value attribute is optional for checkbox and radio input elements (closes #916)
13:59 good_news_everyon left #mojo
14:01 ramortegui joined #mojo
14:02 batman sri: nice :)
14:02 batman took some time before i got it
14:03 sri now i'm curious, does the jquery method .val return "on"?
14:09 batman sri: seems like it: https://codepen.io/anon/pen/XdraYX
14:09 good_news_everyon joined #mojo
14:09 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v24Fj
14:09 good_news_everyon mojo/master fe02d51 Sebastian Riedel: a few more tag helper examples
14:09 good_news_everyon left #mojo
14:09 sri batman: i suppose Mojo::DOM::val needs a new special case
14:09 batman makes sense
14:15 sri ouch, 3 lines
14:18 melo joined #mojo
14:24 vicash hello. what is the current best practice to automatically auto-refresh a page every few seconds to get most recent data ? I have a background job running through Minion that sends periodic status updates which are written to a database. Refreshing the page gets the latest update. Should I use Ajax or just a javascript refresh call ?
14:27 batman vicash: i would poll the backend through an api and the just update parts of the page
14:28 batman but if you want to refresh the whole page, you can use meta refresh or javascript
14:30 batman and there's probably a gazillion hits on stackoverflow for that :)
14:30 ashimema or open a socket and send data as it appears rather than poll at all?
14:30 ashimema minion notifier comes to mind?
14:30 ashimema unless I'm misunderstanding the use case ;)
14:32 Floyd-ATC Do minion jobs also have to be non-blocking or can I use minions to do blocking jobs in the background?
14:32 vicash batman, ashimema: ok. thanks. i will try it out
14:33 batman Floyd-ATC: you can't wait for a minion job
14:34 Floyd-ATC My current solution is to start two threads (pcap + seen) before starting mojo, the pcap makes callbacks to populate a hash which the 'seen' thread will POST to mojo on regular intervals
14:35 bf joined #mojo
14:35 Floyd-ATC can I use minions for this instead?
14:35 good_news_everyon joined #mojo
14:35 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v24hN
14:35 good_news_everyon mojo/master 7df1f8d Sebastian Riedel: handle "on" default values in Mojo::DOM as well
14:35 good_news_everyon left #mojo
14:36 sri minion jobs are finite
14:37 sri halp! this needs golfing https://github.com/kraih/mojo/commit/7df1f8dd903e05cb65dd0a02e2a8d0788a462ba1#diff-24fe40937fb0bc295d664900b1a94f0eR168
14:38 ashimema golfing.. that's a new term to me
14:38 sri https://en.wikipedia.org/wiki/Perl#Perl_pastimes
14:38 sri perl golf
14:38 Floyd-ATC achieve the same thing with less (key)strokes
14:38 ashimema haha.. I see
14:38 ashimema coolios.. learn somthing new every day :)
14:39 sri so, who can make it use less than 3 lines
14:39 sri changing the other lines in the method is fair game too
14:40 sri test coverage is very good, so don't be afraid ;p
14:41 batman sri: return $self->{value} // 'on' if $tag eq 'input' && grep { $self->{type} // '' eq $_ } qw(checkbox radio);
14:41 batman that line is too long, so it only saves one line...
14:44 sri batman++
14:44 sri please commit
14:44 batman okidoki!
14:44 sri (just commit again if you find something even shorter)
14:48 good_news_everyon joined #mojo
14:48 good_news_everyon [mojo] jhthorsen pushed 1 new commit to master: https://git.io/v2Bvp
14:48 good_news_everyon mojo/master a6b7d85 Jan Henning Thorsen: Shaving off one line of code
14:48 good_news_everyon left #mojo
14:48 batman sorry... couldn't come up with anything better except removing comments, hehe
14:53 Lee isn't there a precedence issue there?
14:54 sri surprisingly not
14:54 sri was my first thought too
14:55 batman do you mean it should require "and" instead of "&&" ?
14:55 sri ($self->{type} // '') eq ...
14:55 batman oh
14:55 Lee yeah, parens around the defined or
14:55 Lee bitten me in the past, guess it doesn't matter in this case :)
14:56 sri normally you get undefined value warnings
14:56 mcsnolte joined #mojo
14:56 sri i have no idea why that's not the case here
14:58 sri funny thing
14:58 sri if you switch the variables you get the warning
14:58 sri $_ eq $self->{type} // ''
15:00 good_news_everyon joined #mojo
15:00 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2BTs
15:00 good_news_everyon mojo/master cafe941 Sebastian Riedel: for is a little faster than grep
15:00 good_news_everyon left #mojo
15:05 denny Still trying to figure out where my file is going, btw: http://pastebin.com/TRQV3wn4
15:06 romel joined #mojo
15:13 batman denny: didn't know you could use $self->req->param( 'file' ) though you had to use upload()
15:13 denny I tried that too.
15:13 denny There are examples online which use both
15:13 denny I notice there's an uploads => {} in the dump
15:13 batman "online"...?
15:14 taichi joined #mojo
15:18 inokenty-w joined #mojo
15:41 zivester joined #mojo
15:54 gryphon joined #mojo
15:54 oliver_ joined #mojo
15:54 oliver_ hello
15:54 romel hey
15:55 sri o/
15:55 oliver_ how do I emit a custom event in Mojoliciou::Lite application?
15:55 Grinnz_ depends, what would be consuming the event?
15:55 oliver_ (not sure I am asking the right thing)
15:56 oliver_ Grinnz_: controller object
15:56 Grinnz_ https://metacpan.org/source/SRI/Mojolicious-6.48/examples/chat.pl
15:57 oliver_ thanks
15:57 Grinnz_ note this only works in a single process. if you want to do something similar in a prefork server or hypnotoad you may need to do pubsub over pg or redis
15:58 CandyAngel .. I don't even need to inherit from Mojo::EventEmitter..
15:59 oliver_ Grinnz_: well the process is going to be emit events to himself that should do right?
16:00 Grinnz_ sure...
16:01 sri maybe make it a hook?
16:02 sri app->plugins->emit_hook(foo => ...)
16:09 CandyAngel What's the difference between hooks and emitted events?
16:10 sri scope
16:11 sri emitted events are specific to a certain object
16:11 sri and should generally come from inside the object
16:11 sri hooks are an application wide api
16:11 CandyAngel Ah okies, thank you
16:21 dhg joined #mojo
16:22 dh7320 joined #mojo
16:23 asarch joined #mojo
16:24 dh7320 joined #mojo
16:38 bf joined #mojo
16:40 bf joined #mojo
16:40 bradjm joined #mojo
16:43 denny batman: ran back across that online example that uses param instead of upload... http://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial#File-uploads
16:45 Grinnz_ https://metacpan.org/pod/Mojolicious::Controller#param
16:46 Grinnz_ personally i prefer asking for uploads explicitly
16:46 Grinnz_ for example if someone passes a GET parameter with the same name as the upload you'll end up getting that instead...
16:46 jberger the uploads objects just have some nice things like file name etc
16:47 jberger rather than mucking with Content-Disposition
16:47 denny do they have mimetype?
16:47 Grinnz_ $self->req->param to access an upload is incorrect though. it does not retrieve uploads
16:47 Grinnz_ only the controller param method does
16:48 denny yah, I got mixed up between all the different things I was reading, apparently
16:48 Grinnz_ denny: https://metacpan.org/pod/Mojo::Upload#headers
16:48 Grinnz_ whether a content_type gets included with uploads usually, no idea
16:57 * denny finishes a few hours of changing all his code and arrives back at the same error he had this morning
16:57 denny lol
16:57 denny oh well, at least I saw some other errors along the way
16:57 denny the scenic route
17:01 AndrewIsh Does anyone know if it's possible to configure morbo to return additional headers (this is in relation to CORS)
17:02 AndrewIsh I don't particularly want to do it in the application
17:02 AndrewIsh And I don't (currently) have anything sitting in front of Morbo (this is my dev environment)
17:02 denny I just added $self->plugin( 'Mojolicious::Plugin::CORS' ); to my startup()
17:02 denny why don't you want to do it in the app?
17:02 Grinnz_ https://metacpan.org/pod/Mojolicious#after_dispatch perhaps
17:03 Grinnz_ wait, headers would have to go before the render
17:03 AndrewIsh denny: because in my production environment that's all handled by Apache
17:03 Grinnz_ https://metacpan.org/pod/Mojolicious#before_dispatch if you want to do it for both static and dynamic routing
17:04 AndrewIsh denny: if i have it in the app too, they'll get sent twice
17:04 denny I'd be tempted to throw a dev flag in there
17:04 denny I'm lazy.  :)
17:04 Grinnz_ so do it in development mode only
17:04 AndrewIsh Grinnz_: Ah, good idea!
17:05 AndrewIsh Grinnz_: Why didn't I think of that, nice idea, thanks :)
17:05 denny there's a built-in dev mode flag?
17:05 AndrewIsh Grinnz_: Thanks for the pointer to before_dispatch too :)
17:05 Grinnz_ https://metacpan.org/pod/Mojolicious#mode
17:05 AndrewIsh denny: mode
17:06 Grinnz_ hypnotoad defaults it to production mode
17:06 denny handy
17:06 Grinnz_ i honestly don't know if you'd be able to set response headers in before_dispatch, ive never tried anything like that
17:13 sri actually odd we don't have $app->is_mode('development'), since we do have $app->log->is_level('debug')
17:15 AndrewIsh Grinnz_: That worked perfectly, thanks very much
17:16 AndrewIsh Grinnz_: Setting response headers in before_dispatch is indeed possible
17:23 denny is it just mode => 'development' in myapp.conf to override it?
17:24 denny it'll DTRT here for dev and production, but stage is hypnotoad with debugging output, so I'll need to override it for that
17:25 good_news_everyon joined #mojo
17:25 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2B7Z
17:25 good_news_everyon mojo/master 9e483e2 Sebastian Riedel: a response does not need to be rendered
17:25 good_news_everyon left #mojo
17:26 Grinnz_ denny: it won't set the mode from config unlessyou do that yourself
17:26 Grinnz_ you can set it via the --mode switch for some commands, or MOJO_MODE in the env
17:26 denny okay, thanks
17:27 denny I'm running from inside a docker container on stage and production, so the config file is my preferred route to affect things inside the box
17:27 Grinnz_ also, if you just want debugging output you don't have to set development mode, you can also just set MOJO_LOG_LEVEL=debug
17:27 denny I'll just look it up and flick the switch
17:27 denny I use it for other stuff too - disabling self-cert fails for SSL, etc
17:27 Grinnz_ right, if you want other development-mode stuff then the mode works
17:28 denny I'd basicaly rolled my own flag, but I'd rather do things the usual/idiomatic way whenever possible
17:28 denny for the sake of whoever has to pick this code up when I'm gone  :)
17:38 denny I guess it's about hometime here
17:38 denny Thanks for all the guidance today people  :)
18:03 trone joined #mojo
18:07 lluad joined #mojo
18:09 good_news_everyon joined #mojo
18:09 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2Bj4
18:09 good_news_everyon mojo/master a3d3fcc Sebastian Riedel: filter attributes a little more efficiently
18:09 good_news_everyon left #mojo
18:11 good_news_everyon joined #mojo
18:11 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2BjM
18:11 good_news_everyon mojo/master d960032 Sebastian Riedel: just use values
18:11 good_news_everyon left #mojo
18:11 sri hehe, my perl-fu is still a little weak in this area
18:12 sri in my mind keys/values are always random order
18:14 bf joined #mojo
18:32 jberger right, they are but they guarantee that the calls of keys and values will be in the same order during that execution (and probably while you don't modify the structure)
18:34 sri yea, i don't take advantage of that for slicing enough yet
18:37 sri OMG
18:37 sri there's a new puscifer album and i missed it completely
18:38 sri bummer yko is not around anymore, he would have reminded me :/
18:39 Adura Wonder if Taxi drivers in Germany hate Super...
18:40 genio I've never heard of any of those
18:58 sri what is "Super"?
18:59 Adura My assumption on the translation of Uber.
18:59 sri is uber an english word?
18:59 mspo no
19:00 sri yes, german taxi drivers hate uber
19:00 sri there's lawsuits going on like anywhere else in the world
19:00 Adura sri, the joke killer.
19:01 meredith never really educated on german here but the vibe i got is that uber is best approximated to over / above
19:01 Adura As is super.
19:01 preaction that joke needed to be put out of its misery anyway
19:01 sri https://i.imgur.com/IjHUeOM.png
19:01 preaction sri, the bringer of comedic mercy
19:01 Adura Don't you meme me.
19:02 meredith what if we make a service worse than taxis called unter
19:02 meredith obvious unicorn startup here
19:02 Adura Subway sharing.
19:03 sri uber is not german either, the german word is über
19:03 sri which translates best to above
19:04 Adura If they included the accent they would've scared away English-users.
19:04 meredith yeah it's just that our oafish american tongues made it uber and made it slang :)
19:04 preaction the US just assumes that diacritics don't matter, like in resume, saute, uber...
19:05 sri uber sounds more like a family name
19:05 meredith truly the worst is when we squash things that we think are diacritics but are actually distinct letters
19:05 Grinnz_ the ubers
19:05 preaction they're still in the pronunciation, because English is a cobbled-together language, but they just don't appear in the spelling
19:06 sri lots of english words have entered the german language as well
19:06 meredith i'm sorry
19:06 meredith seriously though language evolution is the most interesting thing
19:08 Grinnz_ it's pretty cool sociologically
19:38 sri not sure what else to say about this https://github.com/kraih/mojo/issues/918
19:39 sri why would anyone want to use Mojo::Exception outside of its intended context?
19:41 PryMar56 joined #mojo
20:03 sri anyone want to put work into this? https://github.com/kraih/mojo/issues/918
20:03 jberger there have been a couple times I've tried to use Mojo::Exception and the api isn't really generic
20:04 sri yea, it's very specific to the task
20:04 jberger I usually just attach a Devel::StackTrace to an exception object when I need it
20:05 orev joined #mojo
20:10 sri there is just no way anyone would be willing to put in the tie required to make it work
20:10 sri *time
20:11 jberger I did write a handy little plugin at work though
20:11 jberger I wonder if anyone would like this on CPAN
20:11 jberger https://gist.github.com/jberger/09e35415480c0795d121
20:12 jberger that's really handy when you are getting server errors, meaning you are seeing 500 page because the action dies
20:13 sri that doesn't really address the issue at al
20:14 jberger no, sorry, it was just something that I had remembered that I did and hadn't shared yet
20:14 sri ah
20:14 jberger the issue just jogged my memory
20:20 sri maybe better to just say no
20:21 sri what would a more generic exception object even look like?
20:26 cpan_mojo Mango-1.26 by ODC https://metacpan.org/release/ODC/Mango-1.26
20:47 jberger I need to try to remember what I've found to be not generic enough :-P
20:47 * jberger tries
20:50 jberger actually I think it was the to_string that has caused me problems
20:51 jberger I wish I had made notes to myself the last time I tried to use Mojo:Exception generically
20:52 good_news_everyon joined #mojo
20:52 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2Ro5
20:52 good_news_everyon mojo/master eeb3c40 Sebastian Riedel: use more generic examples in Mojo::Exception
20:52 good_news_everyon left #mojo
20:56 jberger is it just me or is the doc for lines_before/after switched around?
20:57 jberger just the line numbers
20:57 good_news_everyon joined #mojo
20:57 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2RKd
20:57 good_news_everyon mojo/master 49f334f Sebastian Riedel: fix a few typos
20:57 good_news_everyon left #mojo
20:59 sri oh, you're correct
21:00 good_news_everyon joined #mojo
21:00 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2R60
21:00 good_news_everyon mojo/master 0ee00d5 Sebastian Riedel: fix context examples
21:00 good_news_everyon left #mojo
21:02 sri i suppose this looks now as scary as it should :) http://mojolicious.org/perldoc/Mojo/Exception#SYNOPSIS
21:05 good_news_everyon joined #mojo
21:05 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/v2Ria
21:05 good_news_everyon mojo/master 2ac8721 Sebastian Riedel: slightly more friendly example
21:05 good_news_everyon left #mojo
21:06 jberger you know what I'd love is if the stack trace could be part of the to_string perhaps at a higher verbosity
21:07 jberger but again, that's not really the core reason for this thing
21:07 jberger and as I've shown in that plugin gist, its not that hard to just do it yourself
21:09 sri it exists for $c->reply->exception
21:10 jberger right
21:18 sri i think Mojo::Exception at some point did actually include the stack trace in the to_string output, but it was way too verbose and useless for Mojo::Template
21:20 jberger in generic usage I need a stack trace much more than the local line context, but in reply->exception the opposite is usually true
21:20 jberger so I'm not sure that anything should be done
21:25 sri closing the issue then
21:47 jberger I think the doc tweaks help a bit
22:37 melo joined #mojo
23:01 lsm joined #mojo

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