commit perl-Mojolicious for openSUSE:Factory
Hello community, here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2017-02-22 13:52:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Mojolicious" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes 2017-02-16 16:46:14.463832425 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2017-02-22 13:52:11.503782347 +0100 @@ -1,0 +2,10 @@ +Fri Feb 17 06:53:45 UTC 2017 - coolo@suse.com + +- updated to 7.26 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 7.26 2017-02-15 + - Fixed bug in Mojo::IOLoop::Subprocess where starting multiple subprocesses + at once could cause expcetions. (jberger) + +------------------------------------------------------------------- Old: ---- Mojolicious-7.25.tar.gz New: ---- Mojolicious-7.26.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.GxAnWz/_old 2017-02-22 13:52:11.975715183 +0100 +++ /var/tmp/diff_new_pack.GxAnWz/_new 2017-02-22 13:52:11.975715183 +0100 @@ -17,14 +17,14 @@ Name: perl-Mojolicious -Version: 7.25 +Version: 7.26 Release: 0 %define cpan_name Mojolicious Summary: Real-time web framework License: Artistic-2.0 Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Mojolicious/ -Source0: http://www.cpan.org/authors/id/S/SR/SRI/%{cpan_name}-%{version}.tar.gz +Source0: https://cpan.metacpan.org/authors/id/S/SR/SRI/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ Mojolicious-7.25.tar.gz -> Mojolicious-7.26.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/Changes new/Mojolicious-7.26/Changes --- old/Mojolicious-7.25/Changes 2017-02-09 22:31:27.000000000 +0100 +++ new/Mojolicious-7.26/Changes 2017-02-15 20:01:08.000000000 +0100 @@ -1,4 +1,8 @@ +7.26 2017-02-15 + - Fixed bug in Mojo::IOLoop::Subprocess where starting multiple subprocesses + at once could cause expcetions. (jberger) + 7.25 2017-02-09 - Fixed cleanup bugs in Mojo::IOLoop::Stream. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/META.json new/Mojolicious-7.26/META.json --- old/Mojolicious-7.25/META.json 2017-02-09 23:50:51.000000000 +0100 +++ new/Mojolicious-7.26/META.json 2017-02-16 00:08:28.000000000 +0100 @@ -58,6 +58,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "7.25", + "version" : "7.26", "x_serialization_backend" : "JSON::PP version 2.27400" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/META.yml new/Mojolicious-7.26/META.yml --- old/Mojolicious-7.25/META.yml 2017-02-09 23:50:51.000000000 +0100 +++ new/Mojolicious-7.26/META.yml 2017-02-16 00:08:28.000000000 +0100 @@ -31,5 +31,5 @@ homepage: http://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/mojo.git -version: '7.25' +version: '7.26' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/lib/Mojo/IOLoop/Delay.pm new/Mojolicious-7.26/lib/Mojo/IOLoop/Delay.pm --- old/Mojolicious-7.25/lib/Mojo/IOLoop/Delay.pm 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.26/lib/Mojo/IOLoop/Delay.pm 2017-02-15 23:48:25.000000000 +0100 @@ -124,6 +124,63 @@ L<Mojo::IOLoop>, which can help you avoid deep nested closures that often result from continuation-passing style. + use Mojo::IOLoop; + + # These deep nested closures are often referred to as "Callback Hell" + Mojo::IOLoop->timer(3 => sub { + my loop = shift; + + say '3 seconds'; + Mojo::IOLoop->timer(3 => sub { + my $loop = shift; + + say '6 seconds'; + Mojo::IOLoop->timer(3 => sub { + my $loop = shift; + + say '9 seconds'; + Mojo::IOLoop->stop; + }); + }); + }); + + Mojo::IOLoop->start; + +The idea behind L<Mojo::IOLoop::Delay> is to turn the nested closures above into +a flat series of closures. In the example below, the call to L</"begin"> creates +a callback that we can pass to L<Mojo::IOLoop/"timer"> and that leads to the +next closure in the series when called. + + use Mojo::IOLoop; + + # Instead of nested closures we now have a simple chain + my $delay = Mojo::IOloop->delay( + sub { + my $delay = shift; + Mojo::IOLoop->timer(3 => $delay->begin); + }, + sub { + my $delay = shift; + say '3 seconds'; + Mojo::IOLoop->timer(3 => $delay->begin); + }, + sub { + my $delay = shift; + say '6 seconds'; + Mojo::IOLoop->timer(3 => $delay->begin); + }, + sub { + my $delay = shift; + say '9 seconds'; + } + ); + $delay->wait; + +Another positive side effect of this pattern is that we do not need to call +L<Mojo::IOLoop/"start"> and L<Mojo::IOLoop/"stop"> manually, because we know +exactly when our series of closures has reached the end. So L</"wait"> can stop +the event loop automatically if it had to be started at all in the first place. + =head1 EVENTS L<Mojo::IOLoop::Delay> inherits all events from L<Mojo::EventEmitter> and can diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/lib/Mojo/IOLoop/Subprocess.pm new/Mojolicious-7.26/lib/Mojo/IOLoop/Subprocess.pm --- old/Mojolicious-7.25/lib/Mojo/IOLoop/Subprocess.pm 2017-01-07 01:33:04.000000000 +0100 +++ new/Mojolicious-7.26/lib/Mojo/IOLoop/Subprocess.pm 2017-02-15 20:06:21.000000000 +0100 @@ -34,12 +34,14 @@ } # Parent + my $me = $$; my $stream = Mojo::IOLoop::Stream->new($reader)->timeout(0); $self->ioloop->stream($stream); my $buffer = ''; $stream->on(read => sub { $buffer .= pop }); $stream->on( close => sub { + return unless $$ == $me; waitpid $pid, 0; my $results = eval { $self->deserialize->($buffer) } || []; $self->$parent(shift(@$results) // $@, @$results); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/lib/Mojo/IOLoop.pm new/Mojolicious-7.26/lib/Mojo/IOLoop.pm --- old/Mojolicious-7.25/lib/Mojo/IOLoop.pm 2017-01-15 17:02:28.000000000 +0100 +++ new/Mojolicious-7.26/lib/Mojo/IOLoop.pm 2017-02-11 00:48:05.000000000 +0100 @@ -359,16 +359,16 @@ L<Mojo::Reactor/"error">. # Watch if handle becomes readable or writable - $loop->reactor->io($handle => sub { + Mojo::IOLoop->singleton->reactor->io($handle => sub { my ($reactor, $writable) = @_; say $writable ? 'Handle is writable' : 'Handle is readable'; }); # Change to watching only if handle becomes writable - $loop->reactor->watch($handle, 0, 1); + Mojo::IOLoop->singleton->reactor->watch($handle, 0, 1); # Remove handle again - $loop->reactor->remove($handle); + Mojo::IOLoop->singleton->reactor->remove($handle); =head1 METHODS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/lib/Mojo/UserAgent.pm new/Mojolicious-7.26/lib/Mojo/UserAgent.pm --- old/Mojolicious-7.25/lib/Mojo/UserAgent.pm 2017-02-09 16:06:55.000000000 +0100 +++ new/Mojolicious-7.26/lib/Mojo/UserAgent.pm 2017-02-11 15:02:47.000000000 +0100 @@ -31,8 +31,7 @@ # Common HTTP methods for my $name (qw(DELETE GET HEAD OPTIONS PATCH POST PUT)) { monkey_patch __PACKAGE__, lc $name, sub { - my $self = shift; - my $cb = ref $_[-1] eq 'CODE' ? pop : undef; + my ($self, $cb) = (shift, ref $_[-1] eq 'CODE' ? pop : undef); return $self->start($self->build_tx($name, @_), $cb); }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/lib/Mojolicious/Guides/Cookbook.pod new/Mojolicious-7.26/lib/Mojolicious/Guides/Cookbook.pod --- old/Mojolicious-7.25/lib/Mojolicious/Guides/Cookbook.pod 2017-02-09 22:05:57.000000000 +0100 +++ new/Mojolicious-7.26/lib/Mojolicious/Guides/Cookbook.pod 2017-02-10 23:36:39.000000000 +0100 @@ -9,6 +9,62 @@ This document contains many fun recipes for cooking with L<Mojolicious>. +=head1 CONCEPTS + +Essentials every L<Mojolicious> developer should know. + +=head2 Blocking and non-blocking operations + +A I<blocking> operation is a subroutine that blocks the execution of the +calling subroutine until the subroutine is finished. + + sub foo { + my $result = blocking_subroutine(); + ... + } + +A I<non-blocking> operation on the other hand lets the calling subroutine +continue execution even though the subroutine is not yet finished. Instead of +waiting, the calling subroutine passes along a callback to be executed once the +subroutine is finished, this is called continuation-passing style. + + sub foo { + non_blocking_subroutine(sub { + my $result = shift; + ... + }); + ... + } + +While L<Mojolicious> has been designed from the ground up for non-blocking I/O +and event loops, it is not possible to magically make Perl code non-blocking. +You have to use specialized non-blocking code available through modules like +L<Mojo::IOLoop> and L<Mojo::UserAgent>, or third-party event loops. You can wrap +your blocking code in L<subprocesses|Mojo::IOLoop/"subprocess"> though to +prevent it from interfering with your non-blocking code. + +=head2 Event loops + +An event loop is basically a loop that continually tests for external events +and executes the appropriate callbacks to handle them, it is often the main +loop in a program. Non-blocking tests for readability/writability of file +descriptors and timers are commonly used events for highly scalable network +servers, because they allow a single process to handle thousands of client +connections concurrently. + + while (1) { + my @readable = test_fds_for_readability(); + handle_readable_fds(@readable); + + my @writable = test_fds_for_writability(); + handle_writable_fds(@writable); + + my @expired = test_timers(); + handle_timers(@expired); + } + +In L<Mojolicious> this event loop is L<Mojo::IOLoop>. + =head1 DEPLOYMENT Getting L<Mojolicious> and L<Mojolicious::Lite> applications running on @@ -890,7 +946,7 @@ </body> </html> -=head2 Event loops +=head2 More event loops Internally, the L<Mojo::IOLoop> event loop can use multiple reactor backends, L<EV> for example, will be automatically used if possible. Which in turn allows diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/lib/Mojolicious/Guides/FAQ.pod new/Mojolicious-7.26/lib/Mojolicious/Guides/FAQ.pod --- old/Mojolicious-7.25/lib/Mojolicious/Guides/FAQ.pod 2017-01-29 22:33:08.000000000 +0100 +++ new/Mojolicious-7.26/lib/Mojolicious/Guides/FAQ.pod 2017-02-10 23:35:16.000000000 +0100 @@ -94,62 +94,6 @@ when installing or upgrading L<Mojolicious> and when running its tests, we highly recommend using an environment which does not set these variables. -=head2 What is the difference between blocking and non-blocking operations? - -A I<blocking> operation is a subroutine that blocks the execution of the -calling subroutine until the subroutine is finished. - - sub foo { - my $result = blocking_subroutine(); - ... - } - -A I<non-blocking> operation on the other hand lets the calling subroutine -continue execution even though the subroutine is not yet finished. Instead of -waiting, the calling subroutine passes along a callback to be executed once the -subroutine is finished, this is called continuation-passing style. - - sub foo { - non_blocking_subroutine(sub { - my $result = shift; - ... - }); - ... - } - -=head2 Will my code magically become non-blocking with Mojolicious? - -No, it is not possible to magically make Perl code non-blocking. While -L<Mojolicious> has been designed from the ground up for non-blocking I/O and -event loops, taking advantage of this requires blocking code to be wrapped in -L<subprocesses|Mojo::IOLoop/"subprocess">, and the use of specialized -non-blocking code available through modules like L<Mojo::IOLoop> and -L<Mojo::UserAgent>, or third-party event loops. In the documentation we often -refer to this as real-time web, for more information see also -L<Mojolicious::Guides::Cookbook/"REAL-TIME WEB">. - -=head2 What is an event loop? - -An event loop is basically a loop that continually tests for external events -and executes the appropriate callbacks to handle them, it is often the main -loop in a program. Non-blocking tests for readability/writability of file -descriptors and timers are commonly used events for highly scalable network -servers, because they allow a single process to handle thousands of client -connections concurrently. - - while (1) { - my @readable = test_fds_for_readability(); - handle_readable_fds(@readable); - - my @writable = test_fds_for_writability(); - handle_writable_fds(@writable); - - my @expired = test_timers(); - handle_timers(@expired); - } - -In L<Mojolicious> this event loop is L<Mojo::IOLoop>. - =head2 Where did my file extension go? Standard route placeholders will not match the C<.> character, however diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/lib/Mojolicious/resources/templates/mojo/menubar.html.ep new/Mojolicious-7.26/lib/Mojolicious/resources/templates/mojo/menubar.html.ep --- old/Mojolicious-7.25/lib/Mojolicious/resources/templates/mojo/menubar.html.ep 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.26/lib/Mojolicious/resources/templates/mojo/menubar.html.ep 2017-02-15 18:30:02.000000000 +0100 @@ -69,7 +69,7 @@ %= link_to GitHub => 'https://github.com/kraih/mojo' %= link_to CPAN => 'https://metacpan.org/release/Mojolicious/' %= link_to MailingList => 'https://groups.google.com/group/mojolicious' - %= link_to Blog => 'http://blog.kraih.com' + %= link_to Blog => 'http://blog.mojolicious.org' %= link_to Twitter => 'https://twitter.com/kraih' %= form_for 'https://www.google.com/cse' => (target => '_blank') => begin %= hidden_field cx => '014527573091551588235:pwfplkjpgbi' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/lib/Mojolicious.pm new/Mojolicious-7.26/lib/Mojolicious.pm --- old/Mojolicious-7.25/lib/Mojolicious.pm 2017-02-05 22:09:51.000000000 +0100 +++ new/Mojolicious-7.26/lib/Mojolicious.pm 2017-02-09 23:51:32.000000000 +0100 @@ -58,7 +58,7 @@ has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Doughnut'; -our $VERSION = '7.25'; +our $VERSION = '7.26'; sub AUTOLOAD { my $self = shift; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/t/mojo/subprocess.t new/Mojolicious-7.26/t/mojo/subprocess.t --- old/Mojolicious-7.25/t/mojo/subprocess.t 2016-08-29 17:43:27.000000000 +0200 +++ new/Mojolicious-7.26/t/mojo/subprocess.t 2017-02-15 20:06:31.000000000 +0100 @@ -107,6 +107,28 @@ ok !$fail, 'no error'; is_deeply $result, [], 'right structure'; +# Stream inherited from previous subprocesses +($fail, $result) = (); +my $delay = Mojo::IOLoop->delay; +my $me = $$; +for (0 .. 1) { + my $end = $delay->begin; + my $subprocess = Mojo::IOLoop::Subprocess->new; + $subprocess->run( + sub { 1 + 1 }, + sub { + my ($subprocess, $err, $two) = @_; + $fail ||= $err; + push @$result, $two; + is $me, $$, 'we are the parent'; + $end->(); + } + ); +} +$delay->wait; +ok !$fail, 'no error'; +is_deeply $result, [2, 2], 'right structure'; + # Exception $fail = undef; Mojo::IOLoop::Subprocess->new->run( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.25/t/mojo/tls.t new/Mojolicious-7.26/t/mojo/tls.t --- old/Mojolicious-7.25/t/mojo/tls.t 2017-01-15 14:01:09.000000000 +0100 +++ new/Mojolicious-7.26/t/mojo/tls.t 2017-02-15 19:52:37.000000000 +0100 @@ -35,16 +35,16 @@ # Built-in certificate (custom event loop and cipher) my $loop = Mojo::IOLoop->new; -socketpair($client_sock, $server_sock, AF_UNIX, SOCK_STREAM, PF_UNSPEC) +socketpair(my $client_sock2, my $server_sock2, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "Couldn't create socket pair: $!"; -$client_sock->blocking(0); -$server_sock->blocking(0); +$client_sock2->blocking(0); +$server_sock2->blocking(0); $delay = $loop->delay; -$server = Mojo::IOLoop::TLS->new($server_sock)->reactor($loop->reactor); +$server = Mojo::IOLoop::TLS->new($server_sock2)->reactor($loop->reactor); $server->once(upgrade => $delay->begin); $server->once(error => sub { warn pop }); $server->negotiate(server => 1, tls_ciphers => 'AES256-SHA:ALL'); -$client = Mojo::IOLoop::TLS->new($client_sock)->reactor($loop->reactor); +$client = Mojo::IOLoop::TLS->new($client_sock2)->reactor($loop->reactor); $client->once(upgrade => $delay->begin); $client->once(error => sub { warn pop }); $client->negotiate;
participants (1)
-
root@hilbertn.suse.de