Hello community, here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2016-04-12 19:38:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2016-03-17 16:47:41.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2016-04-12 19:38:56.000000000 +0200 @@ -1,0 +2,32 @@ +Mon Apr 11 12:51:36 UTC 2016 - co...@suse.com + +- updated to 6.58 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 6.58 2016-04-09 + - Removed deprecated build_frame and parse_frame methods from + Mojo::Transaction::WebSocket. + - Added fork policy to Mojolicious::Guides::Contributing. + - Improved Mojo::JSON to generate canonical JSON objects. + - Fixed bug in Mojo::Loader where classes with exceptions could not be loaded + twice. (kiwiroy, sri) + +------------------------------------------------------------------- +Mon Apr 4 10:00:32 UTC 2016 - co...@suse.com + +- updated to 6.57 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 6.57 2016-03-23 + - Fixed a few validation bugs in Mojolicious::Validator::Validation. + (Mikey, sri) + - Fixed copyright notice. + + 6.56 2016-03-16 + - Added hidden option to list_files method in Mojo::Home. (batman, sri) + - Added hidden option to files function in Mojo::Util. (batman, sri) + - Fixed bug where Morbo would not ignore hidden files. (batman, sri) + - Fixed bug where Morbo would ignore the --verbose option. + - Fixed keep-alive bug in Mojo::UserAgent. (jberger) + +------------------------------------------------------------------- Old: ---- Mojolicious-6.55.tar.gz New: ---- Mojolicious-6.58.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.443Mkc/_old 2016-04-12 19:38:57.000000000 +0200 +++ /var/tmp/diff_new_pack.443Mkc/_new 2016-04-12 19:38:57.000000000 +0200 @@ -17,7 +17,7 @@ Name: perl-Mojolicious -Version: 6.55 +Version: 6.58 Release: 0 %define cpan_name Mojolicious Summary: Real-time web framework ++++++ Mojolicious-6.55.tar.gz -> Mojolicious-6.58.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/Changes new/Mojolicious-6.58/Changes --- old/Mojolicious-6.55/Changes 2016-03-08 19:08:01.000000000 +0100 +++ new/Mojolicious-6.58/Changes 2016-04-10 19:07:57.000000000 +0200 @@ -1,4 +1,24 @@ +6.58 2016-04-09 + - Removed deprecated build_frame and parse_frame methods from + Mojo::Transaction::WebSocket. + - Added fork policy to Mojolicious::Guides::Contributing. + - Improved Mojo::JSON to generate canonical JSON objects. + - Fixed bug in Mojo::Loader where classes with exceptions could not be loaded + twice. (kiwiroy, sri) + +6.57 2016-03-23 + - Fixed a few validation bugs in Mojolicious::Validator::Validation. + (Mikey, sri) + - Fixed copyright notice. + +6.56 2016-03-16 + - Added hidden option to list_files method in Mojo::Home. (batman, sri) + - Added hidden option to files function in Mojo::Util. (batman, sri) + - Fixed bug where Morbo would not ignore hidden files. (batman, sri) + - Fixed bug where Morbo would ignore the --verbose option. + - Fixed keep-alive bug in Mojo::UserAgent. (jberger) + 6.55 2016-03-08 - Deprecated Mojo::Server::Morbo::check in favor of Mojo::Server::Morbo::modified_files. (leejo, nugged) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/MANIFEST new/Mojolicious-6.58/MANIFEST --- old/Mojolicious-6.55/MANIFEST 2016-03-08 21:42:16.000000000 +0100 +++ new/Mojolicious-6.58/MANIFEST 2016-04-10 19:11:02.000000000 +0200 @@ -183,6 +183,8 @@ t/mojo/ioloop_tls.t t/mojo/json.t t/mojo/json_pointer.t +t/mojo/lib/Mojo/.hidden.txt +t/mojo/lib/Mojo/.test/hidden.txt t/mojo/lib/Mojo/BaseTest/Base1.pm t/mojo/lib/Mojo/BaseTest/Base2.pm t/mojo/lib/Mojo/BaseTest/Base3.pm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/META.json new/Mojolicious-6.58/META.json --- old/Mojolicious-6.55/META.json 2016-03-08 21:42:16.000000000 +0100 +++ new/Mojolicious-6.58/META.json 2016-04-10 19:11:02.000000000 +0200 @@ -58,5 +58,5 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "6.55" + "version" : "6.58" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/META.yml new/Mojolicious-6.58/META.yml --- old/Mojolicious-6.55/META.yml 2016-03-08 21:42:16.000000000 +0100 +++ new/Mojolicious-6.58/META.yml 2016-04-10 19:11:02.000000000 +0200 @@ -31,4 +31,4 @@ homepage: http://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/mojo.git -version: '6.55' +version: '6.58' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Base.pm new/Mojolicious-6.58/lib/Mojo/Base.pm --- old/Mojolicious-6.55/lib/Mojo/Base.pm 2016-03-06 10:57:59.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Base.pm 2016-03-28 10:55:05.000000000 +0200 @@ -222,8 +222,8 @@ =head2 tap $object = $object->tap(sub {...}); - $object = $object->tap($method); - $object = $object->tap($method, @args); + $object = $object->tap('some_method'); + $object = $object->tap('some_method', @args); Tap into a method chain to perform operations on an object within the chain (also known as a K combinator or Kestrel). The object will be the first argument @@ -233,7 +233,7 @@ spliced or tapped into) a chained set of object method calls. # Longer version - $object = $object->tap(sub { $_->$method(@args) }); + $object = $object->tap(sub { $_->some_method(@args) }); # Inject side effects into a method chain $object->foo('A')->tap(sub { say $_->foo })->foo('B'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Collection.pm new/Mojolicious-6.58/lib/Mojo/Collection.pm --- old/Mojolicious-6.55/lib/Mojo/Collection.pm 2016-03-06 10:57:59.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Collection.pm 2016-03-30 22:43:45.000000000 +0200 @@ -192,8 +192,8 @@ my $first = $collection->first; my $first = $collection->first(qr/foo/); my $first = $collection->first(sub {...}); - my $first = $collection->first($method); - my $first = $collection->first($method, @args); + my $first = $collection->first('some_method'); + my $first = $collection->first('some_method', @args); Evaluate regular expression/callback for, or call method on, each element in collection and return the first one that matched the regular expression, or for @@ -201,7 +201,7 @@ passed to the callback, and is also available as C<$_>. # Longer version - my $first = $collection->first(sub { $_->$method(@args) }); + my $first = $collection->first(sub { $_->some_method(@args) }); # Find first value that contains the word "mojo" my $interesting = $collection->first(qr/mojo/i); @@ -223,8 +223,8 @@ my $new = $collection->grep(qr/foo/); my $new = $collection->grep(sub {...}); - my $new = $collection->grep($method); - my $new = $collection->grep($method, @args); + my $new = $collection->grep('some_method'); + my $new = $collection->grep('some_method', @args); Evaluate regular expression/callback for, or call method on, each element in collection and create a new collection with all elements that matched the @@ -233,7 +233,7 @@ C<$_>. # Longer version - my $new = $collection->grep(sub { $_->$method(@args) }); + my $new = $collection->grep(sub { $_->some_method(@args) }); # Find all values that contain the word "mojo" my $interesting = $collection->grep(qr/mojo/i); @@ -260,15 +260,15 @@ =head2 map my $new = $collection->map(sub {...}); - my $new = $collection->map($method); - my $new = $collection->map($method, @args); + my $new = $collection->map('some_method'); + my $new = $collection->map('some_method', @args); Evaluate callback for, or call method on, each element in collection and create a new collection from the results. The element will be the first argument passed to the callback, and is also available as C<$_>. # Longer version - my $new = $collection->map(sub { $_->$method(@args) }); + my $new = $collection->map(sub { $_->some_method(@args) }); # Append the word "mojo" to all values my $mojoified = $collection->map(sub { $_ . 'mojo' }); @@ -284,8 +284,11 @@ my $result = $collection->reduce(sub {...}); my $result = $collection->reduce(sub {...}, $initial); -Reduce elements in collection with callback, the first element will be used as -initial value if none has been provided. +Reduce elements in collection with a callback and return its final result, +setting C<$a> and C<$b> each time the callback is executed. The first time C<$a> +will be set to an optional initial value or the first element in the collection. +And from then on C<$a> will be set to the return value of the callback, while +C<$b> will always be set to the next element in the collection. # Calculate the sum of all values my $sum = $collection->reduce(sub { $a + $b }); @@ -325,8 +328,9 @@ my $new = $collection->sort; my $new = $collection->sort(sub {...}); -Sort elements based on return value of callback and create a new collection -from the results. +Sort elements based on return value of a callback and create a new collection +from the results, setting C<$a> and C<$b> to the elements being compared, each +time the callback is executed. # Sort values case-insensitive my $case_insensitive = $collection->sort(sub { uc($a) cmp uc($b) }); @@ -347,15 +351,15 @@ my $new = $collection->uniq; my $new = $collection->uniq(sub {...}); - my $new = $collection->uniq($method); - my $new = $collection->uniq($method, @args); + my $new = $collection->uniq('some_method'); + my $new = $collection->uniq('some_method', @args); Create a new collection without duplicate elements, using the string representation of either the elements or the return value of the callback/method. # Longer version - my $new = $collection->uniq(sub { $_->$method(@args) }); + my $new = $collection->uniq(sub { $_->some_method(@args) }); # "foo bar baz" Mojo::Collection->new('foo', 'bar', 'bar', 'baz')->uniq->join(' '); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Headers.pm new/Mojolicious-6.58/lib/Mojo/Headers.pm --- old/Mojolicious-6.55/lib/Mojo/Headers.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Headers.pm 2016-03-28 10:55:05.000000000 +0200 @@ -154,7 +154,7 @@ =head1 NAME -Mojo::Headers - Headers +Mojo::Headers - HTTP headers =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Home.pm new/Mojolicious-6.58/lib/Mojo/Home.pm --- old/Mojolicious-6.55/lib/Mojo/Home.pm 2016-03-08 17:37:54.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Home.pm 2016-03-28 10:55:05.000000000 +0200 @@ -38,9 +38,9 @@ } sub list_files { - my ($self, $dir) = (shift, shift // ''); + my ($self, $dir, $options) = (shift, shift // '', shift); $dir = catdir @{$self->parts}, split('/', $dir); - return [map { join '/', splitdir abs2rel($_, $dir) } files $dir]; + return [map { join '/', splitdir abs2rel($_, $dir) } files $dir, $options]; } sub mojo_lib_dir { catdir dirname(__FILE__), '..' } @@ -111,11 +111,24 @@ my $files = $home->list_files; my $files = $home->list_files('foo/bar'); + my $files = $home->list_files('foo/bar', {hidden => 1}); Portably list all files recursively in directory relative to the home directory. # List layouts - say for @{$home->rel_file($home->list_files('templates/layouts')}; + say $home->rel_file($_) for @{$home->list_files('templates/layouts')}; + +These options are currently available: + +=over 2 + +=item hidden + + hidden => 1 + +Include hidden files and directories. + +=back =head2 mojo_lib_dir diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/IOLoop/Client.pm new/Mojolicious-6.58/lib/Mojo/IOLoop/Client.pm --- old/Mojolicious-6.55/lib/Mojo/IOLoop/Client.pm 2016-03-06 10:57:59.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/IOLoop/Client.pm 2016-03-28 10:55:05.000000000 +0200 @@ -287,7 +287,7 @@ handle => $handle -Use an already prepared handle. +Use an already prepared L<IO::Socket::IP> object. =item local_address diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/IOLoop/Server.pm new/Mojolicious-6.58/lib/Mojo/IOLoop/Server.pm --- old/Mojolicious-6.55/lib/Mojo/IOLoop/Server.pm 2016-03-08 12:33:53.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/IOLoop/Server.pm 2016-03-28 10:55:05.000000000 +0200 @@ -231,7 +231,7 @@ my $handle = $server->handle; -Get handle for server. +Get handle for server, usually an L<IO::Socket::IP> object. =head2 is_accepting diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/IOLoop/Stream.pm new/Mojolicious-6.58/lib/Mojo/IOLoop/Stream.pm --- old/Mojolicious-6.55/lib/Mojo/IOLoop/Stream.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/IOLoop/Stream.pm 2016-03-28 10:55:05.000000000 +0200 @@ -251,7 +251,8 @@ my $handle = $stream->handle; -Get handle for stream. +Get handle for stream, usually an L<IO::Socket::IP> or L<IO::Socket::SSL> +object. =head2 is_readable @@ -282,7 +283,7 @@ my $handle = $stream->steal_handle; -Steal handle from stream and prevent it from getting closed automatically. +Steal L</"handle"> and prevent it from getting closed automatically. =head2 stop diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/JSON.pm new/Mojolicious-6.58/lib/Mojo/JSON.pm --- old/Mojolicious-6.55/lib/Mojo/JSON.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/JSON.pm 2016-04-02 00:15:18.000000000 +0200 @@ -213,7 +213,7 @@ sub _encode_object { my $object = shift; my @pairs = map { _encode_string($_) . ':' . _encode_value($object->{$_}) } - keys %$object; + sort keys %$object; return '{' . join(',', @pairs) . '}'; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Loader.pm new/Mojolicious-6.58/lib/Mojo/Loader.pm --- old/Mojolicious-6.55/lib/Mojo/Loader.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Loader.pm 2016-04-08 14:11:28.000000000 +0200 @@ -43,11 +43,14 @@ sub load_class { my $class = shift; - # Check for a valid class name + # Invalid class name return 1 if ($class || '') !~ /^\w(?:[\w:']*\w)?$/; - # Load if not already loaded - return undef if $class->can('new') || eval "require $class; 1"; + # Already loaded + return undef if $class->can('new'); + + # Success + eval "require $class; 1" ? return undef : Mojo::Util::_teardown($class); # Does not exist return 1 if $@ =~ /^Can't locate \Q@{[class_to_path $class]}\E in \@INC/; @@ -91,7 +94,7 @@ =head1 NAME -Mojo::Loader - Loader +Mojo::Loader - Load all kinds of things =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Log.pm new/Mojolicious-6.58/lib/Mojo/Log.pm --- old/Mojolicious-6.55/lib/Mojo/Log.pm 2016-03-06 13:33:23.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Log.pm 2016-03-28 10:55:05.000000000 +0200 @@ -26,7 +26,8 @@ # DEPRECATED! for my $name (qw(debug error info warn)) { monkey_patch __PACKAGE__, "is_$name", sub { - deprecated "Mojo::Log::$name is DEPRECATED in favor of Mojo::Log::is_level"; + deprecated + "Mojo::Log::is_$name is DEPRECATED in favor of Mojo::Log::is_level"; shift->is_level($name); }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Message/Response.pm new/Mojolicious-6.58/lib/Mojo/Message/Response.pm --- old/Mojolicious-6.55/lib/Mojo/Message/Response.pm 2016-03-06 10:57:59.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Message/Response.pm 2016-04-06 12:46:20.000000000 +0200 @@ -250,7 +250,7 @@ my $bool = $res->is_empty; -Check if this is a C<1xx>, C<204> or C<304> response. +Check if this response has a C<1xx>, C<204> or C<304> status code. =head2 is_status_class @@ -258,6 +258,14 @@ Check response status class. + # True + Mojo::Message::Response->new->code(304)->is_status_class(300); + Mojo::Message::Response->new->code(404)->is_status_class(400); + + # False + Mojo::Message::Response->new->code(404)->is_status_class(300); + Mojo::Message::Response->new->code(404)->is_status_class(200); + =head2 start_line_size my $size = $req->start_line_size; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Server/Morbo.pm new/Mojolicious-6.58/lib/Mojo/Server/Morbo.pm --- old/Mojolicious-6.55/lib/Mojo/Server/Morbo.pm 2016-03-08 17:48:01.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Server/Morbo.pm 2016-03-28 10:55:05.000000000 +0200 @@ -59,7 +59,7 @@ say @files == 1 ? qq{File "@{[$files[0]]}" changed, restarting.} : qq{@{[scalar @files]} files changed, restarting.} - if $ENV{MORBO_DEBUG}; + if $ENV{MORBO_VERBOSE}; kill 'TERM', $self->{worker} if $self->{worker}; $self->{modified} = 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Transaction/WebSocket.pm new/Mojolicious-6.58/lib/Mojo/Transaction/WebSocket.pm --- old/Mojolicious-6.55/lib/Mojo/Transaction/WebSocket.pm 2016-03-06 13:33:46.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Transaction/WebSocket.pm 2016-04-10 19:08:43.000000000 +0200 @@ -5,19 +5,13 @@ use Config; use List::Util 'first'; use Mojo::JSON qw(encode_json j); -use Mojo::Util qw(decode deprecated encode trim); +use Mojo::Util qw(decode encode trim); use Mojo::WebSocket qw(WS_BINARY WS_CLOSE WS_CONTINUATION WS_PING WS_PONG WS_TEXT); has [qw(compressed established handshake masked)]; has max_websocket_size => sub { $ENV{MOJO_MAX_WEBSOCKET_SIZE} || 262144 }; -# DEPRECATED! -sub build_frame { - deprecated 'Mojo::Transaction::WebSocket::build_frame is DEPRECATED'; - Mojo::WebSocket::build_frame(shift->masked, @_); -} - sub build_message { my ($self, $frame) = @_; @@ -73,12 +67,6 @@ sub local_address { shift->handshake->local_address } sub local_port { shift->handshake->local_port } -# DEPRECATED! -sub parse_frame { - deprecated 'Mojo::Transaction::WebSocket::parse_frame is DEPRECATED'; - Mojo::WebSocket::parse_frame($_[1], $_[0]->max_websocket_size); -} - sub parse_message { my ($self, $frame) = @_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/UserAgent.pm new/Mojolicious-6.58/lib/Mojo/UserAgent.pm --- old/Mojolicious-6.55/lib/Mojo/UserAgent.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/UserAgent.pm 2016-03-28 10:55:05.000000000 +0200 @@ -218,14 +218,11 @@ $c->{ioloop}->remove($c->{timeout}) if $c->{timeout}; return $self->_reuse($id, $close) unless my $old = $c->{tx}; - # Premature connection close or 4xx/5xx + # Premature connection close my $res = $old->closed->res->finish; if ($close && !$res->code && !$res->error) { $res->error({message => 'Premature connection close'}); } - elsif ($res->is_status_class(400) || $res->is_status_class(500)) { - $res->error({message => $res->message, code => $res->code}); - } # Always remove connection for WebSockets return $self->_remove($id) if $old->is_websocket; @@ -240,8 +237,10 @@ return $new->client_read($old->res->content->leftovers); } - # Finish connection and handle redirects $self->_reuse($id, $close); + if ($res->is_status_class(400) || $res->is_status_class(500)) { + $res->error({message => $res->message, code => $res->code}); + } $c->{cb}($self, $old) unless $self->_redirect($c, $old); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/Util.pm new/Mojolicious-6.58/lib/Mojo/Util.pm --- old/Mojolicious-6.55/lib/Mojo/Util.pm 2016-03-08 08:38:21.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/Util.pm 2016-03-28 10:55:05.000000000 +0200 @@ -127,11 +127,17 @@ sub encode { _encoding($_[0])->encode("$_[1]") } sub files { - my $dir = shift; - my @files; - my $wanted = sub { -d $File::Find::name or push @files, $File::Find::name }; - find {wanted => $wanted, no_chdir => 1}, $dir if -d $dir; - return sort @files; + my ($dir, $options) = (shift, shift // {}); + + # This may break in the future, but is worth it for performance + local $File::Find::skip_pattern = qr/^\./ unless $options->{hidden}; + + my %files; + my $want = sub { $files{$File::Find::name}++ }; + my $post = sub { delete $files{$File::Find::dir} }; + find {wanted => $want, postprocess => $post, no_chdir => 1}, $dir if -d $dir; + + return sort keys %files; } sub html_unescape { @@ -149,17 +155,13 @@ my $input = shift; use integer; - my $n = PC_INITIAL_N; - my $i = 0; - my $bias = PC_INITIAL_BIAS; - my @output; + my ($n, $i, $bias, @output) = (PC_INITIAL_N, 0, PC_INITIAL_BIAS); # Consume all code points before the last delimiter push @output, split('', $1) if $input =~ s/(.*)\x2d//s; while (length $input) { - my $oldi = $i; - my $w = 1; + my ($oldi, $w) = ($i, 1); # Base to infinity in steps of base for (my $k = PC_BASE; 1; $k += PC_BASE) { @@ -186,25 +188,20 @@ my $output = shift; use integer; - my $n = PC_INITIAL_N; - my $delta = 0; - my $bias = PC_INITIAL_BIAS; + my ($n, $delta, $bias) = (PC_INITIAL_N, 0, PC_INITIAL_BIAS); # Extract basic code points - my $len = length $output; my @input = map {ord} split '', $output; - my @chars = sort grep { $_ >= PC_INITIAL_N } @input; $output =~ s/[^\x00-\x7f]+//gs; my $h = my $basic = length $output; $output .= "\x2d" if $basic > 0; - for my $m (@chars) { + for my $m (sort grep { $_ >= PC_INITIAL_N } @input) { next if $m < $n; $delta += ($m - $n) * ($h + 1); $n = $m; - for (my $i = 0; $i < $len; $i++) { - my $c = $input[$i]; + for my $c (@input) { if ($c < $n) { $delta++ } elsif ($c == $n) { @@ -586,12 +583,25 @@ =head2 files my @files = files '/tmp/uploads'; + my @files = files '/tmp/uploads', {hidden => 1}; List all files recursively in a directory. # List all templates say for files '/home/sri/myapp/templates'; +These options are currently available: + +=over 2 + +=item hidden + + hidden => 1 + +Include hidden files and directories. + +=back + =head2 hmac_sha1_sum my $checksum = hmac_sha1_sum $bytes, 'passw0rd'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojo/WebSocket.pm new/Mojolicious-6.58/lib/Mojo/WebSocket.pm --- old/Mojolicious-6.55/lib/Mojo/WebSocket.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojo/WebSocket.pm 2016-03-28 10:55:05.000000000 +0200 @@ -171,7 +171,7 @@ =head1 NAME -Mojo::WebSocket - The WebSocket Protocol +Mojo::WebSocket - The WebSocket protocol =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Command/cpanify.pm new/Mojolicious-6.58/lib/Mojolicious/Command/cpanify.pm --- old/Mojolicious-6.55/lib/Mojolicious/Command/cpanify.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Command/cpanify.pm 2016-03-28 10:55:05.000000000 +0200 @@ -43,7 +43,7 @@ =head1 NAME -Mojolicious::Command::cpanify - Cpanify command +Mojolicious::Command::cpanify - CPAN-ify command =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Command/generate/app.pm new/Mojolicious-6.58/lib/Mojolicious/Command/generate/app.pm --- old/Mojolicious-6.55/lib/Mojolicious/Command/generate/app.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Command/generate/app.pm 2016-04-07 14:55:34.000000000 +0200 @@ -119,9 +119,9 @@ use FindBin; BEGIN { unshift @INC, "$FindBin::Bin/../lib" } +use Mojolicious::Commands; # Start command line interface for application -require Mojolicious::Commands; Mojolicious::Commands->start_app('<%= $class %>'); @@ appclass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Controller.pm new/Mojolicious-6.58/lib/Mojolicious/Controller.pm --- old/Mojolicious-6.55/lib/Mojolicious/Controller.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Controller.pm 2016-04-09 18:21:20.000000000 +0200 @@ -548,7 +548,7 @@ # Do something after the transaction has been finished $c->on(finish => sub { my $c = shift; - $c->app->log->debug('We are done'); + $c->app->log->debug('All data has been sent'); }); # Receive WebSocket message @@ -610,16 +610,21 @@ $c = $c->redirect_to('/index.html'); $c = $c->redirect_to('http://example.com/index.html'); -Prepare a C<302> redirect response, takes the same arguments as L</"url_for">. +Prepare a C<302> (if the status code is not already C<3xx>) redirect response +with C<Location> header, takes the same arguments as L</"url_for">. - # Moved permanently + # Moved Permanently $c->res->code(301); $c->redirect_to('some_route'); + # Temporary Redirect + $c->res->code(307); + $c->redirect_to('some_route'); + =head2 render my $bool = $c->render; - my $bool = $c->render(controller => 'foo', action => 'bar'); + my $bool = $c->render(foo => 'bar', baz => 23); my $bool = $c->render(template => 'foo/index'); my $bool = $c->render(template => 'index', format => 'html'); my $bool = $c->render(data => $bytes); @@ -678,7 +683,7 @@ =head2 render_maybe my $bool = $c->render_maybe; - my $bool = $c->render_maybe(controller => 'foo', action => 'bar'); + my $bool = $c->render_maybe(foo => 'bar', baz => 23); my $bool = $c->render_maybe('foo/index', format => 'html'); Try to render content, but do not call diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Guides/Contributing.pod new/Mojolicious-6.58/lib/Mojolicious/Guides/Contributing.pod --- old/Mojolicious-6.55/lib/Mojolicious/Guides/Contributing.pod 2016-03-06 10:57:59.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Guides/Contributing.pod 2016-03-30 17:52:59.000000000 +0200 @@ -60,9 +60,12 @@ documentation improvements. While the L<Mojolicious::Guides> are carefully curated by the core team, everybody with a (free) GitHub account can make changes and add new information to the -L<Mojolicious wiki|http://github.com/kraih/mojo/wiki>. Pull requests with -additions or changes to the documentation included in the L<Mojolicious> -distribution follow the same rules as code contributions. +L<Mojolicious wiki|http://github.com/kraih/mojo/wiki>. + +Pull requests with additions or changes to the documentation included in the +L<Mojolicious> distribution follow the same rules as code contributions. Please +don't send pull requests for overly simplistic changes, such as the addition of +a comma or semicolon. =head1 CONTRIBUTING CODE @@ -176,8 +179,9 @@ Please consider sponsoring the ongoing development of L<Mojolicious>, especially if your company benefits from this project. We welcome your patronage on L<Gratipay|https://gratipay.com/mojolicious>, -L<Bountysource|https://www.bountysource.com/teams/mojolicious> or -L<PayPal|https://www.paypal.me/kraih>. +L<Bountysource|https://www.bountysource.com/teams/mojolicious>, +L<PayPal|https://www.paypal.me/kraih> or through Bitcoin +(C<1Cid78CmK4hvf78Ry8K2XeDx8pQHNh4hbz>). Grants for contiguous full-time development, over the period of a few days, can also have a huge impact. They allow us to tackle complex issues that are @@ -186,8 +190,8 @@ =head1 CODE OF CONDUCT -Like the technical community as a whole, the Mojolicious team and community is -made up of a mixture of professionals and volunteers from all over the world, +Like the technical community as a whole, the L<Mojolicious> team and community +is made up of a mixture of professionals and volunteers from all over the world, working on every aspect of the mission - including mentorship, teaching, and connecting people. @@ -200,10 +204,10 @@ the spirit in which it’s intended - a guide to make it easier to enrich all of us and the technical communities in which we participate. -This code of conduct applies to all spaces managed by the Mojolicious project. -This includes IRC, the mailing lists, the issue tracker, and any other forums -created by the project team which the community uses for communication. In -addition, violations of this code outside these spaces may affect a person's +This code of conduct applies to all spaces managed by the L<Mojolicious> +project. This includes IRC, the mailing lists, the issue tracker, and any other +forums created by the project team which the community uses for communication. +In addition, violations of this code outside these spaces may affect a person's ability to participate within them. If you believe someone is violating the code of conduct, we ask that you report @@ -232,8 +236,8 @@ experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. Members -of the Mojolicious community should be respectful when dealing with other -members as well as with people outside the Mojolicious community. +of the L<Mojolicious> community should be respectful when dealing with other +members as well as with people outside the L<Mojolicious> community. =item * B<Be careful in the words that you choose.> We are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do @@ -263,10 +267,10 @@ =back =item * B<When we disagree, try to understand why.> Disagreements, both social -and technical, happen all the time and Mojolicious is no exception. It is +and technical, happen all the time and L<Mojolicious> is no exception. It is important that we resolve disagreements and differing views constructively. -Remember that we’re different. The strength of Mojolicious comes from its varied -community, people from a wide range of backgrounds. Different people have +Remember that we’re different. The strength of L<Mojolicious> comes from its +varied community, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to err and blaming each other doesn’t get us anywhere. Instead, focus on helping to @@ -276,6 +280,22 @@ Original text courtesy of the L<Speak Up! project|http://speakup.io/coc.html>. +=head1 FORK POLICY + +The L<Mojolicious> core team believes that there is a lot of value in the entire +toolkit being a unified project. Forks drain resources from a project, not just +mindshare but also very valuable bug reports and patches, which can have very +serious security implications. Therefore we ask that you please not publically +fork pieces of the L<Mojolicious> distribution without our consent. As doing so +is against our express wishes, individuals who engage in unauthorized forking +may be denied from participating in community sponsored spaces. + +For developers considering the use of a forked module, we strongly recommend +that you make yourself familiar with its history and track record. While many +parts of L<Mojolicious> have been forked in the past, very few forks have been +able to keep up with L<Mojolicious> development, and most are missing critical +bug fixes. + =head1 MORE You can continue with L<Mojolicious::Guides> now or take a look at the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Guides/Cookbook.pod new/Mojolicious-6.58/lib/Mojolicious/Guides/Cookbook.pod --- old/Mojolicious-6.55/lib/Mojolicious/Guides/Cookbook.pod 2016-03-06 10:58:41.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Guides/Cookbook.pod 2016-04-07 14:55:54.000000000 +0200 @@ -3,7 +3,7 @@ =head1 NAME -Mojolicious::Guides::Cookbook - Cookbook +Mojolicious::Guides::Cookbook - Cooking with Mojolicious =head1 OVERVIEW @@ -1348,7 +1348,8 @@ By now you've probably used many of the built-in commands described in L<Mojolicious::Commands>, but did you know that you can just add new ones and -that they will be picked up automatically by the command line interface? +that they will be picked up automatically by the command line interface if they +are placed in a directory from C<@INC>? package Mojolicious::Command::spy; use Mojo::Base 'Mojolicious::Command'; @@ -1360,10 +1361,10 @@ my ($self, @args) = @_; # Leak secret passphrases - say for @{$self->app->secrets} if $args[0] eq 'secrets'; + if ($args[0] eq 'secrets') { say for @{$self->app->secrets} } # Leak mode - say $self->app->mode if $args[0] eq 'mode'; + elsif ($args[0] eq 'mode') { say $self->app->mode } } 1; @@ -1374,7 +1375,7 @@ $ mojo spy secrets HelloWorld - $ ./myapp.pl spy secrets + $ ./script/myapp spy secrets secr3t And to make your commands application specific, just add a custom namespace to @@ -1397,7 +1398,7 @@ The options C<-h>/C<--help>, C<--home> and C<-m>/C<--mode> are handled automatically by L<Mojolicious::Commands> and are shared by all commands. - $ ./myapp.pl spy -m production mode + $ ./script/myapp spy -m production mode production For a full list of shared options see L<Mojolicious::Commands/"SYNOPSIS">. @@ -1473,9 +1474,9 @@ use FindBin; BEGIN { unshift @INC, "$FindBin::Bin/../lib" } + use Mojolicious::Commands; # Start command line interface for application - require Mojolicious::Commands; Mojolicious::Commands->start_app('MyApp'); That's really everything, now you can package your application like any other diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Guides/FAQ.pod new/Mojolicious-6.58/lib/Mojolicious/Guides/FAQ.pod --- old/Mojolicious-6.55/lib/Mojolicious/Guides/FAQ.pod 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Guides/FAQ.pod 2016-03-28 10:55:05.000000000 +0200 @@ -218,7 +218,9 @@ L<Mojolicious> uses secret passphrases for security features such as signed cookies. It defaults to using L<Mojolicious/"moniker">, which is not very secure, so we added this log message as a reminder. You can change the -passphrase with the attribute L<Mojolicious/"secrets">. +passphrase with the attribute L<Mojolicious/"secrets">. Since some plugins also +depend on it, you should try changing it as early as possible in your +application. $app->secrets(['My very secret passphrase.']); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Guides/Growing.pod new/Mojolicious-6.58/lib/Mojolicious/Guides/Growing.pod --- old/Mojolicious-6.55/lib/Mojolicious/Guides/Growing.pod 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Guides/Growing.pod 2016-04-07 14:56:29.000000000 +0200 @@ -3,7 +3,7 @@ =head1 NAME -Mojolicious::Guides::Growing - Growing +Mojolicious::Guides::Growing - Growing Mojolicious applications =head1 OVERVIEW @@ -629,9 +629,9 @@ use warnings; use lib 'lib'; + use Mojolicious::Commands; # Start command line interface for application - require Mojolicious::Commands; Mojolicious::Commands->start_app('MyApp'); And the directory structure of our hybrid application should be looking like @@ -754,9 +754,9 @@ use FindBin; BEGIN { unshift @INC, "$FindBin::Bin/../lib" } + use Mojolicious::Commands; # Start command line interface for application - require Mojolicious::Commands; Mojolicious::Commands->start_app('MyApp'); =head2 Simplified tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Guides/Rendering.pod new/Mojolicious-6.58/lib/Mojolicious/Guides/Rendering.pod --- old/Mojolicious-6.55/lib/Mojolicious/Guides/Rendering.pod 2016-03-08 14:50:25.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Guides/Rendering.pod 2016-03-28 10:55:05.000000000 +0200 @@ -3,7 +3,7 @@ =head1 NAME -Mojolicious::Guides::Rendering - Rendering +Mojolicious::Guides::Rendering - Rendering content =head1 OVERVIEW diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Guides/Routing.pod new/Mojolicious-6.58/lib/Mojolicious/Guides/Routing.pod --- old/Mojolicious-6.55/lib/Mojolicious/Guides/Routing.pod 2016-03-06 10:58:41.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Guides/Routing.pod 2016-03-31 16:12:44.000000000 +0200 @@ -3,7 +3,7 @@ =head1 NAME -Mojolicious::Guides::Routing - Routing +Mojolicious::Guides::Routing - Routing requests =head1 OVERVIEW @@ -241,8 +241,8 @@ # HEAD /test -> {controller => 'bar', action => 'test'} $r->get('/test')->to(controller => 'bar', action => 'test'); -You can also use the C<_method> query parameter to override the request method, -this can be very useful when submitting forms with browsers that only support +You can also use the C<_method> query parameter to override the request method. +This can be very useful when submitting forms with browsers that only support C<GET> and C<POST>. # PUT /stuff -> {controller => 'baz', action => 'stuff'} @@ -418,7 +418,7 @@ =head2 Named routes Naming your routes will allow backreferencing in many methods and helpers -throughout the whole framework, most of them internally rely on +throughout the whole framework, most of which internally rely on L<Mojolicious::Controller/"url_for"> for this. # /foo/marcus -> {controller => 'foo', action => 'bar', user => 'marcus'} @@ -565,7 +565,7 @@ return 1 if $c->req->headers->header('X-Bender'); # Not authenticated - $c->render(text => "You're not Bender."); + $c->render(text => "You're not Bender.", status => 401); return undef; }); $auth->get('/blackjack')->to('hideout#blackjack'); @@ -852,8 +852,9 @@ =head2 Rearranging routes -Until the first request has been handled, all routes can still be moved around -or even removed with methods like L<Mojolicious::Routes::Route/"add_child"> and +From application startup until the first request has arrived, all routes can +still be moved around or even removed with methods like +L<Mojolicious::Routes::Route/"add_child"> and L<Mojolicious::Routes::Route/"remove">. # GET /example/show -> {controller => 'example', action => 'show'} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Guides/Tutorial.pod new/Mojolicious-6.58/lib/Mojolicious/Guides/Tutorial.pod --- old/Mojolicious-6.55/lib/Mojolicious/Guides/Tutorial.pod 2016-03-07 08:33:51.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Guides/Tutorial.pod 2016-03-28 10:55:05.000000000 +0200 @@ -3,7 +3,7 @@ =head1 NAME -Mojolicious::Guides::Tutorial - Tutorial +Mojolicious::Guides::Tutorial - Get started with Mojolicious =head1 TUTORIAL @@ -15,8 +15,8 @@ A simple Hello World application can look like this, L<strict>, L<warnings>, L<utf8> and Perl 5.10 L<features|feature> are automatically enabled and a few -functions imported when you use L<Mojolicious::Lite>, turning your script into a -full featured web application. +L<functions|Mojolicious::Lite/"FUNCTIONS"> imported, when you use +L<Mojolicious::Lite>, turning your script into a full featured web application. #!/usr/bin/env perl use Mojolicious::Lite; @@ -28,15 +28,16 @@ app->start; -There is also a helper command to generate a small example application. +With L<Mojolicious::Command::generate::lite_app> there is also a helper command +to generate a small example application. $ mojo generate lite_app myapp.pl =head2 Commands -All the normal L<Mojolicious::Commands> are available from the command line. -Note that CGI and L<PSGI> environments can usually be auto detected and will -just work without commands. +Many different L<commands|Mojolicious::Commands/"COMMANDS"> are automatically +available from the command line. CGI and L<PSGI> environments can even be +detected and will usually just work without commands. $ ./myapp.pl daemon Server available at http://127.0.0.1:3000 @@ -53,11 +54,15 @@ $ ./myapp.pl ...List of available commands (or automatically detected environment)... -The C<app-E<gt>start> call that starts the L<Mojolicious> command system should -usually be the last expression in your application and can be customized to -override normal C<@ARGV> use. +A call to L<Mojolicious/"start"> (C<app-E<gt>start>), which starts the command +system, should be the last expression in your application, because its return +value can be significant. - app->start('daemon'); + # Use @ARGV to pick a command + app->start; + + # Start the "daemon" command + app->start('daemon', '-l', 'http://*:8080'); =head2 Reloading @@ -675,7 +680,12 @@ =head2 External templates External templates will be searched by the renderer in a C<templates> directory -if it exists and have a higher precedence than those in the C<DATA> section. +if it exists. + + $ mkdir -p templates/foo + $ echo 'Hello World!' > templates/foo/bar.html.ep + +They have a higher precedence than templates in the C<DATA> section. use Mojolicious::Lite; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Plugin/DefaultHelpers.pm new/Mojolicious-6.58/lib/Mojolicious/Plugin/DefaultHelpers.pm --- old/Mojolicious-6.55/lib/Mojolicious/Plugin/DefaultHelpers.pm 2016-03-07 13:38:04.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Plugin/DefaultHelpers.pm 2016-03-30 22:38:46.000000000 +0200 @@ -441,7 +441,8 @@ Reply with a static file using L<Mojolicious/"static">, usually from the C<public> directories or C<DATA> sections of your application. Note that this -helper does not protect from traversing to parent directories. +helper uses a relative path, but does not protect from traversing to parent +directories. # Serve file with a custom content type $c->res->headers->content_type('application/myapp'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Plugin/TagHelpers.pm new/Mojolicious-6.58/lib/Mojolicious/Plugin/TagHelpers.pm --- old/Mojolicious-6.55/lib/Mojolicious/Plugin/TagHelpers.pm 2016-03-08 14:49:43.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Plugin/TagHelpers.pm 2016-03-28 10:55:05.000000000 +0200 @@ -65,12 +65,10 @@ my ($c, $name) = (shift, shift); my %attrs = @_ % 2 ? (value => shift, @_) : @_; - # Special selection value - my @values = @{$c->every_param($name)}; - my $type = $attrs{type} || ''; - if (@values && $type ne 'submit') { + if (my @values = @{$c->every_param($name)}) { # Checkbox or radiobutton + my $type = $attrs{type} || ''; if ($type eq 'checkbox' || $type eq 'radio') { delete $attrs{checked} if @values; my $value = $attrs{value} // 'on'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Routes/Pattern.pm new/Mojolicious-6.58/lib/Mojolicious/Routes/Pattern.pm --- old/Mojolicious-6.55/lib/Mojolicious/Routes/Pattern.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Routes/Pattern.pm 2016-03-28 10:55:05.000000000 +0200 @@ -202,7 +202,7 @@ =head1 NAME -Mojolicious::Routes::Pattern - Routes pattern engine +Mojolicious::Routes::Pattern - Route pattern =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Static.pm new/Mojolicious-6.58/lib/Mojolicious/Static.pm --- old/Mojolicious-6.55/lib/Mojolicious/Static.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Static.pm 2016-03-30 22:38:30.000000000 +0200 @@ -219,8 +219,8 @@ Build L<Mojo::Asset::File> or L<Mojo::Asset::Memory> object for a file, relative to L</"paths"> or from L</"classes">, or return C<undef> if it doesn't -exist. Note that this method does not protect from traversing to parent -directories. +exist. Note that this method uses a relative path, but does not protect from +traversing to parent directories. my $content = $static->file('foo/bar.html')->slurp; @@ -256,7 +256,8 @@ my $bool = $static->serve(Mojolicious::Controller->new, '../lib/MyApp.pm'); Serve a specific file, relative to L</"paths"> or from L</"classes">. Note that -this method does not protect from traversing to parent directories. +this method uses a relative path, but does not protect from traversing to parent +directories. =head2 serve_asset diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Validator/Validation.pm new/Mojolicious-6.58/lib/Mojolicious/Validator/Validation.pm --- old/Mojolicious-6.55/lib/Mojolicious/Validator/Validation.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Validator/Validation.pm 2016-03-28 10:55:05.000000000 +0200 @@ -72,8 +72,8 @@ for my $cb (map { $self->validator->filters->{$_} } @filters) { @input = map { $self->$cb($name, $_) } @input; } - $self->output->{$name} = @input > 1 ? \@input : $input[0] - unless grep { !length } @input; + $self->output->{$name} = ref $input eq 'ARRAY' ? \@input : $input[0] + if @input && !grep { !length } @input; return $self->topic($name); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious/Validator.pm new/Mojolicious-6.58/lib/Mojolicious/Validator.pm --- old/Mojolicious-6.55/lib/Mojolicious/Validator.pm 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious/Validator.pm 2016-03-28 10:55:05.000000000 +0200 @@ -40,7 +40,7 @@ return $len < $min || $len > $max; } -sub _trim { trim $_[2] } +sub _trim { trim $_[2] // '' } 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/lib/Mojolicious.pm new/Mojolicious-6.58/lib/Mojolicious.pm --- old/Mojolicious-6.55/lib/Mojolicious.pm 2016-03-08 10:43:32.000000000 +0100 +++ new/Mojolicious-6.58/lib/Mojolicious.pm 2016-04-08 13:57:52.000000000 +0200 @@ -43,7 +43,7 @@ has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Clinking Beer Mugs'; -our $VERSION = '6.55'; +our $VERSION = '6.58'; sub AUTOLOAD { my $self = shift; @@ -985,6 +985,8 @@ Roland Lammel +Roy Storey + Ryan Jendoubi Sascha Kiefer @@ -1043,7 +1045,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright (C) 2008-2016, Sebastian Riedel. +Copyright (C) 2008-2016, Sebastian Riedel and others. This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/script/mojo new/Mojolicious-6.58/script/mojo --- old/Mojolicious-6.55/script/mojo 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/script/mojo 2016-04-07 14:56:40.000000000 +0200 @@ -3,7 +3,8 @@ use strict; use warnings; -require Mojolicious::Commands; +use Mojolicious::Commands; + Mojolicious::Commands->start_app('Mojo::HelloWorld'); =encoding utf8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/mojo/home.t new/Mojolicious-6.58/t/mojo/home.t --- old/Mojolicious-6.55/t/mojo/home.t 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/t/mojo/home.t 2016-03-28 10:55:05.000000000 +0200 @@ -50,13 +50,16 @@ # List files is_deeply $home->list_files('lib/does_not_exist'), [], 'no files'; is_deeply $home->list_files('lib/myapp.pl'), [], 'no files'; -my $files = [ +my @files = ( 'BaseTest/Base1.pm', 'BaseTest/Base2.pm', 'BaseTest/Base3.pm', 'DeprecationTest.pm', 'LoaderException.pm', 'LoaderException2.pm', 'LoaderTest/A.pm', 'LoaderTest/B.pm', 'LoaderTest/C.pm' -]; -is_deeply $home->list_files('lib/Mojo'), $files, 'right files'; +); +is_deeply $home->list_files('lib/Mojo'), \@files, 'right files'; +my @hidden = ('.hidden.txt', '.test/hidden.txt'); +is_deeply $home->list_files('lib/Mojo', {hidden => 1}), [@hidden, @files], + 'right files'; done_testing(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/mojo/hypnotoad.t new/Mojolicious-6.58/t/mojo/hypnotoad.t --- old/Mojolicious-6.55/t/mojo/hypnotoad.t 2016-03-06 10:57:59.000000000 +0100 +++ new/Mojolicious-6.58/t/mojo/hypnotoad.t 2016-03-28 10:55:05.000000000 +0200 @@ -109,7 +109,7 @@ $tx = $ua->get("http://127.0.0.1:$port1/hello"); ok $tx->is_finished, 'transaction is finished'; ok $tx->keep_alive, 'connection will be kept alive'; -ok $tx->kept_alive, 'connection was not kept alive'; +ok $tx->kept_alive, 'connection was kept alive'; is $tx->res->code, 200, 'right status'; is $tx->res->body, 'Hello Hypnotoad!', 'right content'; @@ -117,7 +117,7 @@ $tx = $ua->get("http://127.0.0.1:$port2/hello"); ok $tx->is_finished, 'transaction is finished'; ok $tx->keep_alive, 'connection will be kept alive'; -ok $tx->kept_alive, 'connection was not kept alive'; +ok $tx->kept_alive, 'connection was kept alive'; is $tx->res->code, 200, 'right status'; is $tx->res->body, 'Hello Hypnotoad!', 'right content'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/mojo/json.t new/Mojolicious-6.58/t/mojo/json.t --- old/Mojolicious-6.55/t/mojo/json.t 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/t/mojo/json.t 2016-04-02 00:16:21.000000000 +0200 @@ -168,6 +168,9 @@ is $bytes, '{"foo":[]}', 'encode {foo => []}'; $bytes = encode_json {foo => ['bar']}; is $bytes, '{"foo":["bar"]}', 'encode {foo => [\'bar\']}'; +$bytes = encode_json {foo => 'bar', baz => 'yada'}; +is $bytes, '{"baz":"yada","foo":"bar"}', + 'encode {foo => \'bar\', baz => \'yada\'}'; # Encode name $bytes = encode_json [Mojo::JSON->true]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/mojo/loader.t new/Mojolicious-6.58/t/mojo/loader.t --- old/Mojolicious-6.55/t/mojo/loader.t 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/t/mojo/loader.t 2016-04-08 13:50:37.000000000 +0200 @@ -38,6 +38,11 @@ is $e->line->[1], "1;", 'right line'; like "$e", qr/Missing right curly/, 'right message'; +# Exception again +$e = load_class 'Mojo::LoaderException'; +isa_ok $e, 'Mojo::Exception', 'right exception'; +like $e->message, qr/Attempt to reload/, 'right message'; + # Complicated exception $e = load_class 'Mojo::LoaderException2'; isa_ok $e, 'Mojo::Exception', 'right exception'; @@ -81,6 +86,7 @@ # Class does not exist is load_class('Mojo::LoaderTest'), 1, 'nothing to load'; +is load_class('Mojo::LoaderTest'), 1, 'nothing to load'; # Invalid class is load_class('Mojolicious/Lite'), 1, 'nothing to load'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/mojo/morbo.t new/Mojolicious-6.58/t/mojo/morbo.t --- old/Mojolicious-6.55/t/mojo/morbo.t 2016-03-08 10:59:01.000000000 +0100 +++ new/Mojolicious-6.58/t/mojo/morbo.t 2016-03-28 10:55:05.000000000 +0200 @@ -119,6 +119,7 @@ my @new = map { catfile $subdir, "$_.txt" } qw/test testing/; spurt 'whatever', $_ for @new; is_deeply $morbo->modified_files, \@new, 'two files have changed'; +spurt 'whatever', catfile($subdir, '.hidden.txt'); is_deeply $morbo->modified_files, [], 'directory has not changed again'; # Stop diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/mojo/user_agent.t new/Mojolicious-6.58/t/mojo/user_agent.t --- old/Mojolicious-6.55/t/mojo/user_agent.t 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/t/mojo/user_agent.t 2016-03-28 10:55:05.000000000 +0200 @@ -362,7 +362,15 @@ # 404 response $tx = $ua->get('/does_not_exist'); +ok !$tx->success, 'not successful'; +ok !$tx->kept_alive, 'kept connection not alive'; +ok $tx->keep_alive, 'keep connection alive'; +is $tx->error->{message}, 'Not Found', 'right error'; +is $tx->error->{code}, 404, 'right status'; +$tx = $ua->get('/does_not_exist'); ok !$tx->success, 'not successful'; +ok $tx->kept_alive, 'kept connection alive'; +ok $tx->keep_alive, 'keep connection alive'; is $tx->error->{message}, 'Not Found', 'right error'; is $tx->error->{code}, 404, 'right status'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/mojo/util.t new/Mojolicious-6.58/t/mojo/util.t --- old/Mojolicious-6.55/t/mojo/util.t 2016-03-03 23:13:24.000000000 +0100 +++ new/Mojolicious-6.58/t/mojo/util.t 2016-03-28 10:55:05.000000000 +0200 @@ -423,6 +423,9 @@ 'LoaderTest/C.pm' ); is_deeply [map { catfile splitdir $_ } files $lib], \@files, 'right files'; +my @hidden = map { catfile $lib, split '/' } '.hidden.txt', '.test/hidden.txt'; +is_deeply [map { catfile splitdir $_ } files $lib, {hidden => 1}], + [@hidden, @files], 'right files'; # steady_time like steady_time, qr/^[\d.]+$/, 'high resolution time'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/mojolicious/external/script/my_app new/Mojolicious-6.58/t/mojolicious/external/script/my_app --- old/Mojolicious-6.55/t/mojolicious/external/script/my_app 2016-02-23 04:42:38.000000000 +0100 +++ new/Mojolicious-6.58/t/mojolicious/external/script/my_app 2016-04-07 14:56:56.000000000 +0200 @@ -5,7 +5,7 @@ use FindBin; BEGIN { unshift @INC, "$FindBin::Bin/../lib" } +use Mojolicious::Commands; # Start command line interface for application -require Mojolicious::Commands; Mojolicious::Commands->start_app('MyApp'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/mojolicious/validation_lite_app.t new/Mojolicious-6.58/t/mojolicious/validation_lite_app.t --- old/Mojolicious-6.55/t/mojolicious/validation_lite_app.t 2016-03-08 14:46:42.000000000 +0100 +++ new/Mojolicious-6.58/t/mojolicious/validation_lite_app.t 2016-03-28 10:55:05.000000000 +0200 @@ -63,6 +63,22 @@ is_deeply $validation->output, {foo => 'bar', baz => 'yada'}, 'right result'; ok $validation->has_error, 'has error'; is_deeply $validation->error('does_not_exist'), ['required'], 'right error'; +$validation = $t->app->validation->input( + {foo => [], bar => ['a'], baz => undef, yada => [undef]}); +ok !$validation->optional('foo')->is_valid, 'not valid'; +is_deeply $validation->output, {}, 'right result'; +ok !$validation->has_error, 'no error'; +ok !$validation->optional('baz')->is_valid, 'not valid'; +is_deeply $validation->output, {}, 'right result'; +ok !$validation->has_error, 'no error'; +ok !$validation->optional('yada')->is_valid, 'not valid'; +is_deeply $validation->output, {}, 'right result'; +ok !$validation->has_error, 'no error'; +ok $validation->optional('bar')->is_valid, 'valid'; +is_deeply $validation->output, {bar => ['a']}, 'right result'; +ok !$validation->in('c')->is_valid, 'not valid'; +is_deeply $validation->output, {}, 'right result'; +ok $validation->has_error, 'has error'; # Equal to $validation @@ -168,11 +184,13 @@ ok !$validation->optional('missing', 'trim')->is_valid, 'not valid'; ok $validation->optional('baz', 'trim')->like(qr/^\d$/)->is_valid, 'valid'; is_deeply $validation->output, {foo => 'bar', baz => [0, 1]}, 'right result'; -$validation = $t->app->validation->input({nothing => ' '}); +$validation = $t->app->validation->input({nothing => ' ', more => [undef]}); ok !$validation->required('nothing', 'trim')->is_valid, 'not valid'; is_deeply $validation->output, {}, 'right result'; ok $validation->required('nothing')->is_valid, 'valid'; is_deeply $validation->output, {nothing => ' '}, 'right result'; +ok !$validation->optional('more', 'trim')->is_valid, 'not valid'; +is_deeply $validation->output, {nothing => ' '}, 'right result'; # Custom filter $t->app->validator->add_filter(quote => sub {qq{$_[1]="$_[2]"}}); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.55/t/pod_coverage.t new/Mojolicious-6.58/t/pod_coverage.t --- old/Mojolicious-6.55/t/pod_coverage.t 2016-03-08 10:44:20.000000000 +0100 +++ new/Mojolicious-6.58/t/pod_coverage.t 2016-04-10 19:08:14.000000000 +0200 @@ -13,9 +13,7 @@ 'Mojo::Server::Daemon' => {also_private => ['multi_accept']}, 'Mojo::Server::Morbo' => {also_private => ['check']}, 'Mojo::Template' => {also_private => ['build', 'compile', 'interpret']}, - 'Mojo::Transaction::WebSocket' => - {also_private => [qw(build_frame parse_frame)]}, - 'Mojo::Util' => {also_private => ['xss_escape']} + 'Mojo::Util' => {also_private => ['xss_escape']} ); pod_coverage_ok($_, $RULES{$_} || {}) for all_modules();