Hello community,
here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2015-09-30 05:52:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-09-24 06:15:04.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2015-09-30 05:52:43.000000000 +0200
@@ -1,0 +2,22 @@
+Sun Sep 27 09:00:50 UTC 2015 - coolo@suse.com
+
+- updated to 6.22
+ see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+ 6.22 2015-09-26
+ - Improved Mojo::JSON by reusing JSON::PP boolean constants.
+ - Improved uniq method in Mojo::Collection to accept a callback. (CandyAngel)
+ - Improved first and grep methods in Mojo::Collection to be able to call
+ methods.
+ - Improved support for empty attributes in Mojo::DOM::HTML.
+
+-------------------------------------------------------------------
+Wed Sep 23 08:48:53 UTC 2015 - coolo@suse.com
+
+- updated to 6.21
+ see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+ 6.21 2015-09-23
+ - Added val method to Mojo::DOM.
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-6.20.tar.gz
New:
----
Mojolicious-6.22.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious.spec ++++++
--- /var/tmp/diff_new_pack.ESQ4Qj/_old 2015-09-30 05:52:44.000000000 +0200
+++ /var/tmp/diff_new_pack.ESQ4Qj/_new 2015-09-30 05:52:44.000000000 +0200
@@ -17,7 +17,7 @@
Name: perl-Mojolicious
-Version: 6.20
+Version: 6.22
Release: 0
%define cpan_name Mojolicious
Summary: Real-time web framework
@@ -31,9 +31,11 @@
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(IO::Socket::IP) >= 0.26
+BuildRequires: perl(JSON::PP) >= 2.27103
BuildRequires: perl(Pod::Simple) >= 3.09
BuildRequires: perl(Time::Local) >= 1.2
Requires: perl(IO::Socket::IP) >= 0.26
+Requires: perl(JSON::PP) >= 2.27103
Requires: perl(Pod::Simple) >= 3.09
Requires: perl(Time::Local) >= 1.2
%{perl_requires}
++++++ Mojolicious-6.20.tar.gz -> Mojolicious-6.22.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/Changes new/Mojolicious-6.22/Changes
--- old/Mojolicious-6.20/Changes 2015-09-17 00:44:17.000000000 +0200
+++ new/Mojolicious-6.22/Changes 2015-09-26 04:10:45.000000000 +0200
@@ -1,4 +1,14 @@
+6.22 2015-09-26
+ - Improved Mojo::JSON by reusing JSON::PP boolean constants.
+ - Improved uniq method in Mojo::Collection to accept a callback. (CandyAngel)
+ - Improved first and grep methods in Mojo::Collection to be able to call
+ methods.
+ - Improved support for empty attributes in Mojo::DOM::HTML.
+
+6.21 2015-09-23
+ - Added val method to Mojo::DOM.
+
6.20 2015-09-15
- Deprecated Mojo::UserAgent::CookieJar::collecting in favor of
Mojo::UserAgent::CookieJar::ignore.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/META.json new/Mojolicious-6.22/META.json
--- old/Mojolicious-6.20/META.json 2015-09-17 00:49:25.000000000 +0200
+++ new/Mojolicious-6.22/META.json 2015-09-27 03:03:11.000000000 +0200
@@ -35,6 +35,7 @@
"runtime" : {
"requires" : {
"IO::Socket::IP" : "0.26",
+ "JSON::PP" : "2.27103",
"Pod::Simple" : "3.09",
"Time::Local" : "1.2",
"perl" : "5.010001"
@@ -57,6 +58,6 @@
},
"x_IRC" : "irc://irc.perl.org/#mojo"
},
- "version" : "6.20",
+ "version" : "6.22",
"x_serialization_backend" : "JSON::PP version 2.27300"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/META.yml new/Mojolicious-6.22/META.yml
--- old/Mojolicious-6.20/META.yml 2015-09-17 00:49:25.000000000 +0200
+++ new/Mojolicious-6.22/META.yml 2015-09-27 03:03:10.000000000 +0200
@@ -21,6 +21,7 @@
- t
requires:
IO::Socket::IP: '0.26'
+ JSON::PP: '2.27103'
Pod::Simple: '3.09'
Time::Local: '1.2'
perl: '5.010001'
@@ -30,5 +31,5 @@
homepage: http://mojolicio.us
license: http://www.opensource.org/licenses/artistic-license-2.0
repository: https://github.com/kraih/mojo.git
-version: '6.20'
+version: '6.22'
x_serialization_backend: 'CPAN::Meta::YAML version 0.016'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/Makefile.PL new/Mojolicious-6.22/Makefile.PL
--- old/Mojolicious-6.20/Makefile.PL 2015-08-29 01:37:48.000000000 +0200
+++ new/Mojolicious-6.22/Makefile.PL 2015-09-24 20:21:19.000000000 +0200
@@ -6,6 +6,7 @@
use ExtUtils::MakeMaker;
# Pod::Simple 3.09 first shipped with Perl 5.11.2
+# JSON::PP 2.27103 first shipped with Perl 5.13.9
# Time::Local 1.2 first shipped with Perl 5.13.9
# IO::Socket::IP 0.26 first shipped with Perl 5.19.8
WriteMakefile(
@@ -33,6 +34,7 @@
},
PREREQ_PM => {
'IO::Socket::IP' => '0.26',
+ 'JSON::PP' => '2.27103',
'Pod::Simple' => '3.09',
'Time::Local' => '1.2'
},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojo/Collection.pm new/Mojolicious-6.22/lib/Mojo/Collection.pm
--- old/Mojolicious-6.20/lib/Mojo/Collection.pm 2015-08-29 13:14:02.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojo/Collection.pm 2015-09-26 04:10:34.000000000 +0200
@@ -27,18 +27,18 @@
}
sub first {
- my ($self, $cb) = @_;
+ my ($self, $cb) = (shift, shift);
return $self->[0] unless $cb;
- return List::Util::first { $cb->($_) } @$self if ref $cb eq 'CODE';
- return List::Util::first { $_ =~ $cb } @$self;
+ return List::Util::first { $_ =~ $cb } @$self if ref $cb eq 'Regexp';
+ return List::Util::first { $_->$cb(@_) } @$self;
}
sub flatten { $_[0]->new(_flatten(@{$_[0]})) }
sub grep {
- my ($self, $cb) = @_;
- return $self->new(grep { $cb->($_) } @$self) if ref $cb eq 'CODE';
- return $self->new(grep { $_ =~ $cb } @$self);
+ my ($self, $cb) = (shift, shift);
+ return $self->new(grep { $_ =~ $cb } @$self) if ref $cb eq 'Regexp';
+ return $self->new(grep { $_->$cb(@_) } @$self);
}
sub join {
@@ -93,8 +93,10 @@
sub to_array { [@{shift()}] }
sub uniq {
+ my ($self, $cb) = (shift, shift);
my %seen;
- return $_[0]->new(grep { !$seen{$_}++ } @{$_[0]});
+ return $self->new(grep { !$seen{$_->$cb(@_)}++ } @$self) if $cb;
+ return $self->new(grep { !$seen{$_}++ } @$self);
}
sub _flatten {
@@ -190,11 +192,16 @@
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);
-Evaluate regular expression or callback for each element in collection and
-return the first one that matched the regular expression, or for which the
-callback returned true. The element will be the first argument passed to the
-callback and is also available as C<$_>.
+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
+which the callback/method returned true. The element will be the first argument
+passed to the callback and is also available as C<$_>.
+
+ # Longer version
+ my $first = $collection->first(sub { $_->$method(@args) });
# Find first value that contains the word "mojo"
my $interesting = $collection->first(qr/mojo/i);
@@ -216,11 +223,17 @@
my $new = $collection->grep(qr/foo/);
my $new = $collection->grep(sub {...});
+ my $new = $collection->grep($method);
+ my $new = $collection->grep($method, @args);
-Evaluate regular expression or callback for each element in collection and
-create a new collection with all elements that matched the regular expression,
-or for which the callback returned true. The element will be the first argument
-passed to the callback and is also available as C<$_>.
+Evaluate regular expression/callback for, or call method on, each element in
+collection and create a new collection with all elements that matched the
+regular expression, or for which the callback/method returned true. The element
+will be the first argument passed to the callback and is also available as
+C<$_>.
+
+ # Longer version
+ my $new = $collection->grep(sub { $_->$method(@args) });
# Find all values that contain the word "mojo"
my $interesting = $collection->grep(qr/mojo/i);
@@ -333,12 +346,23 @@
=head2 uniq
my $new = $collection->uniq;
+ my $new = $collection->uniq(sub {...});
+ my $new = $collection->uniq($method);
+ my $new = $collection->uniq($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.
-Create a new collection without duplicate elements.
+ # Longer version
+ my $new = $collection->uniq(sub { $_->$method(@args) });
# "foo bar baz"
Mojo::Collection->new('foo', 'bar', 'bar', 'baz')->uniq->join(' ');
+ # "[[1, 2], [2, 1]]"
+ Mojo::Collection->new([1, 2], [2, 1], [3, 2])->uniq(sub{ $_->[1] })->to_array;
+
=head1 SEE ALSO
L<Mojolicious>, LMojolicious::Guides, Lhttp://mojolicio.us.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojo/DOM/CSS.pm new/Mojolicious-6.22/lib/Mojo/DOM/CSS.pm
--- old/Mojolicious-6.20/lib/Mojo/DOM/CSS.pm 2015-08-29 16:02:28.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojo/DOM/CSS.pm 2015-09-22 00:37:19.000000000 +0200
@@ -386,19 +386,6 @@
my $root = $css->select(':root');
-=head2 E:checked
-
-A user interface element C<E> which is checked (for instance a radio-button or
-checkbox).
-
- my $input = $css->select(':checked');
-
-=head2 E:empty
-
-An C<E> element that has no children (including text nodes).
-
- my $empty = $css->select(':empty');
-
=head2 E:nth-child(n)
An C<E> element, the C<n-th> child of its parent.
@@ -471,6 +458,19 @@
my $lonely = $css->select('div p:only-of-type');
+=head2 E:empty
+
+An C<E> element that has no children (including text nodes).
+
+ my $empty = $css->select(':empty');
+
+=head2 E:checked
+
+A user interface element C<E> which is checked (for instance a radio-button or
+checkbox).
+
+ my $input = $css->select(':checked');
+
=head2 E.warning
An C<E> element whose class is "warning".
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojo/DOM/HTML.pm new/Mojolicious-6.22/lib/Mojo/DOM/HTML.pm
--- old/Mojolicious-6.20/lib/Mojo/DOM/HTML.pm 2015-08-29 13:17:09.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojo/DOM/HTML.pm 2015-09-25 01:03:50.000000000 +0200
@@ -228,8 +228,9 @@
# Attributes
for my $key (sort keys %{$tree->[2]}) {
- $result .= " $key" and next unless defined(my $value = $tree->[2]{$key});
- $result .= " $key" . '="' . xml_escape($value) . '"';
+ my $value = $tree->[2]{$key};
+ $result .= $xml ? qq{ $key="$key"} : " $key" and next unless defined $value;
+ $result .= qq{ $key="} . xml_escape($value) . '"';
}
# No children
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojo/DOM.pm new/Mojolicious-6.22/lib/Mojo/DOM.pm
--- old/Mojolicious-6.20/lib/Mojo/DOM.pm 2015-08-29 13:17:09.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojo/DOM.pm 2015-09-23 00:05:13.000000000 +0200
@@ -159,6 +159,20 @@
sub type { shift->tree->[0] }
+sub val {
+ my $self = shift;
+
+ # "option"
+ return $self->{value} // $self->text if (my $tag = $self->tag) eq 'option';
+
+ # "textarea", "input" or "button"
+ return $tag eq 'textarea' ? $self->text : $self->{value} if $tag ne 'select';
+
+ # "select"
+ my $v = $self->find('option:checked')->map('val');
+ return exists $self->{multiple} ? $v->size ? $v->to_array : undef : $v->last;
+}
+
sub wrap { shift->_wrap(0, @_) }
sub wrap_content { shift->_wrap(1, @_) }
@@ -401,27 +415,57 @@
selector support. It will even try to interpret broken HTML and XML, so you
should not use it for validation.
+=head1 NODES AND ELEMENTS
+
+When we parse an HTML/XML fragment, it gets turned into a tree of nodes.
+
+ <!DOCTYPE html>
+ <html>
+ <head><title>Hello</title></head>
+ <body>World!</body>
+ </html>
+
+There are currently eight different kinds of nodes, C<cdata>, C<comment>,
+C<doctype>, C<pi>, C<raw>, C<root>, C<tag> and C<text>. Elements are nodes of
+the type C<tag>.
+
+ root
+ |- doctype (html)
+ +- tag (html)
+ |- tag (head)
+ | +- tag (title)
+ | +- raw (Hello)
+ +- tag (body)
+ +- text (World!)
+
+While all node types are represented as LMojo::DOM objects, some methods like
+L"attr"> and L"namespace"> only apply to elements.
+
=head1 CASE-SENSITIVITY
LMojo::DOM defaults to HTML semantics, that means all tags and attribute
names are lowercased and selectors need to be lowercase as well.
+ # HTML semantics
my $dom = Mojo::DOM->new('<P ID="greeting">Hi!</P>');
say $dom->at('p[id]')->text;
If XML processing instructions are found, the parser will automatically switch
into XML mode and everything becomes case-sensitive.
+ # XML semantics
my $dom = Mojo::DOM->new('<?xml version="1.0"?><P ID="greeting">Hi!</P>');
say $dom->at('P[ID]')->text;
XML detection can also be disabled with the L"xml"> method.
# Force XML semantics
- $dom->xml(1);
+ my $dom = Mojo::DOM->new->xml(1)->parse('<P ID="greeting">Hi!</P>');
+ say $dom->at('P[ID]')->text;
# Force HTML semantics
- $dom->xml(0);
+ my $dom = Mojo::DOM->new->xml(0)->parse('<P ID="greeting">Hi!</P>');
+ say $dom->at('p[id]')->text;
=head1 METHODS
@@ -518,8 +562,11 @@
# "<p><b>123</b></p>"
$dom->parse('<p>Test<b>123</b></p>')->at('p')->child_nodes->first->remove;
- # "<!-- Test -->"
- $dom->parse('<!-- Test --><b>123</b>')->child_nodes->first;
+ # "<!DOCTYPE html>"
+ $dom->parse('<!DOCTYPE html><b>123</b>')->child_nodes->first;
+
+ # " Test "
+ $dom->parse('<b>123</b><!-- Test -->')->child_nodes->last->content;
=head2 children
@@ -778,7 +825,7 @@
my $parent = $dom->remove;
-Remove this node and return L"parent">.
+Remove this node and return L"root"> (for C<root> nodes) or L"parent">.
# "<div></div>"
$dom->parse('<div><h1>Test</h1></div>')->at('h1')->remove;
@@ -791,7 +838,8 @@
my $parent = $dom->replace('<div>I ♥ Mojolicious!</div>');
-Replace this node with HTML/XML fragment and return L"parent">.
+Replace this node with HTML/XML fragment and return L"root"> (for C<root>
+nodes) or L"parent">.
# "<div><h2>123</h2></div>"
$dom->parse('<div><h1>Test</h1></div>')->at('h1')->replace('<h2>123</h2>');
@@ -804,7 +852,7 @@
my $root = $dom->root;
-Return LMojo::DOM object for root node.
+Return LMojo::DOM object for C<root> node.
=head2 strip
@@ -869,6 +917,57 @@
This node's type, usually C<cdata>, C<comment>, C<doctype>, C<pi>, C<raw>,
C<root>, C<tag> or C<text>.
+ # "cdata"
+ $dom->parse('<![CDATA[Test]]>')->child_nodes->first->type;
+
+ # "comment"
+ $dom->parse('<!-- Test -->')->child_nodes->first->type;
+
+ # "doctype"
+ $dom->parse('<!DOCTYPE html>')->child_nodes->first->type;
+
+ # "pi"
+ $dom->parse('<?xml version="1.0"?>')->child_nodes->first->type;
+
+ # "raw"
+ $dom->parse('<title>Test</title>')->at('title')->child_nodes->first->type;
+
+ # "root"
+ $dom->parse('<p>Test</p>')->type;
+
+ # "tag"
+ $dom->parse('<p>Test</p>')->at('p')->type;
+
+ # "text"
+ $dom->parse('<p>Test</p>')->at('p')->child_nodes->first->type;
+
+=head2 val
+
+ my $value = $dom->val;
+
+Extract value from form element (such as C<button>, C<input>, C<option>,
+C<select> and C<textarea>) or return C<undef> if this element has no value. In
+the case of C<select> with C<multiple> attribute, find C<option> elements with
+C<selected> attribute and return an array reference with all values or C<undef>
+if none could be found.
+
+ # "a"
+ $dom->parse('<input name="test" value="a">')->at('input')->val;
+
+ # "b"
+ $dom->parse('<textarea>b</textarea>')->at('textarea')->val;
+
+ # "c"
+ $dom->parse('<option value="c">Test</option>')->at('option')->val;
+
+ # "d"
+ $dom->parse('<select><option selected>d</option></select>')
+ ->at('select')->val;
+
+ # "e"
+ $dom->parse('<select multiple><option selected>e</option></select>')
+ ->at('select')->val->[0];
+
=head2 wrap
$dom = $dom->wrap('<div></div>');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojo/JSON.pm new/Mojolicious-6.22/lib/Mojo/JSON.pm
--- old/Mojolicious-6.20/lib/Mojo/JSON.pm 2015-08-29 16:03:19.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojo/JSON.pm 2015-09-24 20:42:32.000000000 +0200
@@ -4,14 +4,12 @@
use B;
use Carp 'croak';
use Exporter 'import';
+use JSON::PP ();
use Mojo::Util;
use Scalar::Util 'blessed';
our @EXPORT_OK = qw(decode_json encode_json false from_json j to_json true);
-# Booleans
-my ($FALSE, $TRUE) = map { bless \(my $dummy = $_), 'Mojo::JSON::_Bool' } 0, 1;
-
# Escaped special character map (with u2028 and u2029)
my %ESCAPE = (
'"' => '"',
@@ -35,7 +33,7 @@
sub encode_json { Mojo::Util::encode 'UTF-8', _encode_value(shift) }
-sub false () {$FALSE}
+sub false () {JSON::PP::false}
sub from_json {
my $err = _decode(\my $value, shift, 1);
@@ -49,7 +47,7 @@
sub to_json { _encode_value(shift) }
-sub true () {$TRUE}
+sub true () {JSON::PP::true}
sub _decode {
my $valueref = shift;
@@ -197,10 +195,10 @@
if /\G([-]?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?)/gc;
# True
- return $TRUE if /\Gtrue/gc;
+ return true() if /\Gtrue/gc;
# False
- return $FALSE if /\Gfalse/gc;
+ return false() if /\Gfalse/gc;
# Null
return undef if /\Gnull/gc;
@@ -240,7 +238,7 @@
# True or false
return $$value ? 'true' : 'false' if $ref eq 'SCALAR';
- return $value ? 'true' : 'false' if $ref eq 'Mojo::JSON::_Bool';
+ return $value ? 'true' : 'false' if $ref eq 'JSON::PP::Boolean';
# Blessed reference with TO_JSON method
if (blessed $value && (my $sub = $value->can('TO_JSON'))) {
@@ -277,10 +275,6 @@
die "$context\n";
}
-# Emulate boolean type
-package Mojo::JSON::_Bool;
-use overload '""' => sub { ${$_[0]} }, fallback => 1;
-
1;
=encoding utf8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojo/Parameters.pm new/Mojolicious-6.22/lib/Mojo/Parameters.pm
--- old/Mojolicious-6.20/lib/Mojo/Parameters.pm 2015-08-29 16:31:35.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojo/Parameters.pm 2015-09-22 19:59:35.000000000 +0200
@@ -21,7 +21,7 @@
if (ref $value eq 'ARRAY') { push @$old, $name => $_ // '' for @$value }
# Single value
- else { push @$old, $name => $value }
+ elsif (defined $value) { push @$old, $name => $value }
}
return $self;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojo/UserAgent/CookieJar.pm new/Mojolicious-6.22/lib/Mojo/UserAgent/CookieJar.pm
--- old/Mojolicious-6.20/lib/Mojo/UserAgent/CookieJar.pm 2015-09-15 18:55:10.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojo/UserAgent/CookieJar.pm 2015-09-18 22:06:45.000000000 +0200
@@ -168,11 +168,11 @@
# Ignore all cookies
$jar->ignore(sub { 1 });
- # Ignore cookies with domain "com"
+ # Ignore cookies for domains "com", "net" and "org"
$jar->ignore(sub {
my $cookie = shift;
return undef unless my $domain = $cookie->domain;
- return $domain eq 'com';
+ return $domain eq 'com' || $domain eq 'net' || $domain eq 'org';
});
=head2 max_cookie_size
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojo/UserAgent/Transactor.pm new/Mojolicious-6.22/lib/Mojo/UserAgent/Transactor.pm
--- old/Mojolicious-6.20/lib/Mojo/UserAgent/Transactor.pm 2015-08-29 13:17:09.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojo/UserAgent/Transactor.pm 2015-09-22 20:00:06.000000000 +0200
@@ -192,7 +192,7 @@
my @parts;
for my $name (sort keys %$form) {
- my $values = $form->{$name};
+ next unless defined(my $values = $form->{$name});
for my $value (ref $values eq 'ARRAY' ? @$values : ($values)) {
push @parts, my $part = Mojo::Content::Single->new;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojo/UserAgent.pm new/Mojolicious-6.22/lib/Mojo/UserAgent.pm
--- old/Mojolicious-6.20/lib/Mojo/UserAgent.pm 2015-09-15 18:45:39.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojo/UserAgent.pm 2015-09-18 14:30:58.000000000 +0200
@@ -717,7 +717,7 @@
LMojo::UserAgent::Transactor/"tx" (except for the C<DELETE> method, which is
implied). You can also append a callback to perform requests non-blocking.
- $ua->delete('http://example.com' => sub {
+ $ua->delete('http://example.com' => json => {a => 'b'} => sub {
my ($ua, $tx) = @_;
say $tx->res->body;
});
@@ -737,7 +737,7 @@
for the C<GET> method, which is implied). You can also append a callback to
perform requests non-blocking.
- $ua->get('http://example.com' => sub {
+ $ua->get('http://example.com' => json => {a => 'b'} => sub {
my ($ua, $tx) = @_;
say $tx->res->body;
});
@@ -757,7 +757,7 @@
LMojo::UserAgent::Transactor/"tx" (except for the C<HEAD> method, which is
implied). You can also append a callback to perform requests non-blocking.
- $ua->head('http://example.com' => sub {
+ $ua->head('http://example.com' => json => {a => 'b'} => sub {
my ($ua, $tx) = @_;
say $tx->res->body;
});
@@ -777,7 +777,7 @@
LMojo::UserAgent::Transactor/"tx" (except for the C<OPTIONS> method, which is
implied). You can also append a callback to perform requests non-blocking.
- $ua->options('http://example.com' => sub {
+ $ua->options('http://example.com' => json => {a => 'b'} => sub {
my ($ua, $tx) = @_;
say $tx->res->body;
});
@@ -797,7 +797,7 @@
LMojo::UserAgent::Transactor/"tx" (except for the C<PATCH> method, which is
implied). You can also append a callback to perform requests non-blocking.
- $ua->patch('http://example.com' => sub {
+ $ua->patch('http://example.com' => json => {a => 'b'} => sub {
my ($ua, $tx) = @_;
say $tx->res->body;
});
@@ -817,7 +817,7 @@
LMojo::UserAgent::Transactor/"tx" (except for the C<POST> method, which is
implied). You can also append a callback to perform requests non-blocking.
- $ua->post('http://example.com' => sub {
+ $ua->post('http://example.com' => json => {a => 'b'} => sub {
my ($ua, $tx) = @_;
say $tx->res->body;
});
@@ -837,7 +837,7 @@
for the C<PUT> method, which is implied). You can also append a callback to
perform requests non-blocking.
- $ua->put('http://example.com' => sub {
+ $ua->put('http://example.com' => json => {a => 'b'} => sub {
my ($ua, $tx) = @_;
say $tx->res->body;
});
@@ -869,7 +869,7 @@
receive either a LMojo::Transaction::WebSocket or LMojo::Transaction::HTTP
object, depending on if the handshake was successful.
- $ua->websocket('wss://example.com/echo' => sub {
+ $ua->websocket('wss://example.com/echo' => ['v1.proto'] => sub {
my ($ua, $tx) = @_;
say 'WebSocket handshake failed!' and return unless $tx->is_websocket;
$tx->on(finish => sub {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Mojolicious.pm new/Mojolicious-6.22/lib/Mojolicious.pm
--- old/Mojolicious-6.20/lib/Mojolicious.pm 2015-09-13 01:36:47.000000000 +0200
+++ new/Mojolicious-6.22/lib/Mojolicious.pm 2015-09-23 03:05:07.000000000 +0200
@@ -43,7 +43,7 @@
has validator => sub { Mojolicious::Validator->new };
our $CODENAME = 'Clinking Beer Mugs';
-our $VERSION = '6.20';
+our $VERSION = '6.22';
sub AUTOLOAD {
my $self = shift;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/lib/Test/Mojo.pm new/Mojolicious-6.22/lib/Test/Mojo.pm
--- old/Mojolicious-6.20/lib/Test/Mojo.pm 2015-08-29 13:17:09.000000000 +0200
+++ new/Mojolicious-6.22/lib/Test/Mojo.pm 2015-09-21 22:13:57.000000000 +0200
@@ -701,7 +701,7 @@
# Run additional tests on the transaction
$t->get_ok('/foo')->status_is(200);
- is $t->tx->res->dom->at('input')->{value}, 'whatever', 'right value';
+ is $t->tx->res->dom->at('input')->val, 'whatever', 'right value';
=head2 head_ok
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/t/mojo/collection.t new/Mojolicious-6.22/t/mojo/collection.t
--- old/Mojolicious-6.20/t/mojo/collection.t 2015-08-29 01:31:10.000000000 +0200
+++ new/Mojolicious-6.22/t/mojo/collection.t 2015-09-25 22:40:28.000000000 +0200
@@ -46,6 +46,9 @@
is $collection->first(sub { shift() < 5 }), 4, 'right result';
is $collection->first(qr/[1-4]/), 4, 'right result';
is $collection->first(sub { ref $_ eq 'CODE' }), undef, 'no result';
+$collection = c(c(1, 2, 3), c(4, 5, 6), c(7, 8, 9));
+is_deeply $collection->first(first => sub { $_ == 5 })->to_array, [4, 5, 6],
+ 'right result';
$collection = c();
is $collection->first, undef, 'no result';
is $collection->first(sub {defined}), undef, 'no result';
@@ -69,6 +72,9 @@
'right elements';
is_deeply $collection->grep(sub { $_ < 1 })->to_array, [], 'no elements';
is_deeply $collection->grep(sub { $_ > 9 })->to_array, [], 'no elements';
+$collection = c(c(1, 2, 3), c(4, 5, 6), c(7, 8, 9));
+is_deeply $collection->grep(first => sub { $_ >= 5 })->flatten->to_array,
+ [4, 5, 6, 7, 8, 9], 'right result';
# join
$collection = c(1, 2, 3);
@@ -153,6 +159,12 @@
is_deeply $collection->uniq->to_array, [1, 2, 3, 4, 5], 'right result';
is_deeply $collection->uniq->reverse->uniq->to_array, [5, 4, 3, 2, 1],
'right result';
+$collection = c([1, 2, 3], [3, 2, 1], [3, 1, 2]);
+is_deeply $collection->uniq(sub { $_->[1] }), [[1, 2, 3], [3, 1, 2]],
+ 'right result';
+$collection = c(c(1, 2), c(1, 2), c(2, 1));
+is_deeply $collection->uniq(join => ',')->flatten->to_array, [1, 2, 2, 1],
+ 'right result';
# TO_JSON
is encode_json(c(1, 2, 3)), '[1,2,3]', 'right result';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.20/t/mojo/dom.t new/Mojolicious-6.22/t/mojo/dom.t
--- old/Mojolicious-6.20/t/mojo/dom.t 2015-08-29 01:31:15.000000000 +0200
+++ new/Mojolicious-6.22/t/mojo/dom.t 2015-09-25 01:00:02.000000000 +0200
@@ -1918,7 +1918,8 @@
ok $element->root->xml, 'XML mode active';
$dom->replace('<XMLTest2 /><XMLTest3 just="works" />');
ok $dom->xml, 'XML mode active';
-is $dom, '<XMLTest2 /><XMLTest3 just="works" />', 'right result';
+$dom->at('XMLTest2')->{foo} = undef;
+is $dom, '<XMLTest2 foo="foo" /><XMLTest3 just="works" />', 'right result';
# Ensure HTML semantics
ok !Mojo::DOM->new->xml(undef)->parse('<?xml version="1.0"?>')->xml,
@@ -2173,6 +2174,49 @@
is $dom->at('div pre code')->all_text(0), "like\n it\n really",
'right text';
+# Form values
+$dom = Mojo::DOM->new(<