Re: [Mojolicious] Swagger2: "The World's Most Popular Framework for APIs"
Looks interesting Justin! How would you feel if i changed your code into a Swagger2 command and merged it into my project? You could also be co-auth, if you like... I've been thinking about a swagger (or swagger2 command), which could convert the API description into POD. Something like this: $ mojo swagger pod path/to/spec.json I guess if I could merge your module, there would also be a --version switch: $ mojo swagger json --version 1.2 lib/YourApp.pm Not sure if that makes any sense though, since my module is called Swagger2. On Wednesday, December 10, 2014 2:04:11 AM UTC+1, Justin Hawkins wrote: > > > On 10 Dec 2014, at 1:32 am, Jan Henning Thorsen > wrote: > > I'm working on a new module that takes advantage of the Swagger2 API > documentation format. > > https://metacpan.org/release/Swagger2 > https://metacpan.org/release/JHTHORSEN/Swagger2-0.03 (in case 0.03 isn't > visible from the line above) > > Features: > * Automatic route generation > * Input/output validation in your Mojoliicous applicaiton > * Swagger documentation to Perl documentation (POD) > * JSON Schema validation > > Plans: > * Add Swagger::Client which wraps around Mojo::UserAgent and enables > input/output validation > > Any feedback/ideas are very much appreciated. > > > > Hi Jan, > > Interesting idea! > > I hacked for a while on essentially the reverse - generate the swagger > JSON data from the Mojolicious routes + POD documentation. Thus the actual > code and inline documentation becomes the source of truth for your API > specification. > > Maybe I need to pick it up again :-) > > https://github.com/tardisx/mojolicious-command-swagger > > - Justin > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
Re: [Mojolicious] Swagger2: "The World's Most Popular Framework for APIs"
On 10 Dec 2014, at 1:32 am, Jan Henning Thorsen wrote: > I'm working on a new module that takes advantage of the Swagger2 API > documentation format. > > https://metacpan.org/release/Swagger2 > https://metacpan.org/release/JHTHORSEN/Swagger2-0.03 (in case 0.03 isn't > visible from the line above) > > Features: > * Automatic route generation > * Input/output validation in your Mojoliicous applicaiton > * Swagger documentation to Perl documentation (POD) > * JSON Schema validation > > Plans: > * Add Swagger::Client which wraps around Mojo::UserAgent and enables > input/output validation > > Any feedback/ideas are very much appreciated. > > Hi Jan, Interesting idea! I hacked for a while on essentially the reverse - generate the swagger JSON data from the Mojolicious routes + POD documentation. Thus the actual code and inline documentation becomes the source of truth for your API specification. Maybe I need to pick it up again :-) https://github.com/tardisx/mojolicious-command-swagger - Justin -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
Re: [Mojolicious] Re: Need advice with Mojo::IOLoop::Delay and segmentation faults
Hi! Please add error-checking code and see is it change anything. Also, I recommend you do add something like "warn 1;", "warn 2;", etc. between most lines to find out on which line perl crash. On Tue, Dec 09, 2014 at 03:14:28PM -0800, Scott wrote: > for my $email ( @emails ) { > my $tx = $ua->get( $bv . $email ); warn($tx->error->{message}), next if $tx->error; > my $res = $tx->res->json; > say Dumper $res; > } > > Mojo::IOLoop::Delay->new->steps( > sub { > my $delay = shift; > $ua->get( $bv . $_ => $delay->begin ) for @emails; > }, > sub { > my $delay = shift; > for my $tx ( @_ ) { warn($tx->error->{message}), next if $tx->error; > my $res = $tx->res->json; > say Dumper $res; > } > } > )->wait; > > I do have EV installed. Cool, but then please add 'use EV;' at beginning of your script, just to make sure it works. -- WBR, Alex. -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
[Mojolicious] Re: Need advice with Mojo::IOLoop::Delay and segmentation faults
Thanks Sebastian for the quick response. I have recompiled perl with perlbrew (5.20.0 > 5.20.1) on a fully up-to-date Kubuntu 14.04 and nothing has changed, same errors as before. Sam on the server which is perl 8.18.2. The entire script is: #!/usr/bin/env perl use Modern::Perl '2013'; use Mojo::UserAgent; use Data::Dumper; use Mojo::IOLoop::Delay; my $bv = '...'; my $ua = Mojo::UserAgent->new; my @emails = ( ... ); for my $email ( @emails ) { my $tx = $ua->get( $bv . $email ); my $res = $tx->res->json; say Dumper $res; } Mojo::IOLoop::Delay->new->steps( sub { my $delay = shift; $ua->get( $bv . $_ => $delay->begin ) for @emails; }, sub { my $delay = shift; for my $tx ( @_ ) { my $res = $tx->res->json; say Dumper $res; } } )->wait; I do have EV installed. I have several sites using the non-blocking ua code and until a few days ago it was fine. I use the mojo ua to send emails through another http api and still use mango (only until end of January and with a freeze on the MongoDB updates) on one site in non-blocking fashion with no problems. -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
[Mojolicious] Re: Need advice with Mojo::IOLoop::Delay and segmentation faults
> > Is this something to do with Perl itself? > That would be my first guess, but it could also be a bug in an XS module. -- sebastian -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
[Mojolicious] Need advice with Mojo::IOLoop::Delay and segmentation faults
I maintain sites that use email validation services through a http api. I use the Mojolicious delay non-blocking code. In the last day or so, I have had my delay processes hanging resulting in 502 errors (hypnotoad reverse proxy with nginx) and at time the http service returning numerous blank records. I blamed them at first, but when I switched to non-blocking code, it worked fine. I boiled down my code to a command line program: Mojo::IOLoop::Delay->new->steps( sub { my $delay = shift; $ua->get( $bv . $_ => $delay->begin ) for @emails; }, sub { my $delay = shift; for my $tx ( @_ ) { my $res = $tx->res->json; say Dumper $res; } } )->wait; At times it works great, and at other times I get errors: Segmentation fault (core dumped) and *** Error in `perl': double free or corruption (out): 0x7f9c4910 *** Aborted (core dumped) Some of you may know exactly what the problem is, but I can only guess. Is this something to do with Perl itself? For a workstation and server I use Ubuntu 14.04 and it is happening on both. I update as updates happen. I noticed in the apt log that libc6, libc6-dev updated a few days back. Since I use perlbrew, do I need to recompile my perl after certain packages are updated? Currentlty, I am using the most up-to-date Mojolicious. I read the changes before updating and test out on my workstation first, but I have not had a Perl problem before and I am not sure I am managing things correctly. Thanks for any advice, Scott K. -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
Re: [Mojolicious] Changes file
> > Deprecated Mojo::DOM::siblings > Alternative: Mojo::DOM::following_siblings and > Mojo::DOM::preceding_siblings. > (Is there a more appropriate word than "alternative"?) > If i consider something to be an alternative, it would be part of the deprecation warning. Like "Deprecated Mojo::Collection::pluck in favor of Mojo::Collection::map". Pretty much all deprecations are usually discussed in GitHub issues or on IRC though, and you can find more background information there. http://irclog.perlgeek.de/mojo/2014-12-09#i_9778002 In the case of Mojo::DOM::siblings, there was simply nobody who could come up with a use case. -- sebastian -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
Re: [Mojolicious] Changes file
On Tue, Dec 9, 2014 at 9:29 AM, sri wrote: > Well, it would require that changes to Changes adhere to some agreed upon >> convention of course... :) >> > > I try to give every Changes entry the same prefix > (Improved/Fixed/Deprecated...) and would love to see a wiki page with more > detailed upgrade instructions. > But i think it would have to be done manually and add more details/extra > examples, to actually be worth it. > I have been following Mojolicious pretty religiously for over two years now. I'd be happy to commit to doing this, but I don't know that I understand changes well enough to devise examples. It generally takes me much longer to have that "aha" moment of the impact of such an improvement/fix/deprecation. Nevertheless, I would be more than willing to keep such a wiki updated to the best of my ability and perhaps at some point someone else would see the value who is more qualified to maintain it. As an example for a recent occurrence: Deprecated Mojo::DOM::siblings Alternative: Mojo::DOM::following_siblings and Mojo::DOM::preceding_siblings. (Is there a more appropriate word than "alternative"?) I would then link to commits, reference versions (effective 5.69, IIRC), and link to appropriate sections in documentation. Generally your changes also incorporate examples, so I reckon I wouldn't need an example for the new methods, but perhaps in showing something to the effect of what one used to do (e.g. render(partial=>1)) and what one should now do (e.g. render_to_string()) and then link to the doc for the latter. Does that sound about right and sufficient for what you were thinking would be necessary and desirable? -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
Re: [Mojolicious] Changes file
> > Well, it would require that changes to Changes adhere to some agreed upon > convention of course... :) > I try to give every Changes entry the same prefix (Improved/Fixed/Deprecated...) and would love to see a wiki page with more detailed upgrade instructions. But i think it would have to be done manually and add more details/extra examples, to actually be worth it. -- sebastian -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
[Mojolicious] Swagger2: "The World's Most Popular Framework for APIs"
Hi, I'm working on a new module that takes advantage of the Swagger2 API documentation format. https://metacpan.org/release/Swagger2 https://metacpan.org/release/JHTHORSEN/Swagger2-0.03 (in case 0.03 isn't visible from the line above) Features: * Automatic route generation * Input/output validation in your Mojoliicous applicaiton * Swagger documentation to Perl documentation (POD) * JSON Schema validation Plans: * Add Swagger::Client which wraps around Mojo::UserAgent and enables input/output validation Any feedback/ideas are very much appreciated. -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.