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

IRC log for #mojo, 2016-12-29

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

All times shown according to UTC.

Time Nick Message
00:09 howitdo joined #mojo
00:27 sri guess i won't be getting another monitor
00:39 Grinnz i got monitor stands because my new chair was several inches higher, it actually made a bit of room on my desk and i could put my speaker in front of my monitor
00:40 * sri uses a monitor arm, but doesn't like putting it too high
00:40 sri one of those super adjustable dell arms
00:42 sri a 15 inch laptop would have to stand in front of the monitor :S
00:44 Grinnz my monitors are only 24" of course, i was thinking of getting a 27" but i decided 144hz was worth more to me, and higher resolution/larger screens weren't
00:45 Grinnz a 27" would work now with my monitor stands, but 2 27" would be iffy
00:45 Grinnz also since i stopped using my laptop that helped :P
00:46 Grinnz actually i lied. i didnt get the monitor stands because of my chair, i got them because i moved my keyboard+mouse onto the desk instead of the keyboard tray, so that i could use my full mouse pad for overwatch
00:53 sri i'm currently using one 27" 4k monitor
00:54 sri and two laptops on the sides
00:54 sri thinking that maybe i need a curved desk or so
00:54 Grinnz two laptops! http://i2.kym-cdn.com/photos/images/newsfeed/000/117/814/are-you-wizard.jpg
00:55 sri ;p
01:16 marty joined #mojo
01:44 asarch joined #mojo
01:49 yukikimoto joined #mojo
02:54 dexteruk joined #mojo
02:57 dexteruk Hi Everyone, im having a problem understanding how i recieve a restful post and pass that data to websocket /message interenally
03:02 cpan_mojo Mojo-Webqq-2.0.0 by SJDY https://metacpan.org/release/SJDY/Mojo-Webqq-2.0.0
03:13 cpan_mojo Mojolicious-Plugin-Subprocess-0.001 by DBOOK https://metacpan.org/release/DBOOK/Mojolicious-Plugin-Subprocess-0.001
03:15 Grinnz ^ should you end up wanting to use the namespace, I'll be happy to transfer it
03:18 marty joined #mojo
03:21 dexteruk|2 joined #mojo
03:27 cpan_mojo Mojo-IOLoop-Subprocess-Sereal-0.004 by DBOOK https://metacpan.org/release/DBOOK/Mojo-IOLoop-Subprocess-Sereal-0.004
03:49 noganex_ joined #mojo
04:55 yukikimoto joined #mojo
05:04 dboehmer_ joined #mojo
05:35 howitdo joined #mojo
05:55 inokenty-w joined #mojo
06:21 marty joined #mojo
06:24 bpmedley joined #mojo
06:47 Vandal joined #mojo
06:59 parv joined #mojo
07:57 dod joined #mojo
08:01 rshadow joined #mojo
08:02 dod joined #mojo
08:22 marty joined #mojo
08:33 osfabibisi joined #mojo
09:10 dod joined #mojo
09:21 dexteruk|2 Anyone around?
09:23 * parv lacks mojo specific knowledge
09:27 dexteruk|2 I cannot find any information on this but probably im not using the right terminology.  I have a route that handles incoming webhooks but i want to pass that information to websocket /
09:28 dexteruk|2 and i cannot seem to find aways all the other examples of websockets i can fine us a route / => 'index' and some jquery code i need this to be purly backend
09:51 pink_mist "passing" to websocket? you mean you want some data to be sent over all open websockets?
09:55 pink_mist have a look at the chat example on how to send data to all open websockets: https://github.com/kraih/mojo/blob/master/examples/chat.pl
10:11 sugar joined #mojo
10:11 howitdo joined #mojo
10:17 dexteruk|2 pink_mist: basically i have an incoming message from a websocket client, i forward that message to a api on a different server, when i get a responce from the remote API it sents it to a webhook i want to pass that information back to websocket
10:19 dexteruk|2 everything working, i get the data back from the webhook, that arrives in route '/webhook'  but how do i pass that data to the websocket /
10:19 pink_mist so register event handlers that deal with it and emit the events when you get the data
10:19 pink_mist like the chat example shows
10:21 dexteruk|2 pink_mist: ok thanks ill have a look, but yes that look promising ill go and have a look at the event emitter
10:22 dexteruk|2 pink_mist: thanks for pointing me in the right direction :-D
10:22 dexteruk|2 Have a wonderful new year
10:24 marty joined #mojo
10:26 rshadow joined #mojo
10:40 henq joined #mojo
10:54 eseyman joined #mojo
11:03 henq good morning, newbie question: when I want some intitalization done in all controllers, do I override new() ?  Or use a hook?
11:03 sri you probably want to use a messae bus in the backend though
11:03 sri dexteruk|2: the event emitter only works for a single process
11:05 dexteruk|2 sri: im not sure what you mean by a message bus?
11:06 sri https://github.com/kraih/mojo-pg/blob/master/examples/chat.pl
11:07 sri https://st.aticpan.org/source/JHTHORSEN/Mojo-Redis2-0.26/examples/chat.pl
11:10 dexteruk|2 sri: ok nice
11:10 dexteruk|2 thank you
11:12 sri henq: or lazily initialized attribute accessors
11:13 sri or just keep the data at app level if all need it
11:19 henq thx, data is not the same for all controllers, the method to call is.  suppose i want the creation timestamp of each controller?
11:33 good_news_everyon joined #mojo
11:33 good_news_everyon [mojo] kraih pushed 2 new commits to master: https://git.io/vMk5x
11:33 good_news_everyon mojo/master 6be48cb Dan Book: prevent warnings whenever morbo checks broken symlinks
11:33 good_news_everyon mojo/master 2e14e44 Sebastian Riedel: Merge pull request #1025 from Grinnz/morbo-broken-link-warnings...
11:33 good_news_everyon left #mojo
11:40 tchaves joined #mojo
11:43 good_news_everyon joined #mojo
11:43 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vMkdB
11:43 good_news_everyon mojo/master ce3f89d Sebastian Riedel: fix formatting issues
11:43 good_news_everyon left #mojo
11:44 * sri rejects https://github.com/kraih/mojo/pull/1024
11:51 dod joined #mojo
12:16 ladnaV joined #mojo
12:26 marty joined #mojo
12:44 marty joined #mojo
13:17 kes joined #mojo
13:45 sugar joined #mojo
13:59 AndrewIsh joined #mojo
14:12 gryphon joined #mojo
14:48 sugar joined #mojo
14:57 gryphon joined #mojo
15:14 dod joined #mojo
15:35 disputin joined #mojo
15:35 sh14 joined #mojo
16:03 hernan604 is it possible to set the routes in the controllers ?
16:06 jberger it is technically possible (search "mojolyst" on google) but I don't recommend it
16:07 jberger debugging a decentralized router sounds really painful
16:07 batman hernan604: you need to set up the routes before the first request.
17:09 howitdo joined #mojo
17:16 howitdo joined #mojo
17:22 sri batman: there are ways around that... mojolyst
17:36 kes In one place of documentation exception is recognized as: $template = $args->{template}; in other: $e = $c->stash('exception')
17:36 kes what is the right way to check that exception occur?
17:39 disputin joined #mojo
17:44 jberger kes where is exception called template?
17:44 jberger oh, probably the before_render hook
17:44 Grinnz https://metacpan.org/pod/Mojolicious::Guides::Rendering#Rendering-exception-and-not_found-pages
17:44 Grinnz i think is what he's referring to
17:44 jberger that's checking if the template to be rendered is called "exception"
17:45 Grinnz where would you check $c->stash('exception')?
17:45 rshadow joined #mojo
17:46 Grinnz or put another way: in what other circumstance would you even get a chance to check for an exception being rendered?
17:47 Grinnz this normally only happens because an exception was thrown and not caught by your code
17:48 Grinnz or i suppose if you call $c->reply->exception?
17:49 kes you ask jberger or me?
17:49 Grinnz you
17:49 Grinnz the before_render is a way to catch all exceptions, because it will run even if the exception is the result of a die
17:50 kes I do not know, I am looking the way to handle exception which are raised somewhere in controller
17:50 kes http://mojolicious.org/perldoc/Mojolicious/Guides/Routing#Hooks
17:50 kes Or more advanced extensions to add monitoring to your application.
17:50 kes It seems the best way
17:50 Grinnz ah i see, the after_dispatch example
17:51 kes Why in before render we check template key and not stash('exception'). I am confused a bit here
17:52 kes And I do not find doc about how stash('exception') and where is setted up
17:52 Grinnz https://metacpan.org/pod/Mojolicious::Plugin::DefaultHelpers#reply-exception mentions that 'exception' is added to the stash
17:53 Grinnz I am not sure if there is a reason it's checked differently
17:53 kes but if in the controller/somewhere in code will exception like: die or maybe 1/0
17:53 kes is it will be too?
17:54 kes *will it be too?
17:55 Grinnz yes, it uses ->reply->exception for die also
17:55 Grinnz https://metacpan.org/source/SRI/Mojolicious-7.12/lib/Mojolicious.pm#L196
17:55 kes I have found this too just now)
17:55 kes but where is description in Doc? (
17:56 kes expects it should be described here: http://mojolicious.org/perldoc/Mojolicious
17:57 PryMar56 joined #mojo
17:57 kes hm.. it is: http://mojolicious.org/perldoc/Mojolicious#around_dispatch
17:58 kes but it is tooooo implicit (
18:12 batman sri: i don't see how mojolyst changes the routes after the first request...
18:13 jberger it doesn't, it preloads the controllers
18:22 disputin joined #mojo
18:29 gryphon joined #mojo
18:38 sri batman: oh, sorry, forgot which way i did mojolyst
18:39 batman no worries. just wasn't sure if i missed out on anything.
18:40 sri anyway, this is how you can set routes after the first request has already been processed http://mojolicious.org/perldoc/Mojolicious/Guides/Routing#Embed-applications
18:41 sri the router doesn't know what embedded apps do
18:43 kes What does this mean: that are not reserved stash values.   https://metacpan.org/pod/Mojolicious::Controller#param
18:51 Grinnz https://metacpan.org/pod/Mojolicious::Controller#stash
18:52 kes ah, thank you Grinnz
19:04 mcsnolte joined #mojo
19:09 tchaves joined #mojo
19:11 disputin joined #mojo
19:33 marty joined #mojo
19:40 good_news_everyon joined #mojo
19:40 good_news_everyon [mojo] kraih tagged v7.13 at 97e5ade: https://github.com/kraih/mojo/commits/v7.13
19:40 good_news_everyon left #mojo
19:41 good_news_everyon joined #mojo
19:41 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://github.com/kraih/mojo/commit/56e56bab27733da42ebb367c2880696b332a1950
19:41 good_news_everyon mojo/master 56e56ba Sebastian Riedel: bump version
19:41 good_news_everyon left #mojo
19:50 kes http://mojolicious.org/perldoc/Mojolicious#after_dispatch Here says:  (Passed the current controller object)
19:51 kes But in case of exception in current controller there passed default controller, not the current
19:51 kes is this OK?
19:59 good_news_everyon joined #mojo
19:59 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://github.com/kraih/mojo/commit/5f8e6e18a7d6e3c89c110ef49e7b0a10250c56f3
19:59 good_news_everyon mojo/master 5f8e6e1 Sebastian Riedel: use a shorter example to make the recipe look better
19:59 good_news_everyon left #mojo
20:00 kes hm... it even generates unexpected error message
20:00 kes How to reproduce: http://paste.scsys.co.uk/540410
20:02 karjala Now Mojolicious and AnyEvent have the same version number
20:03 Grinnz quick, release 7.14 so we know which is better
20:03 batman joined #mojo
20:12 marcus joined #mojo
20:13 marty joined #mojo
20:15 marty joined #mojo
20:21 marty joined #mojo
20:26 vaewyn joined #mojo
20:27 vaewyn Hey all... is there a way to get mojo's default ssl upgraded from SHA-1 easily? We are starting to see tools that won't talk to it anymore since they consider it "weak" in production we have real certs... but in development it would be nice if we could get the default to just work.
20:31 foristh sri: I upgraded from Mojolicious 5.x to 7.x; I noticed $self->req->param no longer returns @array with parameters names; instead I had to replace it with @{$self-req->params->names} - what was the reason to change this? [I'm just curious]
20:33 Grinnz https://github.com/kraih/mojo/wiki/Upgrading#upgrading-to-mojolicious-60
20:34 Grinnz the reason is because the API makes more sense this way, i think
20:34 Grinnz $params->param returning the parameter names was just a holdover from how CGI.pm historically did it
20:35 sri getting rid of wantarray is a security feature
20:37 foristh thanks, that makes sense
20:57 kes sri: Fix please DOC: http://mojolicious.org/perldoc/Mojo/Template#SYNTAX
20:57 kes <%== Perl expression, replaced with XML escaped result %>
20:57 kes should be: <%== Perl expression, replaced with result %>
20:58 sri kes: please go through other members of the core team first, i'll only take a look when they confirm your problem is valid
20:58 kes OK
20:59 kes jberger: May you look please? http://mojolicious.org/perldoc/Mojo/Template#SYNTAX
20:59 kes first paragraph: <%== Perl expression, replaced with XML escaped result %>
20:59 kes in second paragraph: <%== Perl expression, replaced with result %>
21:00 Grinnz yes, as the second paragraph says, that is the reversed behavior
21:00 jberger "Escaping behavior can be reversed with the "auto_escape" attribute, this is the default in Mojolicious .ep templates, for example."
21:02 kes maybe in example '% $self->auto_escape' should be used?
21:02 kes same as 'use' in third paragraph
21:03 Grinnz auto_escape would generally be set by the renderer not in the template
21:07 sri it literally can't
21:09 howitdo joined #mojo
21:29 sugar joined #mojo
21:33 vaewyn left #mojo
22:20 jberger sri: what are the odds of adding the ability to set the search paths on a Mojo::Pg instance from the url?
22:28 sri jberger: ¯\_(ツ)_/¯
22:29 jberger I guess its hard because it might have to create the schema first
22:29 jberger I'm trying to figure out how to do order of operations for lots of isolated tests
22:30 jberger and I'd rather not have to do the recipe every time (because some developer (probably me) later on is going to forget to do it)
22:30 sri i'd really like to simplify the pattern i currently use
22:31 sri https://github.com/kraih/mojo-pg/blob/master/t/results.t#L25-L28
22:31 sri the schema doesn't have to exist
22:33 sri not that having the schema in the url would make my pattern easier
22:33 sri since i need a unique one per test
22:33 jberger right, I'm getting there too
22:34 jberger could there be a subclass of Mojo::Pg that does the first dance at creation and has a DESTROY that cleans up?
22:34 sri only thing i can imagine is to turn the ->search_path() call and https://github.com/kraih/mojo-pg/blob/master/t/results.t#L27-L28 into a method
22:35 sri my $pg = Mojo::Pg->new($ENV{TEST_ONLINE})->with_temp_schema('mojo_results_tests')
22:35 jberger nice
22:35 jberger would it cleanup afterwards
22:35 jberger ?
22:35 sri yea, suppose it could remove the schema on destroy
22:36 stryx` joined #mojo
22:38 jberger that solves most of my problems, but I still would need to be able to set that temp_schema earlier, since I can't kill existing connections in the pool
22:39 sri ?
22:39 jberger unless ->with_temp_schema drops existing connections
22:39 jberger because the search path only applies to new connections
22:39 sri why do you already have existing connections?
22:40 jberger I can't promise that I don't, future proofing against junior developers
22:40 jberger my $t = Test::Mojo->new('MyApp');
22:40 sri well, i think you just blocked the feature then ;p
22:40 disputin joined #mojo
22:40 jberger heh
22:41 sri resetting the pool is a whole different discussion that i think will take a lot more time to discuss
22:41 * sri was about to make a patch
22:41 jberger I'd happily take a method that does that and call is separately
22:41 jberger call *it*
22:42 preaction isn't it already said that people shouldn't hold on to db connections because they could close at any time for no reason?
22:42 jberger $t->app->pg->with_temp_schema($test_name)->reset_pool;
22:43 jberger hmmm, that's a good point, cleaning the pool is hard because there might be connections that aren't in the pool when that is called
22:52 jberger anyway, I am always concerned that if something in the startup method creates a database connection then the search path trick doesn't work
23:02 jberger if the url could contain the temporary schema name it would help because I would know it was there from the beginning
23:02 jberger but the test file knows that name, not the configuration ... sigh
23:02 jberger (yes I'm thinking out loud)
23:16 howitdo joined #mojo
23:17 sri jberger: well, this is what i had https://github.com/kraih/mojo-pg/compare/with_temp_schema
23:18 sri you talked yourself out of getting it applied to master though ;p
23:19 sri figuring out the connection reset problem is now a dependency for it
23:36 jberger Ok I'll ponder that one

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