Hello community, here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2017-12-23 12:17:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious" Sat Dec 23 12:17:41 2017 rev:84 rq:558060 version:7.59 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes 2017-12-08 21:47:21.379151377 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2017-12-23 12:17:45.380644644 +0100 @@ -1,0 +2,14 @@ +Mon Dec 18 06:37:16 UTC 2017 - [email protected] + +- updated to 7.59 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 7.59 2017-12-15 + - Moved home and ua attributes from Mojo to Mojolicious. + - Changed Mojo::IOLoop::Client to only start a thread pool with + Net::DNS::Native on demand. (Grinnz) + - Improved subprocess method in Mojo::IOLoop to allow for easier role + composition. + - Fixed RFC 7230 compliance bug in Mojo::Message::Response. (jberger) + +------------------------------------------------------------------- Old: ---- Mojolicious-7.58.tar.gz New: ---- Mojolicious-7.59.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.XN2oiL/_old 2017-12-23 12:17:46.228603298 +0100 +++ /var/tmp/diff_new_pack.XN2oiL/_new 2017-12-23 12:17:46.228603298 +0100 @@ -17,7 +17,7 @@ Name: perl-Mojolicious -Version: 7.58 +Version: 7.59 Release: 0 %define cpan_name Mojolicious Summary: Real-time web framework ++++++ Mojolicious-7.58.tar.gz -> Mojolicious-7.59.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/Changes new/Mojolicious-7.59/Changes --- old/Mojolicious-7.58/Changes 2017-12-02 21:02:52.000000000 +0100 +++ new/Mojolicious-7.59/Changes 2017-12-16 01:48:47.000000000 +0100 @@ -1,4 +1,12 @@ +7.59 2017-12-15 + - Moved home and ua attributes from Mojo to Mojolicious. + - Changed Mojo::IOLoop::Client to only start a thread pool with + Net::DNS::Native on demand. (Grinnz) + - Improved subprocess method in Mojo::IOLoop to allow for easier role + composition. + - Fixed RFC 7230 compliance bug in Mojo::Message::Response. (jberger) + 7.58 2017-12-02 - Added websocket_p method to Mojo::UserAgent. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/META.json new/Mojolicious-7.59/META.json --- old/Mojolicious-7.58/META.json 2017-12-03 23:14:26.000000000 +0100 +++ new/Mojolicious-7.59/META.json 2017-12-17 18:58:31.000000000 +0100 @@ -58,6 +58,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "7.58", + "version" : "7.59", "x_serialization_backend" : "JSON::PP version 2.97000" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/META.yml new/Mojolicious-7.59/META.yml --- old/Mojolicious-7.58/META.yml 2017-12-03 23:14:26.000000000 +0100 +++ new/Mojolicious-7.59/META.yml 2017-12-17 18:58:30.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.58' +version: '7.59' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/Content.pm new/Mojolicious-7.59/lib/Mojo/Content.pm --- old/Mojolicious-7.58/lib/Mojo/Content.pm 2017-11-23 11:26:07.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/Content.pm 2017-12-14 19:39:41.000000000 +0100 @@ -104,7 +104,7 @@ # Relaxed parsing my $headers = $self->headers; - my $len = $headers->content_length // ''; + my $len = $headers->content_length // ''; if ($self->auto_relax && !length $len) { my $connection = lc($headers->connection // ''); $self->relaxed(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/IOLoop/Client.pm new/Mojolicious-7.59/lib/Mojo/IOLoop/Client.pm --- old/Mojolicious-7.58/lib/Mojo/IOLoop/Client.pm 2017-11-07 21:49:28.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/IOLoop/Client.pm 2017-12-14 19:39:44.000000000 +0100 @@ -13,7 +13,7 @@ use constant NNR => $ENV{MOJO_NO_NNR} ? 0 : eval { require Net::DNS::Native; Net::DNS::Native->VERSION('0.15'); 1 }; -my $NDN = NNR ? Net::DNS::Native->new(pool => 5, extra_thread => 1) : undef; +my $NDN; # SOCKS support requires IO::Socket::Socks use constant SOCKS => $ENV{MOJO_NO_SOCKS} @@ -45,6 +45,7 @@ if !NNR || $args->{handle} || $args->{path}; # Non-blocking name resolution + $NDN //= Net::DNS::Native->new(pool => 5, extra_thread => 1); my $handle = $self->{dns} = $NDN->getaddrinfo($address, _port($args), {protocol => IPPROTO_TCP, socktype => SOCK_STREAM}); $reactor->io( @@ -63,7 +64,7 @@ sub _cleanup { my $self = shift; - $NDN->timedout($self->{dns}) if $self->{dns}; + $NDN->timedout($self->{dns}) if $NDN && $self->{dns}; return unless my $reactor = $self->reactor; $self->{$_} && $reactor->remove(delete $self->{$_}) for qw(dns timer handle); return $self; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/IOLoop.pm new/Mojolicious-7.59/lib/Mojo/IOLoop.pm --- old/Mojolicious-7.58/lib/Mojo/IOLoop.pm 2017-11-16 13:43:44.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/IOLoop.pm 2017-12-14 22:53:18.000000000 +0100 @@ -153,7 +153,7 @@ sub subprocess { my $subprocess = Mojo::IOLoop::Subprocess->new; weaken $subprocess->ioloop(_instance(shift))->{ioloop}; - return $subprocess->run(@_); + return @_ ? $subprocess->run(@_) : $subprocess; } sub timer { shift->_timer(timer => @_) } @@ -608,6 +608,7 @@ =head2 subprocess my $subprocess = Mojo::IOLoop->subprocess(sub {...}, sub {...}); + my $subprocess = $loop->subprocess; my $subprocess = $loop->subprocess(sub {...}, sub {...}); Build L<Mojo::IOLoop::Subprocess> object to perform computationally expensive diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/JSON.pm new/Mojolicious-7.59/lib/Mojo/JSON.pm --- old/Mojolicious-7.58/lib/Mojo/JSON.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/JSON.pm 2017-12-15 17:49:34.000000000 +0100 @@ -293,7 +293,7 @@ =head1 DESCRIPTION L<Mojo::JSON> is a minimalistic and possibly the fastest pure-Perl -implementation of L<RFC 7159|http://tools.ietf.org/html/rfc7159>. +implementation of L<RFC 8259|http://tools.ietf.org/html/rfc8259>. It supports normal Perl data types like scalar, array reference, hash reference and will try to call the C<TO_JSON> method on blessed references, or stringify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/Log.pm new/Mojolicious-7.59/lib/Mojo/Log.pm --- old/Mojolicious-7.58/lib/Mojo/Log.pm 2017-11-23 11:24:21.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/Log.pm 2017-12-16 00:31:07.000000000 +0100 @@ -235,6 +235,8 @@ =head2 new my $log = Mojo::Log->new; + my $log = Mojo::Log->new(level => 'warn'); + my $log = Mojo::Log->new({level => 'warn'}); Construct a new L<Mojo::Log> object and subscribe to L</"message"> event with default logger. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/Message/Response.pm new/Mojolicious-7.59/lib/Mojo/Message/Response.pm --- old/Mojolicious-7.58/lib/Mojo/Message/Response.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/Message/Response.pm 2017-12-14 19:39:38.000000000 +0100 @@ -112,6 +112,9 @@ my $headers = $self->headers; $headers->date(Mojo::Date->new->to_string) unless $headers->date; + # RFC 7230 3.3.2 + $headers->remove('Content-Length') if $self->is_empty; + return $self; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/Message.pm new/Mojolicious-7.59/lib/Mojo/Message.pm --- old/Mojolicious-7.58/lib/Mojo/Message.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/Message.pm 2017-12-14 19:39:40.000000000 +0100 @@ -12,10 +12,10 @@ use Mojo::Util 'decode'; has content => sub { Mojo::Content::Single->new }; -has default_charset => 'UTF-8'; -has max_line_size => sub { $ENV{MOJO_MAX_LINE_SIZE} || 8192 }; +has default_charset => 'UTF-8'; +has max_line_size => sub { $ENV{MOJO_MAX_LINE_SIZE} || 8192 }; has max_message_size => sub { $ENV{MOJO_MAX_MESSAGE_SIZE} // 16777216 }; -has version => '1.1'; +has version => '1.1'; sub body { my $self = shift; @@ -274,7 +274,7 @@ $part = $part->asset->slurp unless $upload; if ($charset) { - $name = decode($charset, $name) // $name if $name; + $name = decode($charset, $name) // $name if $name; $filename = decode($charset, $filename) // $filename if $filename; $part = decode($charset, $part) // $part unless $upload; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/Path.pm new/Mojolicious-7.59/lib/Mojo/Path.pm --- old/Mojolicious-7.58/lib/Mojo/Path.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/Path.pm 2017-12-14 19:39:46.000000000 +0100 @@ -109,7 +109,7 @@ my ($self, $name) = (shift, shift); unless ($self->{parts}) { - my $path = url_unescape delete($self->{path}) // ''; + my $path = url_unescape delete($self->{path}) // ''; my $charset = $self->charset; $path = decode($charset, $path) // $path if $charset; $self->{leading_slash} = $path =~ s!^/!!; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/Server/Daemon.pm new/Mojolicious-7.59/lib/Mojo/Server/Daemon.pm --- old/Mojolicious-7.58/lib/Mojo/Server/Daemon.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/Server/Daemon.pm 2017-12-16 16:45:06.000000000 +0100 @@ -14,7 +14,7 @@ has acceptors => sub { [] }; has [qw(backlog max_clients silent)]; has inactivity_timeout => sub { $ENV{MOJO_INACTIVITY_TIMEOUT} // 15 }; -has ioloop => sub { Mojo::IOLoop->singleton }; +has ioloop => sub { Mojo::IOLoop->singleton }; has listen => sub { [split ',', $ENV{MOJO_LISTEN} || 'http://*:3000'] }; has max_requests => 100; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/UserAgent/CookieJar.pm new/Mojolicious-7.59/lib/Mojo/UserAgent/CookieJar.pm --- old/Mojolicious-7.58/lib/Mojo/UserAgent/CookieJar.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/UserAgent/CookieJar.pm 2017-12-14 19:39:35.000000000 +0100 @@ -24,7 +24,7 @@ # Replace cookie my $origin = $cookie->origin // ''; next unless my $domain = lc($cookie->domain // $origin); - next unless my $path = $cookie->path; + next unless my $path = $cookie->path; next unless length(my $name = $cookie->name // ''); my $jar = $self->{jar}{$domain} ||= []; @$jar = (grep({ _compare($_, $path, $name, $origin) } @$jar), $cookie); @@ -45,7 +45,7 @@ for my $cookie (@{$tx->res->cookies}) { # Validate domain - my $host = lc $url->ihost; + my $host = lc $url->ihost; my $domain = lc($cookie->domain // $cookie->origin($host)->origin); if (my $cb = $self->ignore) { next if $cb->($cookie) } next if $host ne $domain && ($host !~ /\Q.$domain\E$/ || $host =~ /\.\d+$/); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/UserAgent/Transactor.pm new/Mojolicious-7.59/lib/Mojo/UserAgent/Transactor.pm --- old/Mojolicious-7.58/lib/Mojo/UserAgent/Transactor.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/UserAgent/Transactor.pm 2017-12-14 19:39:35.000000000 +0100 @@ -68,7 +68,7 @@ my ($self, $old) = @_; # Commonly used codes - my $res = $old->res; + my $res = $old->res; my $code = $res->code // 0; return undef unless grep { $_ == $code } 301, 302, 303, 307, 308; @@ -146,7 +146,7 @@ $req->headers->sec_websocket_protocol(join ', ', @$sub) if @$sub; # Handshake protocol - my $url = $req->url; + my $url = $req->url; my $proto = $url->protocol // ''; if ($proto eq 'ws') { $url->scheme('http') } elsif ($proto eq 'wss') { $url->scheme('https') } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo/UserAgent.pm new/Mojolicious-7.59/lib/Mojo/UserAgent.pm --- old/Mojolicious-7.58/lib/Mojo/UserAgent.pm 2017-12-03 14:49:57.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo/UserAgent.pm 2017-12-14 19:39:37.000000000 +0100 @@ -26,7 +26,7 @@ has max_redirects => sub { $ENV{MOJO_MAX_REDIRECTS} || 0 }; has proxy => sub { Mojo::UserAgent::Proxy->new }; has request_timeout => sub { $ENV{MOJO_REQUEST_TIMEOUT} // 0 }; -has server => sub { Mojo::UserAgent::Server->new(ioloop => shift->ioloop) }; +has server => sub { Mojo::UserAgent::Server->new(ioloop => shift->ioloop) }; has transactor => sub { Mojo::UserAgent::Transactor->new }; # Common HTTP methods diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojo.pm new/Mojolicious-7.59/lib/Mojo.pm --- old/Mojolicious-7.58/lib/Mojo.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojo.pm 2017-12-16 01:45:44.000000000 +0100 @@ -4,20 +4,11 @@ # "Professor: These old Doomsday devices are dangerously unstable. I'll rest # easier not knowing where they are." use Carp (); -use Mojo::Home; use Mojo::Log; use Mojo::Transaction::HTTP; -use Mojo::UserAgent; use Mojo::Util; -use Scalar::Util (); -has home => sub { Mojo::Home->new->detect(ref shift) }; -has log => sub { Mojo::Log->new }; -has ua => sub { - my $ua = Mojo::UserAgent->new; - Scalar::Util::weaken $ua->server->app(shift)->{app}; - return $ua; -}; +has log => sub { Mojo::Log->new }; sub build_tx { Mojo::Transaction::HTTP->new } @@ -70,17 +61,6 @@ L<Mojo> implements the following attributes. -=head2 home - - my $home = $app->home; - $app = $app->home(Mojo::Home->new); - -The home directory of your application, defaults to a L<Mojo::Home> object -which stringifies to the actual path. - - # Portably generate path relative to home directory - my $path = $app->home->child('data', 'important.txt'); - =head2 log my $log = $app->log; @@ -91,17 +71,6 @@ # Log debug message $app->log->debug('It works'); -=head2 ua - - my $ua = $app->ua; - $app = $app->ua(Mojo::UserAgent->new); - -A full featured HTTP user agent for use in your applications, defaults to a -L<Mojo::UserAgent> object. - - # Perform blocking request - say $app->ua->get('example.com')->result->body; - =head1 METHODS L<Mojo> inherits all methods from L<Mojo::Base> and implements the following diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojolicious/Command/cpanify.pm new/Mojolicious-7.59/lib/Mojolicious/Command/cpanify.pm --- old/Mojolicious-7.58/lib/Mojolicious/Command/cpanify.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojolicious/Command/cpanify.pm 2017-12-14 19:39:51.000000000 +0100 @@ -28,7 +28,7 @@ unless ($tx->success) { my $code = $tx->res->code // 0; - my $msg = $tx->error->{message}; + my $msg = $tx->error->{message}; if ($code == 401) { $msg = 'Wrong username or password.' } elsif ($code == 409) { $msg = 'File already exists on CPAN.' } die qq{Problem uploading file "$file": $msg\n}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojolicious/Command/daemon.pm new/Mojolicious-7.59/lib/Mojolicious/Command/daemon.pm --- old/Mojolicious-7.58/lib/Mojolicious/Command/daemon.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojolicious/Command/daemon.pm 2017-12-14 19:39:53.000000000 +0100 @@ -15,9 +15,9 @@ 'b|backlog=i' => sub { $daemon->backlog($_[1]) }, 'c|clients=i' => sub { $daemon->max_clients($_[1]) }, 'i|inactivity-timeout=i' => sub { $daemon->inactivity_timeout($_[1]) }, - 'l|listen=s' => \my @listen, - 'p|proxy' => sub { $daemon->reverse_proxy(1) }, - 'r|requests=i' => sub { $daemon->max_requests($_[1]) }; + 'l|listen=s' => \my @listen, + 'p|proxy' => sub { $daemon->reverse_proxy(1) }, + 'r|requests=i' => sub { $daemon->max_requests($_[1]) }; $daemon->listen(\@listen) if @listen; $daemon->run; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojolicious/Command/prefork.pm new/Mojolicious-7.59/lib/Mojolicious/Command/prefork.pm --- old/Mojolicious-7.58/lib/Mojolicious/Command/prefork.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojolicious/Command/prefork.pm 2017-12-14 19:39:52.000000000 +0100 @@ -20,12 +20,12 @@ 'I|heartbeat-interval=i' => sub { $prefork->heartbeat_interval($_[1]) }, 'H|heartbeat-timeout=i' => sub { $prefork->heartbeat_timeout($_[1]) }, 'i|inactivity-timeout=i' => sub { $prefork->inactivity_timeout($_[1]) }, - 'l|listen=s' => \my @listen, - 'P|pid-file=s' => sub { $prefork->pid_file($_[1]) }, - 'p|proxy' => sub { $prefork->reverse_proxy(1) }, - 'r|requests=i' => sub { $prefork->max_requests($_[1]) }, - 's|spare=i' => sub { $prefork->spare($_[1]) }, - 'w|workers=i' => sub { $prefork->workers($_[1]) }; + 'l|listen=s' => \my @listen, + 'P|pid-file=s' => sub { $prefork->pid_file($_[1]) }, + 'p|proxy' => sub { $prefork->reverse_proxy(1) }, + 'r|requests=i' => sub { $prefork->max_requests($_[1]) }, + 's|spare=i' => sub { $prefork->spare($_[1]) }, + 'w|workers=i' => sub { $prefork->workers($_[1]) }; $prefork->listen(\@listen) if @listen; $prefork->run; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojolicious/Guides/Contributing.pod new/Mojolicious-7.59/lib/Mojolicious/Guides/Contributing.pod --- old/Mojolicious-7.58/lib/Mojolicious/Guides/Contributing.pod 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojolicious/Guides/Contributing.pod 2017-12-15 00:06:31.000000000 +0100 @@ -180,10 +180,8 @@ L<Mojolicious> is open source and free to use. However, the amount of effort needed to maintain the project and develop new features for it is not sustainable without proper financial backing. You can support the ongoing -development of L<Mojolicious> through -L<Gratipay|https://gratipay.com/mojolicious>, -L<PayPal|https://www.paypal.me/kraih> or Bitcoin -(C<1Cid78CmK4hvf78Ry8K2XeDx8pQHNh4hbz>). +development of L<Mojolicious> through L<PayPal|https://www.paypal.me/kraih> and +Bitcoin (C<1Cid78CmK4hvf78Ry8K2XeDx8pQHNh4hbz>). If you run a business and use L<Mojolicious> in a revenue generating product, it makes business sense to support L<Mojolicious> development. Because it ensures diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojolicious/Guides/Rendering.pod new/Mojolicious-7.59/lib/Mojolicious/Guides/Rendering.pod --- old/Mojolicious-7.58/lib/Mojolicious/Guides/Rendering.pod 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojolicious/Guides/Rendering.pod 2017-12-17 14:30:03.000000000 +0100 @@ -590,13 +590,16 @@ @@ foo/bar.html.ep <!DOCTYPE html> <html> - %= include 'header', title => 'Howdy' + %= include '_header', title => 'Howdy' <body>Bar</body> </html> - @@ header.html.ep + @@ _header.html.ep <head><title><%= $title %></title></head> +You can name partial templates however you like, but a leading underscore is a +commonly used naming convention. + =head2 Reusable template blocks It's never fun to repeat yourself, that's why you can build reusable template diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojolicious/Guides/Tutorial.pod new/Mojolicious-7.59/lib/Mojolicious/Guides/Tutorial.pod --- old/Mojolicious-7.58/lib/Mojolicious/Guides/Tutorial.pod 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojolicious/Guides/Tutorial.pod 2017-12-17 15:02:40.000000000 +0100 @@ -734,6 +734,36 @@ app->start; +=head2 Home + +You can use L<Mojolicious/"home"> to interact with the directory your +application considers its home. This is the directory it will search for +C<public> and C<templates> directories, but you can use it to store all sorts of +application specific data. + + $ mkdir cache + $ echo 'Hello World!' > cache/hello.txt + +There are many useful methods L<Mojo::Home> inherits from L<Mojo::File>, like +L<Mojo::File/"child"> and L<Mojo::File/"slurp">, that will help you keep your +application portable across many different operating systems. + + use Mojolicious::Lite; + + # Load message into memory + my $hello = app->home->child('cache', 'hello.txt')->slurp; + + # Display message + get '/' => sub { + my $c = shift; + $c->render(text => $hello); + }; + +You can also introspect your application from the command line with +L<Mojolicious::Command::eval>. + + $ ./myapp.pl eval -v 'app->home' + =head2 Conditions Conditions such as C<agent> and C<host> from diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojolicious/Plugin/DefaultHelpers.pm new/Mojolicious-7.59/lib/Mojolicious/Plugin/DefaultHelpers.pm --- old/Mojolicious-7.58/lib/Mojolicious/Plugin/DefaultHelpers.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojolicious/Plugin/DefaultHelpers.pm 2017-12-16 01:47:19.000000000 +0100 @@ -474,7 +474,7 @@ %= ua->get('mojolicious.org')->result->dom->at('title')->text -Alias for L<Mojo/"ua">. +Alias for L<Mojolicious/"ua">. =head2 url_for diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojolicious/Sessions.pm new/Mojolicious-7.59/lib/Mojolicious/Sessions.pm --- old/Mojolicious-7.58/lib/Mojolicious/Sessions.pm 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojolicious/Sessions.pm 2017-12-14 19:39:47.000000000 +0100 @@ -44,7 +44,7 @@ # Generate "expires" value from "expiration" if necessary my $expiration = $session->{expiration} // $self->default_expiration; - my $default = delete $session->{expires}; + my $default = delete $session->{expires}; $session->{expires} = $default || time + $expiration if $expiration || $default; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/lib/Mojolicious.pm new/Mojolicious-7.59/lib/Mojolicious.pm --- old/Mojolicious-7.58/lib/Mojolicious.pm 2017-12-03 23:13:07.000000000 +0100 +++ new/Mojolicious-7.59/lib/Mojolicious.pm 2017-12-16 01:46:36.000000000 +0100 @@ -4,8 +4,10 @@ # "Fry: Shut up and take my money!" use Carp (); use Mojo::Exception; +use Mojo::Home; use Mojo::Log; use Mojo::Util; +use Mojo::UserAgent; use Mojolicious::Commands; use Mojolicious::Controller; use Mojolicious::Plugins; @@ -24,6 +26,7 @@ return $commands; }; has controller_class => 'Mojolicious::Controller'; +has home => sub { Mojo::Home->new->detect(ref shift) }; has log => sub { my $self = shift; @@ -52,13 +55,18 @@ # Default to moniker return [$self->moniker]; }; -has sessions => sub { Mojolicious::Sessions->new }; -has static => sub { Mojolicious::Static->new }; -has types => sub { Mojolicious::Types->new }; +has sessions => sub { Mojolicious::Sessions->new }; +has static => sub { Mojolicious::Static->new }; +has types => sub { Mojolicious::Types->new }; +has ua => sub { + my $ua = Mojo::UserAgent->new; + Scalar::Util::weaken $ua->server->app(shift)->{app}; + return $ua; +}; has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Doughnut'; -our $VERSION = '7.58'; +our $VERSION = '7.59'; sub AUTOLOAD { my $self = shift; @@ -405,6 +413,17 @@ L<Mojolicious::Controller>. Note that this class needs to have already been loaded before the first request arrives. +=head2 home + + my $home = $app->home; + $app = $app->home(Mojo::Home->new); + +The home directory of your application, defaults to a L<Mojo::Home> object +which stringifies to the actual path. + + # Portably generate path relative to home directory + my $path = $app->home->child('data', 'important.txt'); + =head2 log my $log = $app->log; @@ -553,6 +572,17 @@ # Add custom MIME type $app->types->type(twt => 'text/tweet'); +=head2 ua + + my $ua = $app->ua; + $app = $app->ua(Mojo::UserAgent->new); + +A full featured HTTP user agent for use in your applications, defaults to a +L<Mojo::UserAgent> object. + + # Perform blocking request + say $app->ua->get('example.com')->result->body; + =head2 validator my $validator = $app->validator; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/t/mojo/cgi.t new/Mojolicious-7.59/t/mojo/cgi.t --- old/Mojolicious-7.58/t/mojo/cgi.t 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/t/mojo/cgi.t 2017-12-14 19:38:31.000000000 +0100 @@ -65,7 +65,7 @@ is $res->code, 200, 'right status'; is $res->headers->status, '200 OK', 'right "Status" value'; is $res->headers->content_length, 21, 'right "Content-Length" value'; -is $res->headers->content_type, 'text/html;charset=UTF-8', +is $res->headers->content_type, 'text/html;charset=UTF-8', 'right "Content-Type" value'; is $res->body, 'Your Mojo is working!', 'right content'; @@ -87,7 +87,7 @@ is $res->code, 200, 'right status'; is $res->headers->status, '200 OK', 'right "Status" value'; is $res->headers->content_length, 21, 'right "Content-Length" value'; -is $res->headers->content_type, 'text/html;charset=UTF-8', +is $res->headers->content_type, 'text/html;charset=UTF-8', 'right "Content-Type" value'; is $res->body, '', 'no content'; @@ -110,7 +110,7 @@ is $res->code, 200, 'right status'; is $res->headers->status, undef, 'no "Status" value'; is $res->headers->content_length, 21, 'right "Content-Length" value'; -is $res->headers->content_type, 'text/html;charset=UTF-8', +is $res->headers->content_type, 'text/html;charset=UTF-8', 'right "Content-Type" value'; is $res->body, 'Your Mojo is working!', 'right content'; @@ -184,7 +184,7 @@ is $res->code, 200, 'right status'; is $res->headers->status, '200 OK', 'right "Status" value'; is $res->headers->content_length, 15, 'right "Content-Length" value'; -is $res->headers->content_type, 'text/html;charset=UTF-8', +is $res->headers->content_type, 'text/html;charset=UTF-8', 'right "Content-Type" value'; is $res->body, '192.0.2.1:https', 'right content'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/t/mojo/daemon.t new/Mojolicious-7.59/t/mojo/daemon.t --- old/Mojolicious-7.58/t/mojo/daemon.t 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/t/mojo/daemon.t 2017-12-16 01:46:38.000000000 +0100 @@ -66,12 +66,8 @@ ok !!Mojo::Server::Daemon->new->reverse_proxy, 'reverse proxy'; } -# Optional home detection -my @path = qw(th is mojo dir wil l never-ever exist); -my $app = Mojo->new(home => Mojo::Home->new(@path)); -is $app->home, path(@path), 'right home directory'; - # Config +my $app = Mojo->new; is $app->config('foo'), undef, 'no value'; is_deeply $app->config(foo => 'bar')->config, {foo => 'bar'}, 'right value'; is $app->config('foo'), 'bar', 'right value'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/t/mojo/request_cgi.t new/Mojolicious-7.59/t/mojo/request_cgi.t --- old/Mojolicious-7.58/t/mojo/request_cgi.t 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/t/mojo/request_cgi.t 2017-12-14 19:38:18.000000000 +0100 @@ -229,7 +229,7 @@ is $req->param('ajax'), 'true', 'right value'; is $req->param('login'), 'test', 'right value'; is $req->param('password'), '111', 'right value'; -is $req->param('edition'), 'db6d8b30-16df-4ecd-be2f-c8194f94e1f4', +is $req->param('edition'), 'db6d8b30-16df-4ecd-be2f-c8194f94e1f4', 'right value'; is $req->url->to_abs->to_string, 'http://test1/index.pl/', 'right absolute URL'; @@ -262,7 +262,7 @@ is $req->param('ajax'), 'true', 'right value'; is $req->param('login'), 'test', 'right value'; is $req->param('password'), '111', 'right value'; -is $req->param('edition'), 'db6d8b30-16df-4ecd-be2f-c8194f94e1f4', +is $req->param('edition'), 'db6d8b30-16df-4ecd-be2f-c8194f94e1f4', 'right value'; is $req->url->to_abs->to_string, 'http://test1/index.pl/', 'right absolute URL'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/t/mojo/response.t new/Mojolicious-7.59/t/mojo/response.t --- old/Mojolicious-7.58/t/mojo/response.t 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/t/mojo/response.t 2017-12-14 19:38:16.000000000 +0100 @@ -855,6 +855,7 @@ is $res->headers->sec_websocket_protocol, 'sample', 'right "Sec-WebSocket-Protocol" value'; is $res->body, '', 'no content'; +ok !defined $res->headers->content_length, '"Content-Length" does not exist'; # Parse WebSocket handshake response (with frame) $res = Mojo::Message::Response->new; @@ -879,6 +880,7 @@ is $res->body, '', 'no content'; is $res->content->leftovers, "\x81\x08\x77\x68\x61\x74\x65\x76\x65\x72", 'frame in leftovers'; +ok !defined $res->headers->content_length, '"Content-Length" does not exist'; # Build WebSocket handshake response $res = Mojo::Message::Response->new; @@ -895,13 +897,14 @@ is $res->version, '1.1', 'right version'; is $res->headers->connection, 'Upgrade', 'right "Connection" value'; is $res->headers->date, 'Sun, 17 Aug 2008 16:27:35 GMT', 'right "Date" value'; -is $res->headers->content_length, 0, 'right "Content-Length" value'; -is $res->headers->upgrade, 'websocket', 'right "Upgrade" value'; +ok !defined $res->headers->content_length, '"Content-Length" does not exist'; +is $res->headers->upgrade, 'websocket', 'right "Upgrade" value'; is $res->headers->sec_websocket_accept, 'abcdef=', 'right "Sec-WebSocket-Accept" value'; is $res->headers->sec_websocket_protocol, 'sample', 'right "Sec-WebSocket-Protocol" value'; is $res->body, '', 'no content'; +ok !defined $res->headers->content_length, '"Content-Length" does not exist'; # Build and parse HTTP 1.1 response with 3 cookies $res = Mojo::Message::Response->new; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/t/mojo/subprocess.t new/Mojolicious-7.59/t/mojo/subprocess.t --- old/Mojolicious-7.58/t/mojo/subprocess.t 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/t/mojo/subprocess.t 2017-12-14 22:55:12.000000000 +0100 @@ -82,7 +82,7 @@ sub { my $delay = shift; Mojo::IOLoop->subprocess(sub {1}, $delay->begin); - Mojo::IOLoop->subprocess(sub {2}, $delay->begin); + Mojo::IOLoop->subprocess->run(sub {2}, $delay->begin); }, sub { my ($delay, $err1, $result1, $err2, $result2) = @_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/t/mojolicious/app.t new/Mojolicious-7.59/t/mojolicious/app.t --- old/Mojolicious-7.58/t/mojolicious/app.t 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/t/mojolicious/app.t 2017-12-16 01:46:42.000000000 +0100 @@ -14,6 +14,7 @@ use Mojo::Asset::File; use Mojo::Date; use Mojo::File 'path'; +use Mojo::Home; use Mojo::IOLoop; use Mojolicious; use Mojolicious::Controller; @@ -40,6 +41,11 @@ is(Test::Mojo->new('MojoliciousTest')->app->mode, 'else', 'right mode'); } +# Optional home detection +my @path = qw(th is mojo dir wil l never-ever exist); +my $app = Mojolicious->new(home => Mojo::Home->new(@path)); +is $app->home, path(@path), 'right home directory'; + my $t = Test::Mojo->new('MojoliciousTest'); # Application is already available @@ -239,7 +245,7 @@ ->header_is(Server => 'Mojolicious (Perl)') ->content_like(qr/Missing right curly/); like $log, qr/Rendering template "syntaxerror.html.epl"/, 'right message'; -like $log, qr/Missing right curly/, 'right message'; +like $log, qr/Missing right curly/, 'right message'; like $log, qr/Template "exception.development.html.ep" not found/, 'right message'; like $log, qr/Rendering template "exception.html.epl"/, 'right message'; @@ -460,7 +466,7 @@ is(MojoliciousTest->new({mode => 'test'})->mode, 'test', 'right mode'); # Persistent error -my $app = MojoliciousTest->new; +$app = MojoliciousTest->new; my $tx = $t->ua->build_tx(GET => '/foo'); $app->handler($tx); is $tx->res->code, 200, 'right status'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/t/mojolicious/upload_lite_app.t new/Mojolicious-7.59/t/mojolicious/upload_lite_app.t --- old/Mojolicious-7.58/t/mojolicious/upload_lite_app.t 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/t/mojolicious/upload_lite_app.t 2017-12-14 19:38:33.000000000 +0100 @@ -21,7 +21,7 @@ $c->render(text => $file->filename . $file->asset->slurp . $c->param('test') - . ($headers->content_type // '') + . ($headers->content_type // '') . ($headers->header('X-X') // '')); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.58/t/mojolicious/websocket_lite_app.t new/Mojolicious-7.59/t/mojolicious/websocket_lite_app.t --- old/Mojolicious-7.58/t/mojolicious/websocket_lite_app.t 2017-11-06 18:19:39.000000000 +0100 +++ new/Mojolicious-7.59/t/mojolicious/websocket_lite_app.t 2017-12-14 19:38:40.000000000 +0100 @@ -100,7 +100,7 @@ under '/nested'; websocket sub { - my $c = shift; + my $c = shift; my $echo = $c->cookie('echo') // ''; $c->cookie(echo => 'again'); $c->on(
