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

IRC log for #mojo, 2017-02-07

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

All times shown according to UTC.

Time Nick Message
00:27 marty_ joined #mojo
00:36 sword_smith joined #mojo
00:36 sword_smith_ joined #mojo
01:04 aborazmeh joined #mojo
01:49 bpmedley joined #mojo
03:07 tchaves joined #mojo
03:55 ivi_ joined #mojo
04:08 kaare joined #mojo
04:30 tyldis We *are* using an equivilent of AOL keywords these days, aren't we? I mean, for the regular user it's all some hastag on some site.
04:36 dikim joined #mojo
04:59 dikim joined #mojo
05:00 dikim joined #mojo
05:01 dikim joined #mojo
05:01 dikim joined #mojo
05:02 dikim joined #mojo
05:03 dikim joined #mojo
05:04 dikim joined #mojo
05:04 stryx` joined #mojo
05:04 dboehmer joined #mojo
05:05 dikim joined #mojo
05:05 dikim joined #mojo
05:06 dikim joined #mojo
05:56 kaare_ joined #mojo
06:15 disputin joined #mojo
06:27 eseyman joined #mojo
07:03 Grinnz joined #mojo
07:18 Vandal joined #mojo
07:22 dod joined #mojo
07:23 jabberwok joined #mojo
07:25 kes joined #mojo
07:28 dod joined #mojo
07:44 AndrewIsh joined #mojo
08:10 jamesaxl joined #mojo
08:16 howitdo joined #mojo
08:26 trone joined #mojo
09:05 polettix joined #mojo
09:18 Ryoga joined #mojo
09:21 sivoais joined #mojo
09:21 jnbek joined #mojo
09:24 polettix joined #mojo
09:41 hartenfels joined #mojo
09:46 Ryoga joined #mojo
10:08 kes If Content-Type is 'application/json' how to figure out that there is error in json?
10:09 kes it seems that error just ignored at the moment
10:09 kes and not available after: $self->req->json
10:10 Lee return a 400 bad request if there's no JSON
10:11 nic I bet you could construct a one-liner to illustrate what you mean
10:11 Lee kes: are you writing JSON based API code?
10:11 kes yes
10:12 Lee then look at Mojolicioous::Plugin::OpenAPI as it will provide input/output validation
10:12 nic and is the awesome
10:12 Lee s/oou/ou/
10:12 ccakes joined #mojo
10:12 nic oh
10:12 nic you weren't referring to the fork called Mojolicioous?
10:13 Lee :)
10:13 nic I have already claimed the namespace Mojoliciuos btw
10:13 kes nic: http://paste.scsys.co.uk/549814
10:13 Lee but what about Moojolicious and Mooseolicious?
10:14 nic both already taken
10:14 nic kes: Are you saying you're getting undef for $self->req->json ?
10:15 kes yes, I got undef, but want to display error message, to point where the error is
10:16 kes not just like: render->( text => 'JSON is wrong' ) unless $j;
10:16 nic and what do you get for $self->req->body ?
10:16 kes {asdf:1234}
10:17 nic sounds like you have everything you need
10:17 kes the error is I should place " around asdf
10:17 kes Does mojolicioius has error massage for that?
10:21 nic If it was me I'd find that the submitted json doesn't satisfy validation and I'd spit back the submitted body (with a 400)
10:21 nic (or I might just spit back the 400 and let the client work out what they screwed up)
10:23 Ryoga joined #mojo
10:32 irqq joined #mojo
11:05 kes nic: Ok
11:26 Ryoga joined #mojo
11:29 woz joined #mojo
11:32 itaipu joined #mojo
11:45 DavidSouza joined #mojo
11:56 tchaves joined #mojo
12:10 polettix joined #mojo
12:18 gryphon joined #mojo
12:23 woz joined #mojo
12:24 woz joined #mojo
12:40 woz joined #mojo
12:53 marty joined #mojo
12:59 polettix joined #mojo
13:02 Lee_ joined #mojo
13:03 dboehmer_ joined #mojo
13:03 hartenfels joined #mojo
13:06 kgoess_ joined #mojo
13:10 gizmomathboy joined #mojo
13:18 bit_shifter joined #mojo
13:19 chandwki joined #mojo
13:20 mishanti1 joined #mojo
13:21 charsbar joined #mojo
13:24 CHYC joined #mojo
13:28 irqq_ joined #mojo
13:31 lluad joined #mojo
13:35 woz joined #mojo
13:43 mbudde joined #mojo
13:46 asarch joined #mojo
13:46 bc547 joined #mojo
14:09 Ryoga joined #mojo
14:13 woz joined #mojo
14:20 Lee joined #mojo
14:22 Pyritic joined #mojo
14:47 woz joined #mojo
15:10 mcsnolte joined #mojo
15:18 woz joined #mojo
15:21 perlpilot joined #mojo
15:43 sh14 joined #mojo
15:49 PryMar56 joined #mojo
15:51 zivester joined #mojo
15:57 woz joined #mojo
16:09 Ryoga joined #mojo
16:27 polettix joined #mojo
16:32 woz joined #mojo
16:41 disputin joined #mojo
17:24 polettix joined #mojo
17:39 sugar joined #mojo
17:50 tchaves joined #mojo
18:26 woz joined #mojo
18:31 dod joined #mojo
18:55 woz joined #mojo
19:21 kes Mojolicious::Commands is the interactive command line interface for the Mojolicious framework. It will automatically detect available commands in the Mojolicious::Command namespace.
19:21 kes Do I still required to use 'M:C:my_command'?
19:22 Grinnz https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Adding-commands-to-Mojolicious explains how to make commands under your own application
19:27 kes I did not lowercase module name (
19:27 kes M:C:MyCommand
19:29 kes why it is not automatically converted to: my_command? like Controller names
19:30 kes ->to( 'my_controller#' )  ->to( 'MyController#' )
19:30 Grinnz the name of your commands is up to you, lowercase is just a commandline convention
19:35 kivilahtio hi! I am baning my head against the Mojolicious::Plugin::OpenAPI big time. I am trying to debug why my controller is not found even if the route has the following $route->to('controller#subroutine').
19:36 kivilahtio is there any way to find out what is the exact module::subroutine Mojolicious calls with the route?
19:36 kivilahtio I already tried the perl script/app.pl routes -v
19:37 kivilahtio and that simply returns the route names and URLs but not the exactl Controller::Subroutine combinations
19:37 kivilahtio using Match also returns the values from stash, not the real targeted Controller::Subroutine
19:49 kivilahtio Where should I set a debugger breakpoint so I can intercept the subroutine call which calls the Contoller?
19:52 jberger kivilahtio have you tried setting x-mojo-to?
19:53 kivilahtio jberger: yes
19:53 jberger are you sure that you render something?
19:53 kivilahtio jberger: When I think I have properly set the x-mojo-to, it freezes
19:53 jberger freezes?
19:53 purl freezes are only the last two days
19:53 kivilahtio jberger: I simply get no return value
19:53 jberger what do you mean by return value?
19:53 kivilahtio it waits for some seconds, and then returns undef
19:54 jberger controller action return values are ignored
19:55 kivilahtio jberger: a sec I prepare a pastebin :)
19:55 jberger yeah, we need to see some code
19:56 jberger pastebin.com isn't preferred though
19:56 jberger giant annoying video ads
19:56 kivilahtio jberger: why is that?
19:56 kivilahtio really?
19:56 kivilahtio jberger: what do you suggest?
19:56 jberger gist.github.com is my preferred
19:56 jberger plus they can be updated, they are actually git repos under the hood
19:57 genio gist is pretty awesome
19:58 kivilahtio jberger: http://pastebin.com/epGRHzvQ
19:58 kivilahtio jberger: I ll make the next one in gist
19:58 jberger do you really not see a giant video ad at the top?
19:58 kivilahtio nope
19:58 kivilahtio I don't even use adblock
19:58 kivilahtio hmm , there is a small viedeo add on the sidelines
19:59 jberger anyway, several problems in your paste
19:59 jberger @@swagger.yaml@@ isn't right
20:00 jberger it would be @@ swagger.yaml
20:00 jberger and then you reference it at swagger/v1/swagger.yaml
20:00 kivilahtio jberger: sorry, just highlighted the important bits
20:00 jberger which isn't where that file would be
20:00 kivilahtio jberger: this is not mojo::lite
20:00 kivilahtio actually you can take a look at github
20:02 jberger is that your entire api definition (yaml)?
20:02 jberger that single line isn't enough to work
20:04 irqq joined #mojo
20:06 kivilahtio jberger: https://gist.github.com/kivilahtio/7d536d26d4c31c5ea623076f22b03310
20:06 kivilahtio jberger: I know, sorry for pasting a bit. The pec is rather long so I didnät want to spam too much
20:07 kivilahtio jberger: here is the latest code which causes this "Premature connection close"
20:08 kivilahtio jberger: the OpenAPI spec validates using https://app.swaggerhub.com
20:08 jberger the state of YAML parsers in perl isn't great
20:08 jberger (especially sad given YAML's historical connection with Perl)
20:08 kivilahtio jberger: we used Mojolicious::Plugin::Swagger2 when it was still in it's infancy. I am sad to see it go :(
20:09 kivilahtio jberger: to me it looks like it parses ok
20:09 kivilahtio jberger: debugging through /usr/local/share/perl/5.22.1/Mojolicious/Plugin/OpenAPI.pm _add_routes
20:09 jberger heh, I have to tell you, I encouraged batman to replace it with the mechanism that the new plugin uses
20:09 kivilahtio and I dont see a problem with missing data
20:09 jberger indeed we dreamed it up sitting in my office
20:10 kivilahtio jberger: using the openapi-handler is a  nice idea instead of the old closures
20:10 kivilahtio but I am bombasted. I have no idea why this doesnät work
20:11 jberger does it enter the controller?
20:11 kivilahtio the namespaces available are PatronStore and PatronStore::Controller
20:11 kivilahtio jberger: no
20:11 kivilahtio jberger: Not even the under-route
20:12 kivilahtio jberger: it is as if when the controller#action is misconfigured, it says 501, not implemented
20:12 kivilahtio jberger: but when it is properly configured, it just "Premature connection close"
20:13 kivilahtio jberger: hence I was asking how can I intercept the Mojolicious dispatcher prior to it calling the controller::subroutine?
20:13 woz joined #mojo
20:13 kivilahtio because the definitions should be correct
20:14 jberger well, I don't see anything immediately obvious
20:14 jberger I'd suggest you take the question to #swagger
20:14 dod joined #mojo
20:16 kivilahtio jberger: Ill try if I can get more insight using the around_Action-hook
20:27 Pyritic joined #mojo
20:45 ferreira joined #mojo
20:48 ferreira batman: thanks again for the feedback on LineReader the other day. Current code is https://github.com/aferreira/cpan-MojoX-LineReader/blob/devel/Mojo-IOLoop-LineReader/lib/Mojo/IOLoop/LineReader.pm and docs https://github.com/aferreira/cpan-MojoX-LineReader/blob/devel/Mojo-IOLoop-LineReader/lib/Mojo/IOLoop/LineReader.pod
20:48 ferreira I've kept the use of in-core files to preserve the semantics of line-breaking of <> operator
20:49 ferreira The difference is mainly about handling $/ = '' and  $/ = undef
20:50 kiwiroy joined #mojo
20:51 ferreira for all, does the Mojo::IOLoop::LineReader module name seems ok?
21:04 jberger ferreira: are you sure that shouldn't be a subclass of stream?
21:05 jberger it sure seems to delegate to the stream quite a but
21:05 jberger bit
21:06 jberger though maybe I see why if you have to intercept the close event
21:15 sugar joined #mojo
21:23 kermi joined #mojo
21:23 matt___ joined #mojo
21:24 lluad joined #mojo
21:26 matt___ https://metacpan.org/pod/Mojolicious::Plugin::DefaultHelpers#delay
21:26 matt___ what is the purpose of this undef $tx pattern?
21:26 matt___ should I do this *after* i write my response, and not before?
21:26 matt___ im guessing it closes the socket via destroy but im not sure
21:27 kivilahtio Setting the MOJO_LOG_LEVEL=debug helped me a lot. Not after I had made a pull request to increase the verbosity of the error :)
21:32 woz joined #mojo
21:37 kivilahtio jberger: Thanks for your help. I managed to fix this problem by adding a breakpoint to a custom around_action-hook and getting in to see how the controller name got constructed. Looks like I had a namespace configuration which added too many sub-packages to the ones defined in the x-mojo-to already.
21:37 kivilahtio So I got namespace 'PS::Controller::Api::V1', controller 'Api::V1::Auth'
21:38 kivilahtio which ended up as PS::Controller::Api::V1::Api::V1::Auth
21:38 kivilahtio which was not nice
21:38 kivilahtio also setting the MOJO_LOG_LEVEL=debug helped a ton
21:38 kivilahtio this is how one forgets all the useful things in time
21:46 jberger ah I see
21:46 jberger matt___: it is to keep a strong reference to the transaction
21:46 jberger otherwise it will be closed
21:47 jberger what is actually more important is that $tx exists at all
21:47 jberger the undef $tx is just cute :D
21:47 matt___ jberger: gotcha. thanks
22:05 woz joined #mojo
22:08 woz joined #mojo
22:22 woz joined #mojo
22:22 woz joined #mojo
23:00 woz joined #mojo
23:00 ferreira jberger: I was trying so hard to use has-a relationships that failed to realize this was perfect for a simple is-a - code shrunk when I did that https://github.com/aferreira/cpan-MojoX-LineReader/blob/devel/Mojo-IOLoop-LineReader/lib/Mojo/IOLoop/LineReader.pm
23:04 sugar joined #mojo
23:08 jberger ferreira: neat! glad I could help
23:08 bpmedley joined #mojo
23:26 gizmomathboy joined #mojo
23:29 sword_smith joined #mojo

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