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

IRC log for #mojo, 2015-09-29

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

All times shown according to UTC.

Time Nick Message
00:00 ajr_ joined #mojo
00:04 mattastrophe joined #mojo
00:18 dvinciguerra joined #mojo
00:31 kmx joined #mojo
00:33 absolut_todd joined #mojo
00:44 disputin joined #mojo
01:16 genio jberger: Is there a way to force Mojo::IOLoop->delay(...)->catch() to happen for the purposes of coverage testing other than die()ing somewhere if an ENV variable is set?
01:17 Grinnz $delay->emit(error => $foo)
01:20 genio meh.  I'll just      # uncoverable block   or whatever it is
01:27 Grinnz adding code just for coverage testing tends to be in the realm of "meh", generally
01:47 cpan_mojo Future-Mojo-0.001 by DBOOK https://metacpan.org/release/DBOOK/Future-Mojo-0.001
01:49 * sri still doesn't like Future very much
01:51 cpan_mojo Mercury-0.002 by PREACTION https://metacpan.org/release/PREACTION/Mercury-0.002
02:06 jberger genio: presumably there is some code in that delay
02:07 jberger Cause something to die
02:08 jberger Do it by mocking a function in the symbol table
02:10 genio jberger: This is where I was talking about: https://github.com/genio/www-salesforce-nb/blob/master/lib/WWW/Salesforce.pm#L350  This is the test set: https://github.com/genio/www-salesforce-nb/blob/master/t/16-rest_search.t
02:10 genio I just skipped coverage on it for the time being
02:11 jb360 joined #mojo
02:11 absolut_todd joined #mojo
02:11 jberger search(...., sub { die }) doesn't suffice?
02:12 jberger I mean, that will get you into the catch block, you'll have to be a bit smarter to actually use it
02:14 jberger my $die = 0; my $err; $sf->search(..., sub { die unless $die++; $err = $_[1] }); ok $err;
02:17 schobes joined #mojo
02:20 absolut_todd joined #mojo
02:27 sri after all the talk about SQL::Abstract in Mojo::Pg, nobody has written a wrapper module yet
02:37 noganex joined #mojo
02:48 absolut_todd joined #mojo
02:56 hernan604 joined #mojo
02:58 kaare joined #mojo
03:01 absolut_todd joined #mojo
03:14 absolut_todd joined #mojo
03:18 absolut__ joined #mojo
03:31 njlg joined #mojo
03:59 irqq joined #mojo
04:13 jontaylor joined #mojo
04:45 inokenty-w joined #mojo
04:46 melo joined #mojo
05:48 dod joined #mojo
06:00 dod joined #mojo
06:02 SmokeMachine joined #mojo
06:03 Lucas1 joined #mojo
06:04 salva joined #mojo
06:04 bpmedley joined #mojo
06:15 panshin joined #mojo
06:23 Vandal joined #mojo
06:25 cpan_mojo Mojo-Pg-2.11 by SRI https://metacpan.org/release/SRI/Mojo-Pg-2.11
06:42 batman sri: is SQL::Abstract the "best" module?
06:42 batman Been trying to figure out which to use in Mad::Mapper
06:43 batman (Can't remember the names of the competing modules)
07:00 eseyman_ joined #mojo
07:00 Dandre joined #mojo
07:02 AndrewIsh joined #mojo
07:02 panshin joined #mojo
07:03 sri batman: you tell me ;p
07:13 panshin joined #mojo
07:13 batman bummer :)
07:14 sri in the js world this one seems to be all the rage http://knexjs.org
07:18 sri of course i appreciate the fluent interface
07:23 damaya joined #mojo
07:24 damaya OK, so I'm using Mojo::Pg and I'm doing an insert. How can I insert if defined? I'm getting DBD::Pg::st execute failed: ERROR:  invalid input syntax for integer: ""
07:24 damaya Well yeah, it's not defined.
07:25 trone joined #mojo
07:27 sri i'm kinda intrigued by the idea of making a new sql generator, but since i'm only interested in one database, it would be kinda limited :S
07:28 batman oh. looks like SQL::Abstract is the one with most ++ on metacpan. twice as much as SQL::Translator
07:29 sri it's been around for a very long time
07:30 sri never really liked the style though, the data structures are so far from what the actual sql looks like
07:32 batman what about https://metacpan.org/pod/SQL::Maker ?
07:33 sri how is that different?
07:33 sri it's like SQL::Abstract-lite
07:34 batman it just looked a bit simpler imo
07:34 batman i like "lite" :)
07:34 sri not saying that's bad... just that i prefer the style of knex.js
07:35 damaya sri: What database are you only interested in? Mongo, right?
07:35 sri postgres
07:35 nic joined #mojo
07:36 sri mongodb is over
07:36 damaya Ahh, didn't realize that. I've always used postgres, never really followed mongo.
07:37 damaya Well, Mojo::Pg is awesome, so nice job on that.
07:38 damaya Although, I think I may use DBIx::Class at this point, just due to the fact that 1/2 the time this is undef and DBIx::Class seems to handle that for me.
07:38 batman damaya: how does it handle that?
07:39 batman the main issue i have with dbic is that it's blocking.
07:39 damaya No idea how it goes about doing it (probably SQL::Abstract magic of some sort), but if it's undef it just doesn't try to insert it.
07:39 sri i never had problems with undef, ever
07:39 mudler joined #mojo
07:39 damaya Hm, maybe it's something  with Text::CSV?
07:40 sri undef becomes NULL
07:40 damaya If you've never had any issues, then there's something else happening.
07:40 sri if that's not a valid value for the column...
07:42 damaya Yep, Text::CSV, seems to be defined but completely empty.
07:42 sri there's soooo many ways to deal with undef/null, just yesterday i used coalesce() to make an update optional https://github.com/kraih/minion/commit/4e12d249184dd19bf51986c15402ddbdb3b06d0b#diff-6c2d02af894f2ce916d89f7b04f4b54aR136
07:43 sri <3 postgres
07:43 sri so many little tricks
07:43 damaya blank_is_undef :D
07:43 damaya Sheesh, Text::CSV treats blank as defined unless set blank_is_undef to 1. So, it was defined, it was just empty.
07:44 damaya Gah, and here I am blaming you! :D
07:44 mkrull joined #mojo
07:45 mkrull left #mojo
07:45 sri as penance you have to buy a t-shirt now
07:46 damaya I have two, but a third isn't a bad idea.
07:46 ashimema t shirts?
07:46 damaya I'm a bit sad that the dino on my shirt kinda died due to my dryer.
07:46 damaya yeah, https://shop.spreadshirt.com/kraih/
07:47 ashimema shiny
07:47 sri it's linked from the frontpage too http://mojolicio.us/
07:47 ashimema I may have not visited that page in a while.. always head straight into the docs
07:47 damaya The tie-dye Mojolicious shirt has held up well though
07:49 sattellite joined #mojo
07:49 ashimema think I'll add that to the Christmas list for the team here ;)
07:49 ashimema Sure 6 T's wouldn't go a miss :)
07:49 sri i still have a few from the first batch in 2011, they look like new
07:50 sri maybe the print quality is bettr in europe ;p
07:50 sattellite joined #mojo
07:50 sattellite left #mojo
07:50 ashimema :), they have an EU shop..
07:50 ashimema just found that :)
07:50 ashimema col
07:53 sattellite_ joined #mojo
07:54 damaya Everything is better in Europe.
07:54 sattellite_ joined #mojo
07:56 ribasushi re batman's lament: I need to sneak in the obligatory line that DBIC does not provide an async sub-interface because nobody came up with even a handwavy API for it
07:56 ribasushi i.e. tell me what DBIC *should* do, and let me worry about *how* it will do it
07:56 sattellite joined #mojo
07:56 ribasushi the last conversation I had about this was with jberger, who after getting a lot of prior art material/conversations went quiet
07:57 ribasushi </PSA>
07:58 sattellite hi. what hook i need use for add some headers for each response?
07:58 ashimema I'd love to have dbic do async.. but I have no idea how it should.. or why i'de like it too ;)
07:58 sattellite after_tx_build and before_render hooks not work for me :-(
07:59 ribasushi ashimema: that's how almost all conversations about it end :(
07:59 berov joined #mojo
08:02 ashimema yeah, I can imagine..
08:02 ashimema I didn't realise you had the appetite to make it happen though given the right api discussion
08:03 ashimema jberger or sri re likely the best people to give a handwavy explanation for such a thing ;)
08:03 Jonis sri: thanks for the reminder, bought a t-shirt :)
08:04 ribasushi um... "I didn't realise you had the appetite to make it happen" why would I possibly be disinterested in implementing something that will open a new niche for the project?>
08:05 vanHoesel joined #mojo
08:07 ashimema mostly thought it wasn't really on the dbic horizon and likely me just not understanding where the complications may lie
08:07 ashimema gotta restart.. brb
08:07 sri Jonis: \o/
08:12 Jonis been meaning to for ages, but easily distracted.
08:12 mishanti1 Got myself a t-shirt as well.
08:14 sri \o/
08:15 sri not everything is better in europe... we have no tie dye shirts :/
08:15 Jonis hah
08:15 Jonis I've not worn that since we made them in upper secondary.
08:19 sugar joined #mojo
08:25 Flying_Squirrel joined #mojo
08:33 ashimema joined #mojo
08:35 ashimema back.. that was an unsettling reboot
08:36 bd jberger: just found the code of conduct, on one thing strikes me as odd, "This isn’t an exhaustive list of things that you can’t do"
08:52 irqq joined #mojo
09:04 meshl joined #mojo
09:18 jontaylor joined #mojo
09:19 sue joined #mojo
09:33 nic sri: Would you consider minion tasks having a 'category' (or anything that groups tasks under an umbrella)
09:34 nic I'd like a worker to pull by category, instead of needing to know the name of each task within its category
09:34 nic s/pull/dequeue/
09:34 nic I thought I'd work around it by having the a wrapper whose name was the category, and its params would identify the real task name
09:35 nic but for management that's really ugly and annoying
09:35 melo joined #mojo
09:36 nic I think it goes hand-in-hand with throttling & rate limiting
09:37 nic (throttling: point in time; rate limiting: over a period)
09:42 sri dunno
09:42 nic maybe 'group' is better than 'category'
09:43 nic bpmedley: Would that satisfy what you were requesting re '-T'?
09:44 nic ie It would be a neat way of segregating your tasks; every task is in 0 or 1 group(s)
09:53 Flying_Squirrel joined #mojo
09:59 sri seems complicated
09:59 sri don't see that fitting in nicely
10:00 meshl joined #mojo
10:03 salva joined #mojo
10:08 panshin joined #mojo
10:11 asarch joined #mojo
10:22 jb360 joined #mojo
10:28 dp_ joined #mojo
10:40 jontaylor_ joined #mojo
10:45 Kripton joined #mojo
10:54 panshin joined #mojo
10:57 stephen joined #mojo
11:12 jontaylor joined #mojo
11:13 sugar joined #mojo
11:32 sri also, i don't see how groups would help at all with rate limits
11:33 asm35 joined #mojo
11:33 sri assigning rate limits is not a hard problem at all, the actual implementation is crazy hard
11:35 sri after researching job queue features over the last few days, i tend more towards keeoing minion simple
11:37 sri job dependencies, rate limits, and friends are all pretty hard problems that make the implementation rather complicated
11:38 sri what i still would like to see is auto retry... but the race condition i mentioned earlier is a hard problem to solve
11:39 sri any solution i can think of would cost reliability or portability
11:50 dvinciguerra joined #mojo
11:59 panshin joined #mojo
12:10 jberger bd: why is that odd?
12:11 asm35 joined #mojo
12:11 jberger I doubt you could construct a complete set of things you can't do
12:11 jberger But these are reference
12:12 jberger The next sentence:
12:13 jberger "Rather, take it in the spirit in which it’s intended - a guide to make it easier to enrich all of us and the technical communities in which we participate."
12:13 sugar joined #mojo
12:15 bd jberger: first you say "...things that you can’t do", then "Be friendly and patient."
12:15 damaya joined #mojo
12:16 lluad joined #mojo
12:16 jberger bd: are you just critiquing the grammar? I guess we could tinker with that :p
12:16 vanHoesel joined #mojo
12:17 jberger I do like that the guidelines are phrased in the positive sense
12:18 jberger Actually, just above it does say "o that end, we have a few ground rules that we ask people to adhere to."
12:18 jberger *To
12:19 bd jberger: i agree on the positive sense, but doesn't the ""...things that you can’t do" contratict the postive wording?
12:20 jberger I think as I re-read it, that sentence is meant with regard to other standards of conduct which might just be "a list of things you can't do"
12:22 jberger But i can try to think up a phrasing for that sentence that clarifies, if there is concern
12:23 asm35 left #mojo
12:23 Flying_Squirrel joined #mojo
12:23 bd jberger: i wouldn't call it concern, just odd. first it's "don't do that", then it's "this is the way we want to interact with each other" ;)
12:23 jberger I don't think anyone would misread it and think that we don't allow being friendly and patient :p
12:25 jberger Again the more I re-read, the more I think that sentence is a counterpoint to other SoCs
12:25 stephan48 "We would ask you to be friendly and patient." <- bit more verbose but clear
12:26 jberger stephan48: that's once we have gotten to the actual encouraged behavior, and IMO bullets are fine for that
12:26 bd jberger: that makes sense.
12:26 stephan48 ok
12:27 bd jberger: i was missing the "compare to other CoCs" information, so i applied it to the mojolicious one and that felt odd.
12:27 jberger bd: I do see what you see, now that you point it out
12:32 tcohen joined #mojo
12:35 jberger "Our Code of Conduct is not written as a list of things you cannot do, nor is it an exhaustive list of behaviors we encourage."
12:36 ajr_ joined #mojo
12:36 jberger s/encourage/require|expect/
12:37 bd jberger: adhere to? more inclusive than require or expect
12:37 bd though i am not a native speaker ;)
12:38 jberger The phrase "we adhere to" typically only would include it speaking party
12:39 jberger Which is fine if "we" definitely included the reader
12:39 jberger ie if the reader already feels party of the community
12:40 nic I was taught that 'we' should always include the reader
12:40 nic otherwise it's just pompous
12:40 sugar joined #mojo
12:40 bd nic: we are not pompous *Scnr*
12:40 nic add it to the list of things not to be :)
12:41 jberger bd: actually see how adhere to is used earlier "To that end, we have a few ground rules that we ask people to adhere to."
12:41 * jberger gives nic a time out, sends him to the corner
12:42 jberger :p
12:43 bd jberger: then adhere doesn't work in place of encourage
12:45 * jberger proposes https://youtu.be/i5JZMTAUBVE
12:46 * bd heard pompous
12:48 bd jberger: i'd lean more towards expect over require
12:48 jberger Which is what made me think of it
12:51 * jberger adds "live in a swamp and be three dimensional" to the CoC
12:51 mattastrophe joined #mojo
12:53 bd somwhere shrek sits in his mud hut, check, check, mojolicious here i come
12:58 jberger shrek is totally welcome, the mooninites, not so much
13:04 damaya joined #mojo
13:17 hernan605 joined #mojo
13:17 gryphon joined #mojo
13:34 Flying_Squirrel joined #mojo
13:37 sugar joined #mojo
13:39 * nic creeps back out of the corner
13:40 nic sri: It looks like I can get everything I want from Minion simply by...  writing my own backend!
13:40 nic I can't believe how awesome that is
13:41 nic So to play with new features, I'm starting with Minion::Backend::FileWithBells :)
13:41 nic However
13:41 nic folks in this position do need one tiny modification to core Minion...
13:42 nic There needs to be a way, in Minion::Worker::dequeue, to pass options to the backend's dequeue
13:42 nic You could say this simply makes it more consistent with the other parts of the non-backend which pass options and defer to the backend
13:46 nic When you get near v2, you could change $self->dequeue($timeout) to $self->dequeue($options)
13:52 nic (ie ::File and ::Pg would be changed to handle a hashref in place of a scalar)
13:56 nic http://blog.swap-bot.com/wp-content/uploads/2010/07/ursulaminion.jpg  <- Minion-with-extensions
14:00 neilhwatson joined #mojo
14:38 disputin joined #mojo
14:50 njlg joined #mojo
14:57 Flying_Squirrel joined #mojo
15:06 sugar joined #mojo
15:11 mattastrophe joined #mojo
15:15 cpan_mojo Mojo-Cloudstack-0.07 by HRUPP https://metacpan.org/release/HRUPP/Mojo-Cloudstack-0.07
15:15 damaya joined #mojo
15:21 PryMar56 joined #mojo
15:25 meshl joined #mojo
15:25 sue joined #mojo
15:31 damaya joined #mojo
15:34 sh4 joined #mojo
15:44 jontaylor joined #mojo
15:46 sugar joined #mojo
15:53 bpmedley_ https://github.com/kraih/minion/compare/master...brianmed:master <-- nic, do you think this SQL will work for a DAG?
15:55 PopeFelix So as part of Mojo::UserAgent::Mockable, I want instances to save a file when they go out of scope.
15:56 bpmedley_ Anyone have some time to look over the SQL and possibly run the test and benchmarks?
15:56 PopeFelix And I understand that I do this in DESTROY, but in testing, DESTROY doesn't seem to get called until after the test finishes and the temp directory has been deleted.
16:06 bpmedley_ PopeFelix: Do you have a smallish example?
16:07 PopeFelix bpmedley_, I can paste my DESTROY method.
16:07 PopeFelix upon reflection, i reckon I could work something up.
16:10 asarch joined #mojo
16:13 * PopeFelix grumbles
16:13 PopeFelix it works in the sketch
16:15 Grinnz_ PopeFelix: scope your object smaller. if it's scoped globally, it has to wait for global destruction, where there's no guarantees about order
16:15 PopeFelix Grinnz_, that's the thing. My object is confined to a scoping block five lines long.
16:16 PopeFelix I would expect the destructor to get called immediately after the object goes out of scope.
16:16 Grinnz_ as long as it has no other references, yes
16:16 PopeFelix I'll paste the test.
16:17 shadowpaste "PopeFelix" at 217.168.150.38 pasted "Test" (123 lines) at http://paste.scsys.co.uk/499507
16:18 PopeFelix If I don't explicitly call save() at line 33, it doesn't save when the object goes out of scope.
16:55 jabberwok left #mojo
16:58 Dada joined #mojo
17:02 cpan_mojo JSON-Validator-0.55 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/JSON-Validator-0.55
17:10 vanHoesel joined #mojo
17:33 dod joined #mojo
17:33 berov left #mojo
17:35 panshin joined #mojo
17:38 PopeFelix Is there some magic I need to do when switching the UA on a local Mojolicious app?
17:38 pink_mist what does "switching the UA" mean?
17:38 PopeFelix I.E. my $app = Mojolicious->new(); $app->routes(...); $app->ua($some_ua_instance);
17:39 PopeFelix then $some_ua_instance->get('/whatever')
17:39 PopeFelix I keep getting 'Mojo::Reactor::EV: I/O watcher failed: Can't call method "build_tx" on an undefined value'
17:39 pink_mist why not do it via $app->ua()->get?
17:39 PopeFelix I tried that too.
17:39 PopeFelix i think, anyway.
17:40 PopeFelix yeah. yeah i did.
17:40 pink_mist I'm not sure why you're putting it into $app->ua() at all btw
17:40 PopeFelix pink_mist, I'm testing my Mojo::UserAgent::Mockable against a local app.
17:40 pink_mist if you already have a $some_ua_instance why put it into $app->ua() if you're not going to be using it via $app->ua()?
17:41 * PopeFelix will work up a paste
17:42 shadowpaste "PopeFelix" at 217.168.150.38 pasted "Switching $app->ua" (11 lines) at http://paste.scsys.co.uk/499510
17:42 Kogurr joined #mojo
17:42 damaya joined #mojo
17:46 PopeFelix Fixed it.
17:46 pink_mist and?
17:46 pink_mist how?
17:46 pink_mist don't leave us hanging
17:46 pink_mist or at least me
17:47 shadowpaste "PopeFelix" at 217.168.150.38 pasted "Switching $app->ua (fixed)" (15 lines) at http://paste.scsys.co.uk/499513
17:48 PopeFelix I guess the one way starts an io loop or something, and the other doesn't.
17:48 pink_mist huh, I see
17:48 PopeFelix I am curious as to why that works, though, and the other way doesn't.
17:49 Grinnz the first way doesn't set the app inside the $ua, so that it can use it for get() on a relative path
17:49 batman PopeFelix: $ua->server->app($app)
17:50 PopeFelix batman, yeah, that's what I discovered.
17:50 Grinnz https://metacpan.org/pod/Mojo::UserAgent#server
17:50 PopeFelix Grinnz, thanks for the explanation.
17:50 Grinnz in a newly created useragent, that's empty
17:50 PopeFelix Huh.
17:51 PopeFelix I guess I would have expected $app->ua to do all that magic behind the scenes.
17:51 sugar_ joined #mojo
17:51 Grinnz it would get a https://metacpan.org/pod/Mojo::UserAgent::Server which would load a Mojo::HelloWorld app, probably
17:52 PopeFelix I don't follow.
17:52 Grinnz https://metacpan.org/pod/Mojo::Server#app
17:53 PopeFelix Oh, I get you.
17:53 trone joined #mojo
17:55 Dada Hi. A question about my mojo app : I want to check how many request are made by every IP adress, and deny access if the IP adress has already made like 1 thousand request this day... So I was thinking about a 'under' before every route, which would check in a database how many requests have been made... Does it sound like a good idea?
17:55 Grinnz sure
17:57 meredith it may be easier to add a hook to your app instead of having to remember to wire that "under" to everything
17:57 Adura If you're looking to suppress DoS-like behaviour, having every request hit a DB might not be the way to go.
17:57 Flying_Squirrel joined #mojo
17:58 damaya joined #mojo
17:59 Grinnz the under would go as a parent route to all your other routes, it only needs to be there once
17:59 Dada @meredith: I've never used hooks before, could you explain a little? (a link maybe? )
18:00 meredith https://metacpan.org/pod/Mojolicious#before_dispatch
18:01 Dada @Adura: I'm not sure to fully understand, but anyway I thought I could use a databse like Redis to load it in memory in order not to loose to much performance..
18:01 meredith You can set up hooks in your app's setup method, and they're passed a default Controller instance, so you can look into the request object and pick up the client IP from that.
18:02 Adura Guess that'd... "tighten" performance. Sounds like something to solve in iptables, though.
18:03 Dada @meredith: Ok, thanks, I'm looking into it
18:05 Dada @Adura: means outside mojo then, right? Well, i'm not very familiar with iptables, I'll have a look too
18:06 Adura Really depends, like I said, DoS-suppression as opposed to something like preventing multiple password use attempts.
18:09 berov1 joined #mojo
18:09 Dada Any link about that? (I need to read more about it, I don't fully get it)
18:10 Adura I don't know any Mojo-related ones.
18:11 Dada So, a non-mojo-related one? ;)
18:12 Adura Nothing comes to mind, I'd probably just vary my search terms based if my goal the former or latter.
18:12 Dada Grinnz and meredith, a before_dispatch hook and a under before all routes should have the same behaviour.. so anything I should consider before using one or the other?
18:12 Adura *was the former or latter
18:13 Dada Adura: Roger, I'll do that. thx :)
18:13 Adura I dropped words, but you seem to get the idea.
18:14 Dada Sure!
18:18 Grinnz Dada, the difference is an under is part of the dispatch cycle, and you can add routes that aren't affected by it
18:18 Grinnz a hook applies to all requests
18:18 Dada ok, got it, thanks
18:24 Dada another thing : the same app can respond to different website request (I mean like en.mysite.com, fr.mysite.com, etc.), can't it? If so, how do I know from which website the request comes from?
18:25 mattastrophe joined #mojo
18:25 cpan_mojo Swagger2-0.56 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Swagger2-0.56
18:26 Adura The host header.
18:28 Dada Ok, and how do I access those headers? (I looked on google, but most results are about generating headers..)
18:29 nic_ joined #mojo
18:29 nic_ https://github.com/mozilla/minion-backend/tree/master/minion/backend
18:30 Dada (Gotta go, but I'll read your answers when I'll be back, thanks in advance)
18:42 bpmedley_ Dada: https://bitbucket.org/snippets/bpmedley/KAXXj <-- Something like this, maybe?
18:44 jberger well here's something that will take time to get used to: https://www.reddit.com/r/perl/comments/3muox3/naming_convention_for_perl_6/
18:48 njlg joined #mojo
18:50 chansen sri: Mojo::url_escape and Mojo::url_unescape doesn't perform URL escaping/unescaping, they perform URI PCT escaping/unescaping, this is embarrassing!
18:56 HtbaaPi joined #mojo
18:59 Grinnz_ "kebab case" hahaha
19:04 panshin joined #mojo
19:05 bpmedley_ https://bitbucket.org/snippets/bpmedley/egdab <-- Is there much difference in doing this vs $ua->server->app($app)?
19:08 jberger bpmedley_: ?
19:08 njlg joined #mojo
19:08 jberger get on an external (read: not relative) url doesn't matter in the slightest
19:09 jberger the specific problem is attaching a server to respond to relative urls
19:09 bpmedley_ Ok, understood.  What about for the $app object creatoin?
19:09 jberger that is essentially the same thing: https://github.com/kraih/mojo/blob/master/lib/Mojo.pm#L18
19:10 bpmedley_ Thx
19:10 jberger but notice that it weakens the app
19:10 jberger so you can't just do:
19:10 jberger my $ua = Mojo::Server->new->build_app("MyApp")->ua;
19:11 jberger because the app will go out of scope immediately
19:11 jberger so you don't save yourself any code
19:11 bpmedley_ Cool stuff.  I appreciate all your help.
19:11 jberger np
19:13 bpmedley_ jberger: Do you think you might have time to look at my latest minion dependency code?
19:13 jberger bpmedley_: I know nothing about the implementations of those
19:13 jberger I would have no intelligent comments to make
19:22 bpmedley_ nicomen, nic, CandyAngel , do any of you have time to look at my minion code for dependencies?
19:22 CandyAngel Sure, I'll have a look
19:23 Flying_Squirrel joined #mojo
19:26 scoopio joined #mojo
19:27 scoopio hello
19:28 scoopio i've run into a weird problem
19:28 scoopio i'm trying to redirect_to 'index' from within a del route
19:30 scoopio the redirect does happen but with the DELETE method
19:30 pink_mist that sounds odd
19:30 pink_mist what browser are you using?
19:30 scoopio firefox
19:31 pink_mist oh wait, scratch that .. it doesn't sound odd since DELETE doesn't come with a payload
19:31 scoopio actually, now that I think of it, it's probably Angular's doing
19:32 scoopio pink_mist: does that mean that I shouldn't attemting to redirect with DELETE?
19:34 scoopio ah yeah
19:34 scoopio now I get it
19:36 scoopio since I'm here. How do I return an empty 200 respose?
19:36 scoopio sorry I'm new to Mojolicious
19:36 bpmedley_ $c->render(data => "", code => 200) <-- Untested
19:38 scoopio yup, that works
19:39 Flying_Squirrel joined #mojo
19:39 scoopio thanks
19:39 batman You never redirect with a HTTP method.
19:39 batman It's only an url, which the browser does GET on.
19:40 hernan606 joined #mojo
19:40 scoopio yeah, the location header
19:40 scoopio should have realised
19:41 Grinnz_ see: http://programmers.stackexchange.com/questions/99894/why-doesnt-http-have-post-redirect
19:42 Grinnz_ tl;dr don't redirect from anything other than GET, save yourself a headache
19:42 pink_mist this was enlightening to me ... I had gotten it all wrong http://blogs.msdn.com/b/ieinternals/archive/2011/08/19/understanding-the-impact-of-redirect-response-status-codes-on-http-methods-like-head-get-post-and-delete.aspx
19:42 Grinnz_ this is why i use javascript :P
19:43 batman Grinnz_: huh? Never had problem redirecting from POST
19:44 batman POST /login => redirect to GET /profile
19:44 Grinnz_ right, POST redirects to GET
19:44 scoopio yeah, redirecting from a POST works
19:45 batman Oh. Guess I misunderstood.
19:57 jberger scoopio / bpmedley_ : $c->rendered(200)
20:03 jberger pink_mist: interesting find
20:10 damaya joined #mojo
20:29 ZoffixWork joined #mojo
20:42 cono hai guys
20:42 cono is there any way to use "render_to_string" out of the request?
20:43 cono I'm getting: [Tue Sep 29 23:36:39 2015] [error] [skipping] unexpected error: Can't call method "req" on an undefined value at /home/cono/work/p5-tm-gitlab-hook/local/lib/perl5/Mojolicious/Controller.pm line 221, <DATA> line 2231.
20:44 ZoffixWork cono, just call ->render_to_string on your controller
20:45 ZoffixWork https://metacpan.org/pod/Mojolicious::Controller#render_to_string
20:45 cono that what I'm actually doing
20:45 cono the problem is, that I put some stuff in event loop (really long stuff) and give response to browser
20:45 ZoffixWork cono, what are you trying to render? It's complaining you're calling ->req on something
20:46 cono and when my job finished I'm calling render to string to send an email
20:46 cono and at that time I have this error
20:46 ZoffixWork Do you have code you can pastebin?
20:46 cono ZoffixWork: code of the template, right ?
20:46 ZoffixWork Code of where you're calling ->render_to_string
20:47 cono ZoffixWork: http://paste.org.ru/?0ja6ob
20:47 cono gimme a sec
20:49 cono ZoffixWork: http://paste.org.ru/?g3zmfd
20:50 jberger cono: are you sure its not the other call to rnder that fails?
20:50 jberger render
20:50 cono when I comment this line everything works as expected
20:52 sugar joined #mojo
20:52 jberger cono: try closing over the transaction
20:53 jberger that is usually the problem when that error exist
20:53 jberger s
20:53 cono jberger: how ?
20:53 jberger put: my $tx = $self->tx; somewhere near the top
20:54 jberger then put "if $err && $tx" in the catch
20:56 PopeFelix Is there a nice way of comparing two instances of Mojo::URL?
20:56 batman PopeFelix: doesn't eq work?
20:56 cono jberger: but if tx is not exists at that moment?
20:56 PopeFelix batman, it didn't occur to me to try.  let me see.
20:57 jberger query arg order might not be sane
20:57 pink_mist might want a ->to_abs perhaps
20:57 jberger cono: its strange, but by asking if it still exists, it still will
20:58 PopeFelix pink_mist, to_abs did it, thank you.
21:00 cono jberger: ah, got your point, let me try. Thanks
21:01 cono jberger: yeah, works, thanks!
21:02 jberger cool
21:03 njlg joined #mojo
21:03 jberger most non-blocking stuff needs that
21:03 jberger you might want to investigate the delay helper which does it for you
21:03 panshin joined #mojo
21:04 jberger then again, it renders 500 on error and you just log, so maybe not
21:05 jberger see how it works though, it does basically the same thing, closing over the tx: https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Plugin/DefaultHelpers.pm#L79-L84
21:07 cono jberger: uh, nice, thanks )
21:10 disputin joined #mojo
21:18 mattastrophe joined #mojo
21:22 mattastrophe1 joined #mojo
21:26 njlg joined #mojo
21:30 PopeFelix If I am comparing two Mojo requests for equivalency, what should I compare besides URL and body?
21:31 PopeFelix Headers, I would assume.  Anything else?
21:34 njlg joined #mojo
21:43 njlg joined #mojo
21:44 sri nic: what kind of options would you want to pass to dequeue?
21:45 mattastrophe joined #mojo
21:51 jberger PopeFelix: method
21:52 PopeFelix jberger, of course, method! Thanks.
21:57 cpan_mojo XTaTIK-0.005002 by ZOFFIX https://metacpan.org/release/ZOFFIX/XTaTIK-0.005002
22:03 bpmedley_ https://bitbucket.org/snippets/bpmedley/7Rpn9 <-- Greetings, my code is pegging the cpu.  Is it possible that the file handle is always readable and/or I have a bug in my code (more likely)?
22:09 njlg joined #mojo
22:09 sri bpmedley_: re your latest minion patch, i think you should be using explain analyze more
22:10 sri be cause there is no way you're still taking advantage of the indexes
22:11 bpmedley_ sri: Will do.  Sorry about that.  Thanks for looking!
22:11 sri the _update stuff also looks too verbose
22:11 sri there should be no need to select and then update, one update should be fine
22:13 * sri actually looked at array functions earlier, and there are very comfortable ones
22:13 sri array_remove() in an update should be all you need
22:16 sri i guess i would also put the dep updating stuff before the state change
22:16 sri so there is less chance of things going wrong
22:16 PopeFelix q
22:16 PopeFelix sorry, wrong window
22:16 sri like if the removal of deps fails somehow
22:17 melo joined #mojo
22:17 sri right now you'd be left with a successfully finished job, and deps that will never get resolved
22:18 sri if order was the other way around, you'd be left with deps and a job in active state (which will transition to failed in a repair step in the future)
22:19 sri chansen: we don't use URI terminology in mojoliicous, it's antiquated
22:19 sri https://url.spec.whatwg.org/#goals
22:21 sri percent_encode/percent_decode would be more reasonable names though
22:21 sri i would pick those these days if i had to do it again
22:26 bpmedley_ sri: I'll spend some more time on the deps stuff and get back to you!
22:26 jberger I like it when standard bodies are this blunt: "Standardize on the term URL. URI and IRI are just confusing."
22:27 sri very whatwg
22:47 Grinnz_ URI means it can also include URNs like an ISBN
22:47 Grinnz_ which really does not apply to this
22:48 Grinnz_ so i would say URI isn't appropriate for this spec anyway
22:49 meshl joined #mojo
22:54 mattastrophe joined #mojo
23:07 njlg joined #mojo
23:08 Flying_Squirrel joined #mojo
23:15 sri hmm, not sure what to think of the new nexus phones
23:19 PopeFelix sri, nexus 6 or nexus 7?
23:19 PopeFelix Wait, the nexus 7 is a tablet, isn't it?
23:19 * PopeFelix has a nexus 5.
23:19 PopeFelix Also, when would I use Mojo::Util::secure_compare over eq/ne?
23:19 * sri has a nexus 5 as well
23:20 pink_mist PopeFelix: when you're doing a hashing algorithm that you don't want to suffer from timing attacks
23:20 PopeFelix sri, does yours do the thing where you're on the phone and the screen turns off and you can't turn it back on until the call ends?
23:20 pink_mist PopeFelix: in other words, probably never
23:20 PopeFelix pink_mist, thanks.
23:21 sri was considering a new one, but there is just no way i pay that much for something made by huawei
23:22 * PopeFelix shrugs. I don't really know who makes good phones any more.
23:22 sri euro prices seem to be 649 for the 6p and 449 for the 5x
23:22 sri that's iphone prices
23:23 PopeFelix I have a buddy with an ASUS phone.  That's a name I trusted at one time, but I don't know if it's still a good name or not these days.
23:25 PopeFelix Though i like the look of this padfone business ASUS have going.  Phone that docks into a tablet.
23:26 sri i don't trust chinese manufacturers anymore in general
23:26 PopeFelix Except you couldn't put it into a case.
23:27 sri if i get another android, it better come from korea
23:27 PopeFelix Is there anyone besides the Chinese who make phones these days?
23:27 sri nexus 5x is lg, which comes from korea
23:28 sri really too bad motorola went to lenovo
23:28 sri i will never ever trust lenovo again
23:30 PopeFelix ew. ASUS have a third party UI.
23:30 Grinnz i would love these phones if any of them had screens smaller than 5"
23:30 PopeFelix What I should do is wipe my N5 and put cyanogen on it.
23:31 Grinnz i cant stand all these new phones that require both hands to use
23:31 * PopeFelix prefers a larger screen.  Old eyes, you know.
23:31 sri Grinnz: i'm ok with 5", but anything bigger is a tablet
23:31 Grinnz i might end up having to settle for 5" soon, there is barely anything left
23:32 disputin joined #mojo
23:35 PopeFelix I can work my N5 with one hand OK.
23:58 aborazmeh joined #mojo
23:59 mattastrophe joined #mojo

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