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

IRC log for #mojo, 2017-02-21

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

All times shown according to UTC.

Time Nick Message
00:39 aborazmeh joined #mojo
03:29 noganex_ joined #mojo
04:14 marty joined #mojo
04:38 inokenty-w joined #mojo
04:51 jlaffaye joined #mojo
05:04 dboehmer_ joined #mojo
07:10 rshadow joined #mojo
07:11 Vandal joined #mojo
07:14 rshadow joined #mojo
07:27 salva sri: regarding that rejected pull request, could you explain in a little detail what you expect for an API proposal?
07:29 salva I tried to write it down in https://github.com/kraih/mojo/pull/1053#issuecomment-280864110
07:41 stryx` joined #mojo
08:12 AndrewIsh joined #mojo
08:35 trone joined #mojo
09:14 rshadow joined #mojo
09:14 salva joined #mojo
09:14 kwa Might have already been done before, but I hacked up a one-liner: perl -Ilib -Mojo -E 'plugin "PODRenderer"; a( "/" => { inline => qq!%= app->home->child("lib")->list_tree({hidden => 1})->sort->map(sub { link_to \$_->to_rel("lib") => url_for("perldocmodule" => {module => \$_->to_rel("lib")->dirname . "/" . \$_->basename(".pm") }) })->join("<br>")! } )->start' daemon
09:14 kwa https://app.gistboxapp.com/library/label/1431330495072 - Ideal for checking the POD for your Perl apps or libraries. Starts a web server with /perldoc links for all of the files in the lib folder relative to your current pwd.
09:14 kwa Err - https://gist.github.com/kwakwaversal/b85ebbb8ca831fee300b5da140d05362
09:26 sri salva: i would expect a small list of use cases with description and example code
09:26 sri like it would be in the actual documentation
09:27 salva you mean a patch for the documentation?
09:30 sri could be, doesn't have to be
09:31 sri you'r examples are almost there, but you keep mixing it with arguments about the implementation
09:31 sri *your
09:32 sri when we only care about how it's used for the discussion
09:34 sugar joined #mojo
09:35 sri like, how would you convince a normal mojolicious user that the feature is worth adding
09:41 salva sri: ok
09:52 CHYC joined #mojo
10:07 mat I'm using mojolicious with dbix-class, is there a way to wrap each controller action in a transaction (that is, without having to write it for each and every action)
10:09 sri there are hooks, but it's a pretty bad idea
10:21 mat mmmm, ok, so, there is an around_dispatch hook, why is it a bad idea ?
10:23 kwa mat: Do you mean you want to wrap every action in a "txn_do" so you can roll back or something when there's an error?
10:23 mat kwa, exactly
10:24 Lee that's a rather sledgehammer like approach
10:24 kwa I think he means its a bad idea because it would wrap *every* action, even when an action doesn't do anything with the database.
10:25 mat every action does something with the database, even if it's just to check that there is a logged-in user :-)
10:25 kwa You only need a transaction when you're doing multiple inserts or updates, and you want it to be "all or nothing".
10:25 kwa Why do you need a transaction for that?
10:25 kwa That's just a select. Let DBIC handle things under the hood in that case.
10:26 Lee mat: are you calling dbic directly from your mojo controllers?
10:26 mat kwa, well, first, I get transaction isolation, so the database remains coherent during the action
10:27 kwa But to select if a user is logged in, that's unnecessary.
10:28 kwa So if you really need transactions in isolation, do it for as little time as possible, and only where you need it.
10:28 mat kwa, it was an example, I don't have any actions that only do one query, all of them show stuff :-)
10:28 mat Lee, yes, I do, I have helpers set up for every resultset, so I call them directly from the actions
10:28 Lee mat: don't do that: https://softwareengineering.stackexchange.com/questions/304520/when-should-i-use-perls-dbixclass/304557#304557 # see "Abusing the Solution"
10:30 Lee if you're thinking about hooking to wrap transactions in the framework then you've already leaked way too much of the abstraction
10:30 dotan_convos joined #mojo
10:32 sugar joined #mojo
10:34 mat so, I'm not pure
10:34 mat but I'm french, I'm used to that :-)
10:34 dotan_convos joined #mojo
10:35 Lee refactor pour un bonne avenir !
10:35 Lee just a heads up that's all
10:35 mat I'm already refactoring from a pure DBI approach, things that were awful are now readable
10:37 mat so, if the "it is a pretty bad idea" is because of the overhead (it's ok, the app gets 5-10 hits a day, it can take it) and because it leaks abstraction, I can live with it for the time being
10:37 mat if it is a pretty bad idea because hooks don't really work all the time, or leak stuff, or I don't know what, it is a different level of bad idea :-)
10:39 stryx` joined #mojo
10:40 sri also the next engineer maintaining that project is gonna murder you
10:42 sri those hooks are meant for generic plugins that one would put on cpan
10:42 rshadow joined #mojo
10:43 Lee mat: it's more about loose coupling, if you wrap your model around the framework your in for pain later (and the ORM is not your model BTW)
10:44 Lee s/your/you're/
10:44 Lee but anyway
10:44 * Lee gets back to work
10:44 sri yea, you make the framework be not MVC anymore
10:52 salv0 joined #mojo
10:52 salv0 joined #mojo
10:54 sugar joined #mojo
11:08 irqq_ joined #mojo
11:53 sugar joined #mojo
12:13 stryx` joined #mojo
12:28 kwa sri: Would you be up for a PR that prepends "pod-" before all of the #IDs in perldoc.html.ep? I have a method named "source" and it looks fugly because it picks up padding from https://github.com/kraih/mojo/blob/cf8fd092bb4bd77e9b027203f3e0a432aa3b6ccb/lib/Mojolicious/resources/templates/mojo/perldoc.html.ep#L79
12:31 sri kwa: depends on the cost
12:36 khfeng joined #mojo
12:37 sugar joined #mojo
12:37 charper joined #mojo
12:40 kwa sri I'd hope there would be little ramifications, but thought I'd check with you before I spent any time on it.
12:49 charper Hello, just looking for someone to point me in the right direction.  I have an image that is stored it a scalar which i then stached, but in the template when i want to display the image i have tried <ima src = <%= $image %> but it didnt render anything and i also just tried <%= $image %> but it just prints png. and some random data
12:50 charper im not sure of the termanology to use when searching for what i need
12:51 sri charper: sounds like you want to inline the image base64 encoded
12:52 sri <img src="data:image/png;base64,<%= b($image)->b64_encode %>">
12:58 charper ok thank, i dont know how you all know those things, but if it works i do to now
12:59 sri i studied the html5 spec when preparing to write an html5 parser :)
13:02 charper It worked wonderfully, thank you so much...  I have a look thought myself and see what other gems i can find there...  Thank you so much
13:02 charper I love mojo community
13:02 charper everyone is super helpful and never makes idiots like me actually feel like an idiot ;-)
13:04 * coolo is tempted to yell idiot right now - now idea why :)
13:04 coolo s,now,no
13:04 coolo aehm - only the second now. Whatever :)
13:11 charper joined #mojo
13:11 charper joined #mojo
13:13 sugar joined #mojo
13:19 coolo joined #mojo
13:36 perlpilot joined #mojo
13:59 gryphon joined #mojo
14:06 sugar joined #mojo
14:31 gizmomathboy joined #mojo
14:38 gryphon joined #mojo
14:46 itaipu joined #mojo
14:46 sugar joined #mojo
15:18 jberger So guess what?
15:19 jberger Today is my 4th Mojoversary \o/
15:29 cfedde joined #mojo
15:32 * ranguard comforts jberger :)
15:40 CandyAngel joined #mojo
15:41 sh14 joined #mojo
15:42 CandyAngel Just thought you might be interested to know that 7.26 installs fine and the test suite doesn't break on websocket for me anymore.
15:47 CandyAngel I mean, proxied websocket.
15:47 CandyAngel left #mojo
15:58 disputin joined #mojo
16:01 pink_mist happy Mojoversary jberger! =)
16:07 sugar joined #mojo
16:17 kes joined #mojo
16:17 itaipu joined #mojo
16:20 kes It will be very helpful if PODRenderer will have option to generate index.html with link to all found and generated POD documentation pages
16:20 kes Like this: http://mojolicious.org/perldoc/#REFERENCE
16:20 kes plugin PODRenderer => { index => 1 };
16:35 jberger kes that is hand-built IIUC
16:36 kes yes. Will be useful if it will be automated to not hand build content index
16:37 jberger kes: how would you do it?
16:38 jberger that would be a major project, and I wish you luck on it
16:38 jberger I doubt any of us has the time
16:38 jberger jabberwok: has something he might show off if he wants
16:39 jabberwok =nod=   i'm checking it now
16:41 sugar joined #mojo
16:42 jabberwok http://wlindley.com/mojo/Mojo.html   is created by https://github.com/lindleyw/pod-index
16:43 jabberwok modules are found recursively by file.  No attempt is made at discovering the inheritance hierarchy.
16:44 stryx` joined #mojo
16:45 marty_ joined #mojo
17:07 sugar joined #mojo
17:31 Janos joined #mojo
17:36 stryx` joined #mojo
17:38 gregf_ joined #mojo
17:39 lluad joined #mojo
18:01 stryx` joined #mojo
18:27 rshadow joined #mojo
18:40 rloveland joined #mojo
18:40 lluad joined #mojo
18:56 wippler joined #mojo
18:57 wippler hello, I have a question on passing DB connection attributes to a route, where can I post my sample code to show what I am trying to do?
18:59 pink_mist gist.github.com
18:59 purl gist.github.com is nice to inline pastes WHEN GITHUB WORKS
19:03 stryx` joined #mojo
19:06 wippler I am setting up two DB connection and I am trying to get to one of them, is this the right approach? Thank you! Sample code is here: https://gist.github.com/anonymous/0d01fb7dfee5a64e8832b1f94f84b5ed
19:08 preaction wippler: no. i'd store them in two different attributes, or if you want to do this, use a regular hashref, not $c->param. so, line 14 could be my $dbh = { ms_dbh => ..., orac_dbh => ... }; instead
19:16 wippler Going to try that, thanks for that!
19:20 Janos hey there, working on a small webapp with mojo. This app needs to connect to an Asterisk via AMI. I was thinking of using Mojo::IOLoop::Client to make the connexion async. But have a couple of questions about how to proceed
19:21 Janos Should I use mojo's own IOLoop maybe get it with Mojo::IOLoop->singleton ? or start my own loop for this ?
19:21 Janos pros/cons of the two approaches ?
19:22 pink_mist without a doubt use the singleton
19:22 stryx` joined #mojo
19:22 pink_mist if you don't, you'll block that loop
19:22 pink_mist and so you might just not be doing things async anyway
19:24 charper joined #mojo
19:24 vicash joined #mojo
19:24 Janos thanks a lot, singleton it's then
19:30 jberger Janos: are you using your own code or are you using the Asterisk::AMI that's on cpan?
19:31 jberger because that module is really hard to use async with other things (it uses condvars rather than proper loop techniques)
19:31 Janos I'm trying to implement my own, didn't think I could make Asterisk::AMI would play well with async
19:32 jberger yup, well spotted
19:33 Janos I did find this https://github.com/Prajithp/mojo-ami on github which seems pretty similar to what I want to build, but not sure how well it plays and there is no license so no idea if it can be used ...
19:34 mib_kayj8c joined #mojo
19:34 Janos right now I'm trying to base myself on Mojo::Pg and Mojo::IOLoop::LineReader
19:35 preaction Janos: the license on that is Artistic 2
19:36 preaction (the Makefile.PL and the .ship.conf both declare that)
19:36 Janos ahh thanks a lot
19:36 sugar joined #mojo
19:36 preaction it's not on cpan though, so who knows if they expect it to be used or not
19:41 disputin joined #mojo
19:41 polettix joined #mojo
19:43 Janos I'll give a try and see how it plays, I can always PR the changes back and and see if they get accepted
19:46 Janos now for this would it make sense to extend Mojo::IOLoop::Client or just keep an instance around for the interaction (i know the question is ambiguous, again just wondering about pros/cons)
19:47 tyldis Dell's site is useless. Keeps crapping out.
19:47 tyldis Been for a week
19:49 sugar joined #mojo
20:05 rshadow joined #mojo
20:07 rshadow joined #mojo
20:15 sugar joined #mojo
20:23 rloveland joined #mojo
20:35 lluad joined #mojo
20:39 sugar joined #mojo
20:55 kgoess joined #mojo
21:00 lluad joined #mojo
21:12 marty joined #mojo
21:18 sugar joined #mojo
21:47 lluad joined #mojo
21:48 sri salva: i strongly suggest you get the unix domain socket thing ready for discussion tomorrow, this week is a very unique opportunity to get stuff done
21:48 sri next week i would have to reject until the patch is 100% what we want, this week i can help clean it up
21:51 PopeFelix So how does Mojo::UserAgent know to connect to a proxy? Just by the presence of $ua->proxy->$scheme ?
21:53 marty joined #mojo
21:54 PopeFelix oh, i see
21:54 PopeFelix $ua->proxy->prepare($tx)
21:58 rshadow joined #mojo
22:33 lluad joined #mojo
22:37 mcsnolte joined #mojo
22:45 marty joined #mojo
23:07 marty joined #mojo
23:32 lluad joined #mojo
23:34 PopeFelix So I have a bug in Mojo::UserAgent::Mockable - it doesn't handle proxies properly in playback mode. What I see the caller doing is (e.g.) POST, CONNECT, then POST, but what I'm recording is CONNECT, POST, then POST.
23:34 PopeFelix It seems obvious that Mojo::UserAgent is setting up the proxy then re-sending the POST.
23:34 PopeFelix Is there an easy way to distinguish between the pre-proxy POST and the post-proxy POST?
23:44 tinita hi, i think i found a bug in Mojo::Home
23:44 tinita https://github.com/kraih/mojo/blob/master/lib/Mojo/Home.pm#L17
23:44 tinita if blib is in there, 2 elements need to be popped
23:44 tinita because blib/lib/...
23:45 tinita have no simple test case so far though
23:45 * tinita sleep &
23:46 PopeFelix tinita, that's kind of a weird edge case.
23:46 PopeFelix i think
23:46 tinita it happens for us when we do dzil test
23:46 PopeFelix interesting
23:46 sugar joined #mojo
23:47 tinita really need to sleep now though, spent 3 hours on deugging this =)
23:47 PopeFelix lol
23:47 PopeFelix Submit a bug
23:47 PopeFelix because just mentioning it and going to bed probably won't get it looked at :)
23:48 Grinnz i believe the old implementation had a 'while'
23:48 litwol i wonder.. i'm new to all of this, but i feel like /proxy/ related things have been discussed disproportionally a lot lately.
23:48 tinita i hope i can delegate this to a colleague, actually not my project at the moment ;-)
23:48 * PopeFelix says as he mentions things here, having to leave soon
23:48 litwol what are they being used for to make them so useful.. or at least widely used?
23:48 PopeFelix litwol, we use them at my job so that the api's we connect to need only whitelist a few IP's.
23:50 litwol i c
23:56 PopeFelix I see *why* I'm recording the POST twice. I record a transaction on its "finish" event.

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