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 2015-08-01 11:34:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2015-06-23 11:59:40.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2015-08-01 11:34:14.000000000 +0200 @@ -1,0 +2,22 @@ +Tue Jul 14 08:56:09 UTC 2015 - coolo@suse.com + +- updated to 6.14 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 6.14 2015-07-12 + - Improved app generator command not to create a log directory. + +------------------------------------------------------------------- +Sun Jul 12 08:44:16 UTC 2015 - coolo@suse.com + +- updated to 6.13 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 6.13 2015-07-08 + - Added support for validating file uploads. + - Added upload check to Mojolicious::Validator. + - Improved error messages for broken applications in Mojo::Server. (mst) + - Improved subscribers method in Mojo::EventEmitter to allow subscribers to be + modified more easily. + +------------------------------------------------------------------- Old: ---- Mojolicious-6.12.tar.gz New: ---- Mojolicious-6.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.38vbaH/_old 2015-08-01 11:34:15.000000000 +0200 +++ /var/tmp/diff_new_pack.38vbaH/_new 2015-08-01 11:34:15.000000000 +0200 @@ -17,14 +17,14 @@ Name: perl-Mojolicious -Version: 6.12 +Version: 6.14 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/D/DB/DBOOK/%{cpan_name}-%{version}.tar.gz +Source0: http://www.cpan.org/authors/id/S/SR/SRI/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ Mojolicious-6.12.tar.gz -> Mojolicious-6.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/Changes new/Mojolicious-6.14/Changes --- old/Mojolicious-6.12/Changes 2015-06-18 23:42:06.000000000 +0200 +++ new/Mojolicious-6.14/Changes 2015-07-12 17:31:04.000000000 +0200 @@ -1,4 +1,14 @@ +6.14 2015-07-12 + - Improved app generator command not to create a log directory. + +6.13 2015-07-08 + - Added support for validating file uploads. + - Added upload check to Mojolicious::Validator. + - Improved error messages for broken applications in Mojo::Server. (mst) + - Improved subscribers method in Mojo::EventEmitter to allow subscribers to be + modified more easily. + 6.12 2015-06-18 - Welcome to the Mojolicious core team Dan Book. - Added TO_JSON method to Mojo::Collection. (wttw) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/META.json new/Mojolicious-6.14/META.json --- old/Mojolicious-6.12/META.json 2015-06-18 23:44:58.000000000 +0200 +++ new/Mojolicious-6.14/META.json 2015-07-14 05:25:00.000000000 +0200 @@ -4,7 +4,7 @@ "Sebastian Riedel <sri@cpan.org>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001", + "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005", "license" : [ "artistic_2" ], @@ -17,6 +17,7 @@ "directory" : [ "t", "inc", + "examples", "t" ] }, @@ -54,5 +55,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "6.12" + "version" : "6.14", + "x_serialization_backend" : "JSON::PP version 2.27300" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/META.yml new/Mojolicious-6.14/META.yml --- old/Mojolicious-6.12/META.yml 2015-06-18 23:44:58.000000000 +0200 +++ new/Mojolicious-6.14/META.yml 2015-07-14 05:24:59.000000000 +0200 @@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001' +generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -17,6 +17,7 @@ directory: - t - inc + - examples - t requires: IO::Socket::IP: '0.26' @@ -29,4 +30,5 @@ homepage: http://mojolicio.us license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/mojo.git -version: '6.12' +version: '6.14' +x_serialization_backend: 'CPAN::Meta::YAML version 0.016' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/Makefile.PL new/Mojolicious-6.14/Makefile.PL --- old/Mojolicious-6.12/Makefile.PL 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/Makefile.PL 2015-06-30 20:02:38.000000000 +0200 @@ -23,7 +23,7 @@ repository => 'https://github.com/kraih/mojo.git', x_IRC => 'irc://irc.perl.org/#mojo' }, - no_index => {directory => ['t']} + no_index => {directory => ['examples', 't']} }, PREREQ_PM => { 'IO::Socket::IP' => '0.26', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Asset/File.pm new/Mojolicious-6.14/lib/Mojo/Asset/File.pm --- old/Mojolicious-6.12/lib/Mojo/Asset/File.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Asset/File.pm 2015-06-30 20:02:38.000000000 +0200 @@ -221,7 +221,7 @@ =head2 is_file - my $true = $file->is_file; + my $bool = $file->is_file; True, this is a L<Mojo::Asset::File> object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Asset.pm new/Mojolicious-6.14/lib/Mojo/Asset.pm --- old/Mojolicious-6.12/lib/Mojo/Asset.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Asset.pm 2015-06-30 20:02:38.000000000 +0200 @@ -95,7 +95,7 @@ =head2 is_file - my $false = $asset->is_file; + my $bool = $asset->is_file; False, this is not a L<Mojo::Asset::File> object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Content/MultiPart.pm new/Mojolicious-6.14/lib/Mojo/Content/MultiPart.pm --- old/Mojolicious-6.12/lib/Mojo/Content/MultiPart.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Content/MultiPart.pm 2015-06-30 20:02:38.000000000 +0200 @@ -284,7 +284,7 @@ =head2 is_multipart - my $true = $multi->is_multipart; + my $bool = $multi->is_multipart; True, this is a L<Mojo::Content::MultiPart> object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Content.pm new/Mojolicious-6.14/lib/Mojo/Content.pm --- old/Mojolicious-6.12/lib/Mojo/Content.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Content.pm 2015-06-30 20:02:38.000000000 +0200 @@ -536,7 +536,7 @@ =head2 is_multipart - my $false = $content->is_multipart; + my $bool = $content->is_multipart; False, this is not a L<Mojo::Content::MultiPart> object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/DOM.pm new/Mojolicious-6.14/lib/Mojo/DOM.pm --- old/Mojolicious-6.12/lib/Mojo/DOM.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/DOM.pm 2015-07-03 15:34:12.000000000 +0200 @@ -573,6 +573,11 @@ ->descendant_nodes->grep(sub { $_->type eq 'comment' }) ->map('remove')->first; + # "<p><b>test</b>test</p>" + $dom->parse('<p><b>123</b>456</p>') + ->at('p')->descendant_nodes->grep(sub { $_->type eq 'text' }) + ->map(content => 'test')->first->root; + =head2 find my $collection = $dom->find('div ~ p'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/EventEmitter.pm new/Mojolicious-6.14/lib/Mojo/EventEmitter.pm --- old/Mojolicious-6.12/lib/Mojo/EventEmitter.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/EventEmitter.pm 2015-06-30 20:02:38.000000000 +0200 @@ -41,7 +41,7 @@ return $wrapper; } -sub subscribers { shift->{events}{shift()} || [] } +sub subscribers { shift->{events}{shift()} ||= [] } sub unsubscribe { my ($self, $name, $cb) = @_; @@ -168,6 +168,9 @@ # Unsubscribe last subscriber $e->unsubscribe(foo => $e->subscribers('foo')->[-1]); + # Change order of subscribers + @{$e->subscribers('foo')} = reverse @{$e->subscribers('foo')}; + =head2 unsubscribe $e = $e->unsubscribe('foo'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Message.pm new/Mojolicious-6.14/lib/Mojo/Message.pm --- old/Mojolicious-6.12/lib/Mojo/Message.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Message.pm 2015-07-08 03:34:36.000000000 +0200 @@ -59,7 +59,7 @@ sub build_headers { shift->_build('get_header_chunk') } sub build_start_line { shift->_build('get_start_line_chunk') } -sub cookie { shift->_cache('cookie', 0, @_) } +sub cookie { shift->_cache('cookies', 0, @_) } sub cookies { croak 'Method "cookies" not implemented by subclass' } @@ -77,8 +77,8 @@ return $self->finish; } -sub every_cookie { shift->_cache('cookie', 1, @_) } -sub every_upload { shift->_cache('upload', 1, @_) } +sub every_cookie { shift->_cache('cookies', 1, @_) } +sub every_upload { shift->_cache('uploads', 1, @_) } sub extract_start_line { croak 'Method "extract_start_line" not implemented by subclass'; @@ -197,7 +197,7 @@ return $self->build_start_line . $self->build_headers . $self->build_body; } -sub upload { shift->_cache('upload', 0, @_) } +sub upload { shift->_cache('uploads', 0, @_) } sub uploads { my $self = shift; @@ -239,7 +239,6 @@ my ($self, $method, $all, $name) = @_; # Cache objects by name - $method .= 's'; unless ($self->{$method}) { $self->{$method} = {}; push @{$self->{$method}{$_->name}}, $_ for @{$self->$method}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Parameters.pm new/Mojolicious-6.14/lib/Mojo/Parameters.pm --- old/Mojolicious-6.12/lib/Mojo/Parameters.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Parameters.pm 2015-06-30 20:02:38.000000000 +0200 @@ -306,6 +306,9 @@ Parsed parameter pairs. Note that this method will normalize the parameters. + # Remove all parameters + $params->pairs([]); + =head2 param my $value = $params->param('foo'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Server/Prefork.pm new/Mojolicious-6.14/lib/Mojo/Server/Prefork.pm --- old/Mojolicious-6.12/lib/Mojo/Server/Prefork.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Server/Prefork.pm 2015-07-08 17:12:26.000000000 +0200 @@ -413,7 +413,8 @@ my $file = $prefork->pid_file; $prefork = $prefork->pid_file('/tmp/prefork.pid'); -Full path of process id file, defaults to a random temporary path. +Full path of process id file, defaults to C<prefork.pid> in a temporary +directory. =head2 workers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Server.pm new/Mojolicious-6.14/lib/Mojo/Server.pm --- old/Mojolicious-6.12/lib/Mojo/Server.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Server.pm 2015-07-05 22:07:50.000000000 +0200 @@ -50,9 +50,10 @@ local $ENV{MOJO_EXE}; # Try to load application from script into sandbox - my $app = eval "package Mojo::Server::Sandbox::@{[md5_sum $path]};" - . 'return do($path) || die($@ || $!);'; - die qq{Can't load application from file "$path": $@} if !$app && $@; + delete $INC{$path}; + my $app = eval + "package Mojo::Server::Sandbox::@{[md5_sum $path]}; require \$path"; + die qq{Can't load application from file "$path": $@} if $@; die qq{File "$path" did not return an application object.\n} unless blessed $app && $app->isa('Mojo'); $self->app($app); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Transaction/WebSocket.pm new/Mojolicious-6.14/lib/Mojo/Transaction/WebSocket.pm --- old/Mojolicious-6.12/lib/Mojo/Transaction/WebSocket.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Transaction/WebSocket.pm 2015-06-30 20:02:38.000000000 +0200 @@ -584,7 +584,7 @@ =head2 is_websocket - my $true = $ws->is_websocket; + my $bool = $ws->is_websocket; True, this is a L<Mojo::Transaction::WebSocket> object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Transaction.pm new/Mojolicious-6.14/lib/Mojo/Transaction.pm --- old/Mojolicious-6.12/lib/Mojo/Transaction.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Transaction.pm 2015-06-30 20:02:38.000000000 +0200 @@ -235,7 +235,7 @@ =head2 is_websocket - my $false = $tx->is_websocket; + my $bool = $tx->is_websocket; False, this is not a L<Mojo::Transaction::WebSocket> object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojo/Util.pm new/Mojolicious-6.14/lib/Mojo/Util.pm --- old/Mojolicious-6.12/lib/Mojo/Util.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojo/Util.pm 2015-06-30 20:02:38.000000000 +0200 @@ -175,8 +175,8 @@ my @input = map {ord} split '', $output; my @chars = sort grep { $_ >= PC_INITIAL_N } @input; $output =~ s/[^\x00-\x7f]+//gs; - my $h = my $b = length $output; - $output .= "\x2d" if $b > 0; + my $h = my $basic = length $output; + $output .= "\x2d" if $basic > 0; for my $m (@chars) { next if $m < $n; @@ -201,7 +201,7 @@ } $output .= chr $q + ($q < 26 ? 0x61 : 0x30 - 26); - $bias = _adapt($delta, $h + 1, $h == $b); + $bias = _adapt($delta, $h + 1, $h == $basic); $delta = 0; $h++; } @@ -221,10 +221,10 @@ } sub secure_compare { - my ($a, $b) = @_; - return undef if length $a != length $b; + my ($one, $two) = @_; + return undef if length $one != length $two; my $r = 0; - $r |= ord(substr $a, $_) ^ ord(substr $b, $_) for 0 .. length($a) - 1; + $r |= ord(substr $one, $_) ^ ord(substr $two, $_) for 0 .. length($one) - 1; return $r == 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Command/generate/app.pm new/Mojolicious-6.14/lib/Mojolicious/Command/generate/app.pm --- old/Mojolicious-6.12/lib/Mojolicious/Command/generate/app.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Command/generate/app.pm 2015-07-11 20:01:34.000000000 +0200 @@ -33,9 +33,6 @@ # Test $self->render_to_rel_file('test', "$name/t/basic.t", $class); - # Log directory - $self->create_rel_dir("$name/log"); - # Static file $self->render_to_rel_file('static', "$name/public/index.html"); @@ -195,4 +192,6 @@ This page was generated from the template "templates/example/welcome.html.ep" and the layout "templates/layouts/default.html.ep", <%%= link_to 'click here' => url_for %> to reload the page or -<%%= link_to 'here' => '/index.html' %> to move forward to a static page. +<%%= link_to 'here' => '/index.html' %> to move forward to a static page. To +learn more, you can also browse through the documentation +<%%= link_to 'here' => '/perldoc' %>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Command/generate/lite_app.pm new/Mojolicious-6.14/lib/Mojolicious/Command/generate/lite_app.pm --- old/Mojolicious-6.12/lib/Mojolicious/Command/generate/lite_app.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Command/generate/lite_app.pm 2015-06-30 20:02:38.000000000 +0200 @@ -90,7 +90,9 @@ <% %>@@ index.html.ep %% layout 'default'; %% title 'Welcome'; -Welcome to the Mojolicious real-time web framework! +<h1>Welcome to the Mojolicious real-time web framework!</h1> +To learn more, you can browse through the documentation +<%%= link_to 'here' => '/perldoc' %>. <% %>@@ layouts/default.html.ep <!DOCTYPE html> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Command/prefork.pm new/Mojolicious-6.14/lib/Mojolicious/Command/prefork.pm --- old/Mojolicious-6.12/lib/Mojolicious/Command/prefork.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Command/prefork.pm 2015-07-08 17:13:49.000000000 +0200 @@ -65,8 +65,8 @@ MOJO_LISTEN or "http://*:3000" -M, --multi-accept <number> Number of connections to accept at once, defaults to 50 - -P, --pid-file <path> Path to process id file, defaults to a - random file + -P, --pid-file <path> Path to process id file, defaults to + "prefork.pid" in a temporary diretory -p, --proxy Activate reverse proxy support, defaults to the value of MOJO_REVERSE_PROXY diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Controller.pm new/Mojolicious-6.14/lib/Mojolicious/Controller.pm --- old/Mojolicious-6.12/lib/Mojolicious/Controller.pm 2015-06-18 23:27:54.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Controller.pm 2015-07-08 03:37:12.000000000 +0200 @@ -341,6 +341,7 @@ my $header = $req->headers->header('X-CSRF-Token'); my $hash = $req->params->to_hash; $hash->{csrf_token} //= $header if $token && $header; + $hash->{$_} = $req->every_upload($_) for map { $_->name } @{$req->uploads}; my $validation = $self->app->validator->validation->input($hash); return $stash->{'mojo.validation'} = $validation->csrf_token($token); } @@ -916,16 +917,22 @@ my $validation = $c->validation; Get L<Mojolicious::Validator::Validation> object for current request to -validate C<GET> and C<POST> parameters extracted from the query string and -C<application/x-www-form-urlencoded> or C<multipart/form-data> message body. -Parts of the request body need to be loaded into memory to parse C<POST> -parameters, so you have to make sure it is not excessively large, there's a -16MB limit by default. +validate file uploads as well as C<GET> and C<POST> parameters extracted from +the query string and C<application/x-www-form-urlencoded> or +C<multipart/form-data> message body. Parts of the request body need to be loaded +into memory to parse C<POST> parameters, so you have to make sure it is not +excessively large, there's a 16MB limit by default. + # Validate GET/POST parameter my $validation = $c->validation; $validation->required('title')->size(3, 50); my $title = $validation->param('title'); + # Validate file upload + my $validation = $c->validation; + $validation->required('tarball')->upload->size(1, 1048576); + my $tarball = $validation->param('tarball'); + =head2 write $c = $c->write; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Guides/Contributing.pod new/Mojolicious-6.14/lib/Mojolicious/Guides/Contributing.pod --- old/Mojolicious-6.12/lib/Mojolicious/Guides/Contributing.pod 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Guides/Contributing.pod 2015-07-08 17:49:15.000000000 +0200 @@ -30,7 +30,9 @@ fixed. ;) And don't forget to add a descriptive title and text when you create a new -issue. +issue. If your issue does not contain enough information, it might get closed +pretty quickly, but don't be disheartened, if there's new activity it will get +reopened just as quickly. =head2 Reporting security issues @@ -129,8 +131,8 @@ Features may only be changed in a major release, to fix a serious security issue, or after being deprecated for at least 3 months. -Refactoring and deprecations should be avoided if no important feature depends -on it. +Refactoring and deprecations should be avoided if there are no substantial +benefits. New features can be marked as experimental to be excluded from deprecation policies. @@ -167,9 +169,7 @@ No names outside of C<Mojolicious.pm>. -No Elitism. - -Peace! +Be nice to each other. =back diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Guides/Cookbook.pod new/Mojolicious-6.14/lib/Mojolicious/Guides/Cookbook.pod --- old/Mojolicious-6.12/lib/Mojolicious/Guides/Cookbook.pod 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Guides/Cookbook.pod 2015-07-12 17:29:26.000000000 +0200 @@ -613,12 +613,14 @@ var ws = new WebSocket('<%= url_for('echo')->to_abs %>'); // Incoming messages - ws.onmessage = function(event) { + ws.onmessage = function (event) { document.body.innerHTML += event.data + '<br/>'; }; // Outgoing messages - window.setInterval(function () { ws.send('Hello Mojo!') }, 1000); + ws.onopen = function (event) { + window.setInterval(function () { ws.send('Hello Mojo!') }, 1000); + }; </script> </body> </html> @@ -712,7 +714,7 @@ var events = new EventSource('<%= url_for 'events' %>'); // Subscribe to "log" event - events.addEventListener('log', function(event) { + events.addEventListener('log', function (event) { document.body.innerHTML += event.data + '<br/>'; }, false); </script> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/Charset.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/Charset.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/Charset.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/Charset.pm 2015-07-02 05:08:13.000000000 +0200 @@ -22,7 +22,7 @@ =head1 SYNOPSIS # Mojolicious - $self->plugin(Charset => {charset => 'Shift_JIS'}); + $app->plugin(Charset => {charset => 'Shift_JIS'}); # Mojolicious::Lite plugin Charset => {charset => 'Shift_JIS'}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/Config.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/Config.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/Config.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/Config.pm 2015-07-05 20:32:02.000000000 +0200 @@ -17,7 +17,7 @@ my $config = eval 'package Mojolicious::Plugin::Config::Sandbox; no warnings;' . "sub app; local *app = sub { \$app }; use Mojo::Base -strict; $content"; - die qq{Can't load configuration from file "$file": $@} if !$config && $@; + die qq{Can't load configuration from file "$file": $@} if $@; die qq{Configuration file "$file" did not return a hash reference.\n} unless ref $config eq 'HASH'; @@ -77,7 +77,7 @@ }; # Mojolicious - my $config = $self->plugin('Config'); + my $config = $app->plugin('Config'); say $config->{foo}; # Mojolicious::Lite diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/DefaultHelpers.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/DefaultHelpers.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/DefaultHelpers.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/DefaultHelpers.pm 2015-07-02 05:08:38.000000000 +0200 @@ -162,7 +162,7 @@ =head1 SYNOPSIS # Mojolicious - $self->plugin('DefaultHelpers'); + $app->plugin('DefaultHelpers'); # Mojolicious::Lite plugin 'DefaultHelpers'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/EPLRenderer.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/EPLRenderer.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/EPLRenderer.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/EPLRenderer.pm 2015-07-02 05:08:49.000000000 +0200 @@ -66,7 +66,7 @@ =head1 SYNOPSIS # Mojolicious - $self->plugin('EPLRenderer'); + $app->plugin('EPLRenderer'); # Mojolicious::Lite plugin 'EPLRenderer'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/EPRenderer.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/EPRenderer.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/EPRenderer.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/EPRenderer.pm 2015-07-02 05:08:58.000000000 +0200 @@ -71,9 +71,9 @@ =head1 SYNOPSIS # Mojolicious - $self->plugin('EPRenderer'); - $self->plugin(EPRenderer => {name => 'foo'}); - $self->plugin(EPRenderer => {template => {line_start => '.'}}); + $app->plugin('EPRenderer'); + $app->plugin(EPRenderer => {name => 'foo'}); + $app->plugin(EPRenderer => {template => {line_start => '.'}}); # Mojolicious::Lite plugin 'EPRenderer'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/HeaderCondition.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/HeaderCondition.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/HeaderCondition.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/HeaderCondition.pm 2015-07-02 05:09:21.000000000 +0200 @@ -40,8 +40,8 @@ =head1 SYNOPSIS # Mojolicious - $self->plugin('HeaderCondition'); - $self->routes->get('/:controller/:action') + $app->plugin('HeaderCondition'); + $app->routes->get('/:controller/:action') ->over(headers => {Referer => qr/example\.com/}); # Mojolicious::Lite @@ -49,7 +49,7 @@ get '/' => (headers => {Referer => qr/example\.com/}) => sub {...}; # All headers need to match - $self->routes->get('/:controller/:action')->over(headers => { + $app->routes->get('/:controller/:action')->over(headers => { 'X-Secret-Header' => 'Foo', Referer => qr/example\.com/ }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/JSONConfig.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/JSONConfig.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/JSONConfig.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/JSONConfig.pm 2015-07-05 20:32:48.000000000 +0200 @@ -8,7 +8,7 @@ my ($self, $content, $file, $conf, $app) = @_; my $config = eval { from_json $self->render($content, $file, $conf, $app) }; - die qq{Can't parse config "$file": $@} if !$config && $@; + die qq{Can't parse config "$file": $@} if $@; die qq{Invalid config "$file"} unless ref $config eq 'HASH'; return $config; @@ -52,7 +52,7 @@ } # Mojolicious - my $config = $self->plugin('JSONConfig'); + my $config = $app->plugin('JSONConfig'); say $config->{foo}; # Mojolicious::Lite diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/Mount.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/Mount.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/Mount.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/Mount.pm 2015-07-02 05:09:43.000000000 +0200 @@ -31,7 +31,7 @@ =head1 SYNOPSIS # Mojolicious - my $route = $self->plugin(Mount => {'/prefix' => '/home/sri/myapp.pl'}); + my $route = $app->plugin(Mount => {'/prefix' => '/home/sri/myapp.pl'}); # Mojolicious::Lite my $route = plugin Mount => {'/prefix' => '/home/sri/myapp.pl'}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/PODRenderer.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/PODRenderer.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/PODRenderer.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/PODRenderer.pm 2015-07-02 05:09:56.000000000 +0200 @@ -119,9 +119,9 @@ =head1 SYNOPSIS # Mojolicious (with documentation browser under "/perldoc") - my $route = $self->plugin('PODRenderer'); - my $route = $self->plugin(PODRenderer => {name => 'foo'}); - my $route = $self->plugin(PODRenderer => {preprocess => 'epl'}); + my $route = $app->plugin('PODRenderer'); + my $route = $app->plugin(PODRenderer => {name => 'foo'}); + my $route = $app->plugin(PODRenderer => {preprocess => 'epl'}); # Mojolicious::Lite (with documentation browser under "/perldoc") my $route = plugin 'PODRenderer'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Plugin/TagHelpers.pm new/Mojolicious-6.14/lib/Mojolicious/Plugin/TagHelpers.pm --- old/Mojolicious-6.12/lib/Mojolicious/Plugin/TagHelpers.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Plugin/TagHelpers.pm 2015-07-02 05:10:07.000000000 +0200 @@ -16,17 +16,16 @@ my @helpers = ( qw(csrf_field form_for hidden_field javascript label_for link_to), - qw(password_field select_field stylesheet submit_button tag_with_error), - qw(text_area) + qw(select_field stylesheet submit_button tag_with_error text_area) ); $app->helper($_ => __PACKAGE__->can("_$_")) for @helpers; $app->helper(check_box => sub { _input(shift, shift, value => shift, @_, type => 'checkbox') }); - $app->helper(file_field => - sub { shift; _tag('input', name => shift, @_, type => 'file') }); + $app->helper(file_field => sub { _empty_field('file', @_) }); $app->helper(image => sub { _tag('img', src => shift->url_for(shift), @_) }); $app->helper(input_tag => sub { _input(@_) }); + $app->helper(password_field => sub { _empty_field('password', @_) }); $app->helper(radio_button => sub { _input(shift, shift, value => shift, @_, type => 'radio') }); @@ -39,6 +38,11 @@ return _hidden_field($c, csrf_token => $c->helpers->csrf_token, @_); } +sub _empty_field { + my ($type, $c, $name) = (shift, shift, shift); + return _validation($c, $name, 'input', name => $name, @_, type => $type); +} + sub _form_for { my ($c, @url) = (shift, shift); push @url, shift if ref $_[0] eq 'HASH'; @@ -119,12 +123,6 @@ return _tag('option', %attrs, @$pair[2 .. $#$pair], $pair->[0]); } -sub _password_field { - my ($c, $name) = (shift, shift); - return _validation($c, $name, 'input', name => $name, @_, - type => 'password'); -} - sub _select_field { my ($c, $name, $options, %attrs) = (shift, shift, shift, @_); @@ -215,7 +213,7 @@ =head1 SYNOPSIS # Mojolicious - $self->plugin('TagHelpers'); + $app->plugin('TagHelpers'); # Mojolicious::Lite plugin 'TagHelpers'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Renderer.pm new/Mojolicious-6.14/lib/Mojolicious/Renderer.pm --- old/Mojolicious-6.12/lib/Mojolicious/Renderer.pm 2015-06-18 23:27:54.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Renderer.pm 2015-07-06 20:33:41.000000000 +0200 @@ -291,8 +291,8 @@ Classes to use for finding templates in C<DATA> sections with L<Mojo::Loader>, first one has the highest precedence, defaults to C<main>. Only files with exactly two extensions will be used, like C<index.html.ep>. Note that these -classes need to have already been loaded during application startup for -templates to be detected. +classes need to have already been loaded and added during application startup +for templates to be detected. # Add another class with templates in DATA section push @{$renderer->classes}, 'Mojolicious::Plugin::Fun'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Static.pm new/Mojolicious-6.14/lib/Mojolicious/Static.pm --- old/Mojolicious-6.12/lib/Mojolicious/Static.pm 2015-06-18 23:27:54.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Static.pm 2015-07-06 20:32:08.000000000 +0200 @@ -178,8 +178,8 @@ Classes to use for finding files in C<DATA> sections with L<Mojo::Loader>, first one has the highest precedence, defaults to C<main>. Only files with exactly one extension will be used, like C<index.html>. Note that these classes -need to have already been loaded during application startup for files to be -detected. +need to have already been loaded and added during application startup for files +to be detected. # Add another class with static files in DATA section push @{$static->classes}, 'Mojolicious::Plugin::Fun'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Validator/Validation.pm new/Mojolicious-6.14/lib/Mojolicious/Validator/Validation.pm --- old/Mojolicious-6.12/lib/Mojolicious/Validator/Validation.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Validator/Validation.pm 2015-07-07 05:56:16.000000000 +0200 @@ -191,9 +191,9 @@ my $names = $validation->failed; -Return a list of all names for parameters that failed validation. +Return a list of all names for values that failed validation. - # Names of all parameters that failed + # Names of all values that failed say for @{$validation->failed}; =head2 has_data @@ -227,17 +227,16 @@ my $value = $validation->param('foo'); -Access validated parameters. If there are multiple values sharing the same -name, and you want to access more than just the last one, you can use -L</"every_param">. +Access validated values. If there are multiple values sharing the same name, and +you want to access more than just the last one, you can use L</"every_param">. =head2 passed my $names = $validation->passed; -Return a list of all names for parameters that passed validation. +Return a list of all names for values that passed validation. - # Names of all parameters that passed + # Names of all values that passed say for @{$validation->passed}; =head2 required diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/Validator.pm new/Mojolicious-6.14/lib/Mojolicious/Validator.pm --- old/Mojolicious-6.12/lib/Mojolicious/Validator.pm 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/Validator.pm 2015-07-08 03:41:25.000000000 +0200 @@ -4,7 +4,13 @@ use Mojolicious::Validator::Validation; has checks => sub { - {equal_to => \&_equal_to, in => \&_in, like => \&_like, size => \&_size}; + { + equal_to => \&_equal_to, + in => \&_in, + like => sub { $_[2] !~ $_[3] }, + size => \&_size, + upload => sub { !ref $_[2] || !$_[2]->isa('Mojo::Upload') } + }; }; sub add_check { $_[0]->checks->{$_[1]} = $_[2] and return $_[0] } @@ -25,11 +31,9 @@ return 1; } -sub _like { $_[2] !~ $_[3] } - sub _size { my ($validation, $name, $value, $min, $max) = @_; - my $len = length $value; + my $len = ref $value ? $value->size : length $value; return $len < $min || $len > $max; } @@ -39,7 +43,7 @@ =head1 NAME -Mojolicious::Validator - Validate parameter +Mojolicious::Validator - Validate values =head1 SYNOPSIS @@ -53,7 +57,7 @@ =head1 DESCRIPTION -L<Mojolicious::Validator> validates parameters for L<Mojolicious>. +L<Mojolicious::Validator> validates values for L<Mojolicious>. =head1 CHECKS @@ -61,27 +65,34 @@ =head2 equal_to - $validation->equal_to('foo'); + $validation = $validation->equal_to('foo'); -Value needs to be equal to the value of another field. +String value needs to be equal to the value of another field. =head2 in - $validation->in(qw(foo bar baz)); + $validation = $validation->in(qw(foo bar baz)); -Value needs to match one of the values in the list. +String value needs to match one of the values in the list. =head2 like - $validation->like(qr/^[A-Z]/); + $validation = $validation->like(qr/^[A-Z]/); -Value needs to match the regular expression. +String value needs to match the regular expression. =head2 size - $validation->size(2, 5); + $validation = $validation->size(2, 5); + +String value length or size of L<Mojo::Upload> object needs to be between these +two values. + +=head2 upload + + $validation = $validation->upload; -Value length in characters needs to be between these two values. +Value needs to be a L<Mojo::Upload> object, representing a file upload. =head1 ATTRIBUTES @@ -93,7 +104,7 @@ $validator = $validator->checks({size => sub {...}}); Registered validation checks, by default only L</"equal_to">, L</"in">, -L</"like"> and L</"size"> are already defined. +L</"like">, L</"size"> and L</"upload"> are already defined. =head1 METHODS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious/templates/mojobar.html.ep new/Mojolicious-6.14/lib/Mojolicious/templates/mojobar.html.ep --- old/Mojolicious-6.12/lib/Mojolicious/templates/mojobar.html.ep 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious/templates/mojobar.html.ep 2015-07-12 17:29:42.000000000 +0200 @@ -125,7 +125,7 @@ }); $(document).ready(function () { $('a[href^="#"]').addClass('mojoscroll'); - $(".mojoscroll").click(function(e) { + $(".mojoscroll").click(function (e) { e.preventDefault(); e.stopPropagation(); var hash = "#" + this.href.split("#")[1]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/lib/Mojolicious.pm new/Mojolicious-6.14/lib/Mojolicious.pm --- old/Mojolicious-6.12/lib/Mojolicious.pm 2015-06-18 23:27:54.000000000 +0200 +++ new/Mojolicious-6.14/lib/Mojolicious.pm 2015-07-09 02:50:05.000000000 +0200 @@ -43,7 +43,7 @@ has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Clinking Beer Mugs'; -our $VERSION = '6.12'; +our $VERSION = '6.14'; sub AUTOLOAD { my $self = shift; @@ -459,7 +459,7 @@ =head2 secrets my $secrets = $app->secrets; - $app = $app->secrets(['passw0rd']); + $app = $app->secrets([$bytes]); Secret passphrases used for signed cookies and the like, defaults to the L</"moniker"> of this application, which is not very secure, so you should @@ -516,7 +516,7 @@ my $validator = $app->validator; $app = $app->validator(Mojolicious::Validator->new); -Validate parameters, defaults to a L<Mojolicious::Validator> object. +Validate values, defaults to a L<Mojolicious::Validator> object. # Add validation check $app->validator->add_check(foo => sub { @@ -713,27 +713,27 @@ 6.0, C<Clinking Beer Mugs> (U+1F37B) -5.0, C<Tiger Face> (u1F42F) +5.0, C<Tiger Face> (U+1F42F) -4.0, C<Top Hat> (u1F3A9) +4.0, C<Top Hat> (U+1F3A9) -3.0, C<Rainbow> (u1F308) +3.0, C<Rainbow> (U+1F308) -2.0, C<Leaf Fluttering In Wind> (u1F343) +2.0, C<Leaf Fluttering In Wind> (U+1F343) -1.4, C<Smiling Face With Sunglasses> (u1F60E) +1.4, C<Smiling Face With Sunglasses> (U+1F60E) -1.3, C<Tropical Drink> (u1F379) +1.3, C<Tropical Drink> (U+1F379) -1.1, C<Smiling Cat Face With Heart-Shaped Eyes> (u1F63B) +1.1, C<Smiling Cat Face With Heart-Shaped Eyes> (U+1F63B) -1.0, C<Snowflake> (u2744) +1.0, C<Snowflake> (U+2744) -0.999930, C<Hot Beverage> (u2615) +0.999930, C<Hot Beverage> (U+2615) -0.999927, C<Comet> (u2604) +0.999927, C<Comet> (U+2604) -0.999920, C<Snowman> (u2603) +0.999920, C<Snowman> (U+2603) =head1 SPONSORS @@ -916,6 +916,8 @@ Marty Tennison +Matt S Trout + Matthew Lineen Maksym Komar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/t/mojo/daemon.t new/Mojolicious-6.14/t/mojo/daemon.t --- old/Mojolicious-6.12/t/mojo/daemon.t 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/t/mojo/daemon.t 2015-07-05 22:08:27.000000000 +0200 @@ -85,9 +85,11 @@ abs_path($path), 'right script name'); # Load broken app +my $bin = $FindBin::Bin; +eval { Mojo::Server::Daemon->new->load_app("$bin/lib/Mojo/LoaderTest/A.pm"); }; +like $@, qr/did not return an application object/, 'right error'; eval { - Mojo::Server::Daemon->new->load_app( - "$FindBin::Bin/lib/Mojo/LoaderException.pm"); + Mojo::Server::Daemon->new->load_app("$bin/lib/Mojo/LoaderException.pm"); }; like $@, qr/^Can't load application/, 'right error'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/t/mojo/eventemitter.t new/Mojolicious-6.14/t/mojo/eventemitter.t --- old/Mojolicious-6.12/t/mojo/eventemitter.t 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/t/mojo/eventemitter.t 2015-06-30 20:02:38.000000000 +0200 @@ -132,9 +132,21 @@ $e->emit('foo'); is $counter, 5, 'event was not emitted again'; -# Pass by reference and assignment to $_ +# Manipulate events $e = Mojo::EventEmitter->new; my $buffer = ''; +push @{$e->subscribers('foo')}, sub { $buffer .= 'one' }; +push @{$e->subscribers('foo')}, sub { $buffer .= 'two' }; +push @{$e->subscribers('foo')}, sub { $buffer .= 'three' }; +$e->emit('foo'); +is $buffer, 'onetwothree', 'right result'; +@{$e->subscribers('foo')} = reverse @{$e->subscribers('foo')}; +$e->emit('foo'); +is $buffer, 'onetwothreethreetwoone', 'right result'; + +# Pass by reference and assignment to $_ +$e = Mojo::EventEmitter->new; +$buffer = ''; $e->on(one => sub { $_ = $_[1] .= 'abc' . $_[2] }); $e->on(one => sub { $_[1] .= '123' . pop }); is $buffer, '', 'no result'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/t/mojo/parameters.t new/Mojolicious-6.14/t/mojo/parameters.t --- old/Mojolicious-6.12/t/mojo/parameters.t 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/t/mojo/parameters.t 2015-06-30 20:02:38.000000000 +0200 @@ -173,6 +173,7 @@ $params = Mojo::Parameters->new('a=1&b=2'); $params->pairs([a => 2, b => 3]); is $params->to_string, 'a=2&b=3', 'right result'; +is $params->pairs([])->to_string, '', 'right result'; # Query string $params = Mojo::Parameters->new('AZaz09-._~%!$&\'()*+,;=:@/?'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.12/t/mojolicious/validation_lite_app.t new/Mojolicious-6.14/t/mojolicious/validation_lite_app.t --- old/Mojolicious-6.12/t/mojolicious/validation_lite_app.t 2015-06-10 16:14:05.000000000 +0200 +++ new/Mojolicious-6.14/t/mojolicious/validation_lite_app.t 2015-07-08 03:43:57.000000000 +0200 @@ -3,6 +3,7 @@ BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' } use Test::More; +use Mojo::Upload; use Mojolicious::Lite; use Test::Mojo; @@ -21,6 +22,13 @@ $validation->optional('yada')->two; } => 'index'; +any '/upload' => sub { + my $c = shift; + my $validation = $c->validation; + return $c->render unless $validation->has_data; + $validation->required('foo')->upload; +}; + any '/forgery' => sub { my $c = shift; my $validation = $c->validation; @@ -115,6 +123,37 @@ ok $validation->has_error, 'has error'; is_deeply $validation->error('yada'), [qw(size 1 5 10)], 'right error'; +# Upload +$validation = $t->app->validation->input( + { + foo => Mojo::Upload->new, + bar => [Mojo::Upload->new, Mojo::Upload->new], + baz => [Mojo::Upload->new, 'test'] + } +); +ok $validation->required('foo')->upload->is_valid, 'valid'; +ok $validation->required('bar')->upload->is_valid, 'valid'; +ok $validation->required('baz')->is_valid, 'valid'; +ok !$validation->has_error, 'no error'; +ok !$validation->upload->is_valid, 'not valid'; +ok $validation->has_error, 'has error'; +is_deeply $validation->error('baz'), [qw(upload 1)], 'right error'; +is_deeply $validation->failed, ['baz'], 'right names'; + +# Upload size +$validation = $t->app->validation->input( + { + foo => [Mojo::Upload->new->tap(sub { $_->asset->add_chunk('valid') })], + bar => [Mojo::Upload->new->tap(sub { $_->asset->add_chunk('not valid') })] + } +); +ok $validation->required('foo')->upload->size(1, 6)->is_valid, 'valid'; +ok !$validation->has_error, 'no error'; +ok !$validation->required('bar')->upload->size(1, 6)->is_valid, 'not valid'; +ok $validation->has_error, 'has error'; +is_deeply $validation->error('bar'), [qw(size 1 1 6)], 'right error'; +is_deeply $validation->failed, ['bar'], 'right names'; + # Multiple empty values $validation = $t->app->validation; ok !$validation->has_data, 'no data'; @@ -195,6 +234,29 @@ ->element_count_is('.field-with-error', 2) ->element_count_is('.field-with-error', 2, 'with description'); +# Successful file upload +$t->post_ok( + '/upload' => form => {foo => {content => 'bar', filename => 'test.txt'}}) + ->element_exists_not('.field-with-error'); + +# Successful file upload (multiple files) +$t->post_ok( + '/upload' => form => { + foo => [ + {content => 'One', filename => 'one.txt'}, + {content => 'Two', filename => 'two.txt'} + ] + } +)->element_exists_not('.field-with-error'); + +# Failed file upload +$t->post_ok('/upload' => form => {foo => 'bar'}) + ->element_exists('.field-with-error'); + +# Failed file upload (multiple files) +$t->post_ok('/upload' => form => {foo => ['one', 'two']}) + ->element_exists('.field-with-error'); + # Missing CSRF token $t->get_ok('/forgery' => form => {foo => 'bar'})->status_is(200) ->content_like(qr/Wrong or missing CSRF token!/) @@ -268,6 +330,12 @@ %= password_field 'yada' % end +@@ upload.html.ep +%= form_for upload => begin + %= file_field 'foo' + %= submit_button +% end + @@ forgery.html.ep %= form_for forgery => begin %= 'Wrong or missing CSRF token!' if validation->has_error('csrf_token')
participants (1)
-
root@hilbert.suse.de