Hello community, here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2017-01-25 22:38:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes 2017-01-23 11:29:29.541069391 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2017-01-25 22:38:14.827270169 +0100 @@ -1,0 +2,10 @@ +Mon Jan 23 06:05:57 UTC 2017 - [email protected] + +- updated to 7.21 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 7.21 2017-01-21 + - Added extract_usage function to Mojo::Util. + - Improve getopt function in Mojo::Util to use @ARGV by default. + +------------------------------------------------------------------- Old: ---- Mojolicious-7.20.tar.gz New: ---- Mojolicious-7.21.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.NgPBib/_old 2017-01-25 22:38:15.463174066 +0100 +++ /var/tmp/diff_new_pack.NgPBib/_new 2017-01-25 22:38:15.467173462 +0100 @@ -17,7 +17,7 @@ Name: perl-Mojolicious -Version: 7.20 +Version: 7.21 Release: 0 %define cpan_name Mojolicious Summary: Real-time web framework ++++++ Mojolicious-7.20.tar.gz -> Mojolicious-7.21.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/Changes new/Mojolicious-7.21/Changes --- old/Mojolicious-7.20/Changes 2017-01-18 10:29:58.000000000 +0100 +++ new/Mojolicious-7.21/Changes 2017-01-21 13:36:10.000000000 +0100 @@ -1,4 +1,8 @@ +7.21 2017-01-21 + - Added extract_usage function to Mojo::Util. + - Improve getopt function in Mojo::Util to use @ARGV by default. + 7.20 2017-01-18 - Fixed a bug in Mojo::File where the make_path method would die even if no error occurred. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/META.json new/Mojolicious-7.21/META.json --- old/Mojolicious-7.20/META.json 2017-01-18 10:37:29.000000000 +0100 +++ new/Mojolicious-7.21/META.json 2017-01-22 15:28:30.000000000 +0100 @@ -58,6 +58,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "7.20", + "version" : "7.21", "x_serialization_backend" : "JSON::PP version 2.27400" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/META.yml new/Mojolicious-7.21/META.yml --- old/Mojolicious-7.20/META.yml 2017-01-18 10:37:29.000000000 +0100 +++ new/Mojolicious-7.21/META.yml 2017-01-22 15:28:30.000000000 +0100 @@ -31,5 +31,5 @@ homepage: http://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/mojo.git -version: '7.20' +version: '7.21' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/lib/Mojo/Template.pm new/Mojolicious-7.21/lib/Mojo/Template.pm --- old/Mojolicious-7.20/lib/Mojo/Template.pm 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.21/lib/Mojo/Template.pm 2017-01-20 21:25:34.000000000 +0100 @@ -374,6 +374,12 @@ in multiple\\ lines +A newline character gets appended automatically to every template, unless the +last character is a backslash. And empty lines at the end of a template are +ignored. + + There is <%= 1 + 1 %> no newline at the end here\ + You can capture whole template blocks for reuse later with the C<begin> and C<end> keywords. Just be aware that both keywords are part of the surrounding tag and not actual Perl code, so there can only be whitespace after C<begin> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/lib/Mojo/Util.pm new/Mojolicious-7.21/lib/Mojo/Util.pm --- old/Mojolicious-7.20/lib/Mojo/Util.pm 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.21/lib/Mojo/Util.pm 2017-01-19 21:14:59.000000000 +0100 @@ -11,6 +11,7 @@ use IO::Poll qw(POLLIN POLLPRI); use List::Util 'min'; use MIME::Base64 qw(decode_base64 encode_base64); +use Pod::Usage 'pod2usage'; use Symbol 'delete_package'; use Time::HiRes (); @@ -55,11 +56,11 @@ our @EXPORT_OK = ( qw(b64_decode b64_encode camelize class_to_file class_to_path decamelize), - qw(decode deprecated dumper encode getopt hmac_sha1_sum html_unescape), - qw(md5_bytes md5_sum monkey_patch punycode_decode punycode_encode quote), - qw(secure_compare sha1_bytes sha1_sum split_cookie_header split_header), - qw(steady_time tablify term_escape trim unindent unquote url_escape), - qw(url_unescape xml_escape xor_encode) + qw(decode deprecated dumper encode extract_usage getopt hmac_sha1_sum), + qw(html_unescape md5_bytes md5_sum monkey_patch punycode_decode), + qw(punycode_encode quote secure_compare sha1_bytes sha1_sum), + qw(split_cookie_header split_header steady_time tablify term_escape trim), + qw(unindent unquote url_escape url_unescape xml_escape xor_encode) ); # DEPRECATED! @@ -127,6 +128,17 @@ sub encode { _encoding($_[0])->encode("$_[1]") } +sub extract_usage { + my $file = @_ ? "$_[0]" : (caller)[1]; + + open my $handle, '>', \my $output; + pod2usage -exitval => 'noexit', -input => $file, -output => $handle; + $output =~ s/^.*\n|\n$//; + $output =~ s/\n$//; + + return unindent($output); +} + # DEPRECATED! sub files { deprecated @@ -136,10 +148,10 @@ } sub getopt { - my $opts = ref $_[1] eq 'ARRAY' ? splice @_, 1, 1 : []; + my ($array, $opts) = map { ref $_[0] eq 'ARRAY' ? shift : $_ } \@ARGV, []; my $save = Getopt::Long::Configure(qw(default no_auto_abbrev no_ignore_case), @$opts); - GetOptionsFromArray @_; + GetOptionsFromArray $array, @_; Getopt::Long::Configure($save); } @@ -570,8 +582,29 @@ Encode characters to bytes. +=head2 extract_usage + + my $usage = extract_usage; + my $usage = extract_usage '/home/sri/foo.pod'; + +Extract usage message from the SYNOPSIS section of a file containing POD +documentation, defaults to using the file this function was called from. + + # "Usage: APPLICATION test [OPTIONS]\n" + extract_usage; + + =head1 SYNOPSIS + + Usage: APPLICATION test [OPTIONS] + + =cut + =head2 getopt + getopt + 'H|headers=s' => \my @headers, + 't|timeout=i' => \my $timeout, + 'v|verbose' => \my $verbose; getopt $array, 'H|headers=s' => \my @headers, 't|timeout=i' => \my $timeout, @@ -582,8 +615,8 @@ 'v|verbose' => \my $verbose; Extract options from an array reference with L<Getopt::Long>, but without -changing its global configuration. The configuration options C<no_auto_abbrev> -and C<no_ignore_case> are enabled by default. +changing its global configuration, defaults to using C<@ARGV>. The configuration +options C<no_auto_abbrev> and C<no_ignore_case> are enabled by default. # Extract "charset" option getopt ['--charset', 'UTF-8'], 'charset=s' => \my $charset; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/lib/Mojolicious/Command.pm new/Mojolicious-7.21/lib/Mojolicious/Command.pm --- old/Mojolicious-7.20/lib/Mojolicious/Command.pm 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.21/lib/Mojolicious/Command.pm 2017-01-19 18:47:41.000000000 +0100 @@ -6,8 +6,7 @@ use Mojo::Loader 'data_section'; use Mojo::Server; use Mojo::Template; -use Mojo::Util qw(deprecated unindent); -use Pod::Usage 'pod2usage'; +use Mojo::Util 'deprecated'; has app => sub { Mojo::Server->new->build_app('Mojo::HelloWorld') }; has description => 'No description'; @@ -31,16 +30,7 @@ sub create_rel_dir { $_[0]->create_dir($_[0]->rel_file($_[1])) } -sub extract_usage { - my $self = shift; - - open my $handle, '>', \my $output; - pod2usage -exitval => 'noexit', -input => (caller)[1], -output => $handle; - $output =~ s/^.*\n//; - $output =~ s/\n$//; - - return unindent $output; -} +sub extract_usage { Mojo::Util::extract_usage((caller)[1]) } sub help { print shift->usage } @@ -104,13 +94,8 @@ # Short description has description => 'My first Mojo command'; - # Short usage message - has usage => <<EOF; - Usage: APPLICATION mycommand [OPTIONS] - - Options: - -s, --something Does something - EOF + # Usage message from SYNOPSIS + has usage => sub { shift->extract_usage }; sub run { my ($self, @args) = @_; @@ -118,6 +103,17 @@ # Magic here! :) } + 1; + + =head1 SYNOPSIS + + Usage: APPLICATION mycommand [OPTIONS] + + Options: + -s, --something Does something + + =cut + =head1 DESCRIPTION L<Mojolicious::Command> is an abstract base class for L<Mojolicious> commands. @@ -194,7 +190,7 @@ my $usage = $command->extract_usage; Extract usage message from the SYNOPSIS section of the file this method was -called from. +called from with L<Mojo::Util/"extract_usage">. =head2 help diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/lib/Mojolicious/Guides/Rendering.pod new/Mojolicious-7.21/lib/Mojolicious/Guides/Rendering.pod --- old/Mojolicious-7.20/lib/Mojolicious/Guides/Rendering.pod 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.21/lib/Mojolicious/Guides/Rendering.pod 2017-01-20 21:17:54.000000000 +0100 @@ -145,6 +145,12 @@ in multiple\\ lines +A newline character gets appended automatically to every template, unless the +last character is a backslash. And empty lines at the end of a template are +ignored. + + There is <%= 1 + 1 %> no newline at the end here\ + At the beginning of the template, stash values that don't have invalid characters in their name get automatically initialized as normal variables, and the controller object as both C<$self> and C<$c>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/lib/Mojolicious.pm new/Mojolicious-7.21/lib/Mojolicious.pm --- old/Mojolicious-7.20/lib/Mojolicious.pm 2017-01-15 17:05:21.000000000 +0100 +++ new/Mojolicious-7.21/lib/Mojolicious.pm 2017-01-18 10:38:08.000000000 +0100 @@ -57,7 +57,7 @@ has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Doughnut'; -our $VERSION = '7.20'; +our $VERSION = '7.21'; sub AUTOLOAD { my $self = shift; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/lib/ojo.pm new/Mojolicious-7.21/lib/ojo.pm --- old/Mojolicious-7.20/lib/ojo.pm 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.21/lib/ojo.pm 2017-01-21 13:36:02.000000000 +0100 @@ -28,31 +28,20 @@ a => sub { $caller->can('any')->(@_) and return $ua->server->app }, b => \&b, c => \&c, - d => sub { _request($ua, 'DELETE', @_) }, + d => sub { $ua->delete(@_)->result }, f => \&path, - g => sub { _request($ua, 'GET', @_) }, - h => sub { _request($ua, 'HEAD', @_) }, + g => sub { $ua->get(@_)->result }, + h => sub { $ua->head(@_)->result }, j => \&j, n => sub (&@) { say STDERR timestr timeit($_[1] // 1, $_[0]) }, - o => sub { _request($ua, 'OPTIONS', @_) }, - p => sub { _request($ua, 'POST', @_) }, + o => sub { $ua->options(@_)->result }, + p => sub { $ua->post(@_)->result }, r => \&dumper, - t => sub { _request($ua, 'PATCH', @_) }, - u => sub { _request($ua, 'PUT', @_) }, + t => sub { $ua->patch(@_)->result }, + u => sub { $ua->put(@_)->result }, x => sub { Mojo::DOM->new(@_) }; } -sub _request { - my $ua = shift; - - my $tx = $ua->start($ua->build_tx(@_)); - my $err = $tx->error; - warn qq/Problem loading URL "@{[$tx->req->url]}": $err->{message}\n/ - if $err && !$err->{code}; - - return $tx->res; -} - 1; =encoding utf8 @@ -130,6 +119,8 @@ Turn string into a L<Mojo::File> object. + $ perl -Mojo -E 'say r j f("hello.json")->slurp' + =head2 g my $res = g('example.com'); @@ -160,7 +151,7 @@ Encode Perl data structure or decode JSON with L<Mojo::JSON/"j">. - $ perl -Mojo -E 'b(j({hello => "world!"}))->spurt("hello.json")' + $ perl -Mojo -E 'f("hello.json")->spurt(j {hello => "world!"})' =head2 n @@ -198,7 +189,7 @@ Dump a Perl data structure with L<Mojo::Util/"dumper">. - perl -Mojo -E 'say r(g("example.com")->headers->to_hash)' + perl -Mojo -E 'say r g("example.com")->headers->to_hash' =head2 t @@ -226,7 +217,7 @@ Turn HTML/XML input into L<Mojo::DOM> object. - $ perl -Mojo -E 'say x(b("test.html")->slurp)->at("title")->text' + $ perl -Mojo -E 'say x(f("test.html")->slurp)->at("title")->text' =head1 SEE ALSO diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/script/hypnotoad new/Mojolicious-7.21/script/hypnotoad --- old/Mojolicious-7.20/script/hypnotoad 2016-11-01 19:31:15.000000000 +0100 +++ new/Mojolicious-7.21/script/hypnotoad 2017-01-19 21:19:12.000000000 +0100 @@ -1,20 +1,16 @@ #!perl - -use strict; -use warnings; +use Mojo::Base -strict; use Mojo::Server::Hypnotoad; -use Mojo::Util 'getopt'; -use Mojolicious::Command; +use Mojo::Util qw(extract_usage getopt); -getopt \@ARGV, +getopt 'f|foreground' => \$ENV{HYPNOTOAD_FOREGROUND}, 'h|help' => \my $help, 's|stop' => \$ENV{HYPNOTOAD_STOP}, 't|test' => \$ENV{HYPNOTOAD_TEST}; -my $app = shift || $ENV{HYPNOTOAD_APP}; -die Mojolicious::Command->new->extract_usage if $help || !$app; +die extract_usage if $help || !(my $app = shift || $ENV{HYPNOTOAD_APP}); Mojo::Server::Hypnotoad->new->run($app); =encoding utf8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/script/mojo new/Mojolicious-7.21/script/mojo --- old/Mojolicious-7.20/script/mojo 2016-11-01 13:22:08.000000000 +0100 +++ new/Mojolicious-7.21/script/mojo 2017-01-19 18:40:53.000000000 +0100 @@ -1,7 +1,5 @@ #!perl - -use strict; -use warnings; +use Mojo::Base -strict; use Mojolicious::Commands; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/script/morbo new/Mojolicious-7.21/script/morbo --- old/Mojolicious-7.20/script/morbo 2016-11-01 19:30:39.000000000 +0100 +++ new/Mojolicious-7.21/script/morbo 2017-01-19 21:19:08.000000000 +0100 @@ -1,20 +1,17 @@ #!perl - -use strict; -use warnings; +use Mojo::Base -strict; use Mojo::Server::Morbo; -use Mojo::Util 'getopt'; -use Mojolicious::Command; +use Mojo::Util qw(extract_usage getopt); -getopt \@ARGV, +getopt 'h|help' => \my $help, 'l|listen=s' => \my @listen, 'm|mode=s' => \$ENV{MOJO_MODE}, 'v|verbose' => \$ENV{MORBO_VERBOSE}, 'w|watch=s' => \my @watch; -die Mojolicious::Command->new->extract_usage if $help || !(my $app = shift); +die extract_usage if $help || !(my $app = shift); my $morbo = Mojo::Server::Morbo->new; $morbo->daemon->listen(\@listen) if @listen; $morbo->watch(\@watch) if @watch; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/t/mojo/lib/myapp.pl new/Mojolicious-7.21/t/mojo/lib/myapp.pl --- old/Mojolicious-7.20/t/mojo/lib/myapp.pl 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.21/t/mojo/lib/myapp.pl 2017-01-19 18:23:25.000000000 +0100 @@ -3,3 +3,12 @@ app->config(script => $0); app->start; + +=head1 SYNOPSIS + + USAGE: myapp.pl daemon + + test + 123 + +=cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/t/mojo/template.t new/Mojolicious-7.21/t/mojo/template.t --- old/Mojolicious-7.20/t/mojo/template.t 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.21/t/mojo/template.t 2017-01-20 21:31:57.000000000 +0100 @@ -1050,6 +1050,26 @@ $output = $mt->render("test\n\n123\n\n<% %>456\n789"); is $output, "test\n\n123\n\n456\n789\n", 'empty statement'; +# No newline +$mt = Mojo::Template->new; +$output = $mt->render('test'); +is $output, "test\n", 'just one newline'; + +# Multiple newlines at the end +$mt = Mojo::Template->new; +$output = $mt->render("test\n\n\n\n"); +is $output, "test\n", 'just one newline'; + +# Escaped newline at the end +$mt = Mojo::Template->new; +$output = $mt->render("test\\\n"); +is $output, 'test', 'no newline'; + +# Multiple escaped newlines at the end +$mt = Mojo::Template->new; +$output = $mt->render("test\\\n\n\n\n"); +is $output, 'test', 'no newline'; + # Optimize successive text lines ending with newlines $mt = Mojo::Template->new; $mt->parse(<<'EOF'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.20/t/mojo/util.t new/Mojolicious-7.21/t/mojo/util.t --- old/Mojolicious-7.20/t/mojo/util.t 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.21/t/mojo/util.t 2017-01-19 21:13:34.000000000 +0100 @@ -5,15 +5,16 @@ use Test::More; use Mojo::ByteStream 'b'; +use Mojo::File 'path'; use Mojo::DeprecationTest; use Mojo::Util qw(b64_decode b64_encode camelize class_to_file class_to_path decamelize), - qw(decode dumper encode getopt hmac_sha1_sum html_unescape md5_bytes md5_sum), - qw(monkey_patch punycode_decode punycode_encode quote secure_compare), - qw(sha1_bytes sha1_sum split_cookie_header split_header steady_time tablify), - qw(term_escape trim unindent unquote url_escape url_unescape xml_escape), - qw(xor_encode); + qw(decode dumper encode extract_usage getopt hmac_sha1_sum html_unescape), + qw(md5_bytes md5_sum monkey_patch punycode_decode punycode_encode quote), + qw(secure_compare sha1_bytes sha1_sum split_cookie_header split_header), + qw(steady_time tablify term_escape trim unindent unquote url_escape), + qw(url_unescape xml_escape xor_encode); # camelize is camelize('foo_bar_baz'), 'FooBarBaz', 'right camelized result'; @@ -112,6 +113,17 @@ ]; is_deeply split_cookie_header($header), $tree, 'right result'; +# extract_usage +is extract_usage, "extract_usage test!\n", 'right result'; +is extract_usage(path($FindBin::Bin, 'lib', 'myapp.pl')), + "USAGE: myapp.pl daemon\n\n test\n123\n", 'right result'; + +=head1 SYNOPSIS + + extract_usage test! + +=cut + # getopt getopt ['--charset', 'UTF-8'], 'c|charset=s' => \my $charset; is $charset, 'UTF-8', 'right string'; @@ -123,6 +135,12 @@ ok $flag, 'flag has been set'; is $whatever, 'Whatever!', 'right string'; is_deeply $array, ['stuff'], 'right structure'; +{ + local @ARGV = ('--charset', 'UTF-16', 'test'); + getopt 'c|charset=s' => \my @charset; + is_deeply \@charset, ['UTF-16'], 'right structure'; + is_deeply \@ARGV, ['test'], 'right structure'; +} # unindent is unindent(" test\n 123\n 456\n"), "test\n 123\n456\n",
