Hello community, here is the log from the commit of package perl-WWW-Mechanize for openSUSE:Factory checked in at 2020-10-18 16:18:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-WWW-Mechanize (Old) and /work/SRC/openSUSE:Factory/.perl-WWW-Mechanize.new.3486 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-WWW-Mechanize" Sun Oct 18 16:18:33 2020 rev:33 rq:841739 version:2.02 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-WWW-Mechanize/perl-WWW-Mechanize.changes 2020-10-08 13:05:26.402806078 +0200 +++ /work/SRC/openSUSE:Factory/.perl-WWW-Mechanize.new.3486/perl-WWW-Mechanize.changes 2020-10-18 16:18:42.492418371 +0200 @@ -1,0 +2,22 @@ +Wed Oct 14 03:19:52 UTC 2020 - Tina Müller <timueller+p...@suse.de> + +- updated to 2.02 + see /usr/share/doc/packages/perl-WWW-Mechanize/Changes + + 2.02 2020-10-13 13:50:28Z + [ENHANCEMENTS] + - Add redirects() as a short to HTTP::Response->redirects (GH#116) (Julien Fiegehenn) + - click_button( value => $foo) now also works for button tags and image buttons + (GH#131) (Spencer Christensen) and (Julien Fiegehenn) + + [DOCUMENTATION] + - Document that click_button() will die when it cannot find a button (GH#136) (Julien Fiegehenn) + - Document that content() returns undef before a request was made (GH#134) (Julien Fiegehenn) + + [TESTS] + - Add a test for dump_forms() with multiselect (GH#133) (Julien Fiegehenn) + - Add tests for select multiple (GH#132) (Michael G. Schwern) and (Julien Fiegehenn) + - Remove use of discouraged vars pragma (James Raspass) + - Add tests for dump_forms() and field() with empty attributes (GH#125) (Julien Fiegehenn) + +------------------------------------------------------------------- Old: ---- WWW-Mechanize-2.01.tar.gz New: ---- WWW-Mechanize-2.02.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-WWW-Mechanize.spec ++++++ --- /var/tmp/diff_new_pack.hsSqbq/_old 2020-10-18 16:18:43.540418838 +0200 +++ /var/tmp/diff_new_pack.hsSqbq/_new 2020-10-18 16:18:43.544418839 +0200 @@ -17,7 +17,7 @@ Name: perl-WWW-Mechanize -Version: 2.01 +Version: 2.02 Release: 0 %define cpan_name WWW-Mechanize Summary: Handy web browsing in a Perl object ++++++ WWW-Mechanize-2.01.tar.gz -> WWW-Mechanize-2.02.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/CONTRIBUTORS new/WWW-Mechanize-2.02/CONTRIBUTORS --- old/WWW-Mechanize-2.01/CONTRIBUTORS 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/CONTRIBUTORS 2020-10-13 15:50:41.000000000 +0200 @@ -25,6 +25,7 @@ * Gareth Tunley * gregor herrmann * Grigor Karavardanyan + * James Raspass * Jason May * Jesse Vincent * John Beppu diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/Changes new/WWW-Mechanize-2.02/Changes --- old/WWW-Mechanize-2.01/Changes 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/Changes 2020-10-13 15:50:41.000000000 +0200 @@ -1,5 +1,21 @@ Revision history for WWW::Mechanize +2.02 2020-10-13 13:50:28Z + [ENHANCEMENTS] + - Add redirects() as a short to HTTP::Response->redirects (GH#116) (Julien Fiegehenn) + - click_button( value => $foo) now also works for button tags and image buttons + (GH#131) (Spencer Christensen) and (Julien Fiegehenn) + + [DOCUMENTATION] + - Document that click_button() will die when it cannot find a button (GH#136) (Julien Fiegehenn) + - Document that content() returns undef before a request was made (GH#134) (Julien Fiegehenn) + + [TESTS] + - Add a test for dump_forms() with multiselect (GH#133) (Julien Fiegehenn) + - Add tests for select multiple (GH#132) (Michael G. Schwern) and (Julien Fiegehenn) + - Remove use of discouraged vars pragma (James Raspass) + - Add tests for dump_forms() and field() with empty attributes (GH#125) (Julien Fiegehenn) + 2.01 2020-09-18 17:51:10Z - Add rel filter to find_link() (GH#305) (Julien Fiegehenn) - Fix typos (GH#304) (Ferenc Erki) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/MANIFEST new/WWW-Mechanize-2.02/MANIFEST --- old/WWW-Mechanize-2.01/MANIFEST 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/MANIFEST 2020-10-13 15:50:41.000000000 +0200 @@ -53,6 +53,7 @@ t/find_link_xhtml.html t/find_link_xhtml.t t/form-parsing.t +t/form_133_regression.html t/form_with_fields.html t/form_with_fields.t t/form_with_fields_passthrough_params.t @@ -90,6 +91,7 @@ t/local/referer-server t/local/referer.t t/local/reload.t +t/local/select_multiple.t t/local/submit.t t/mech-dump/mech-dump.t t/new.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/META.json new/WWW-Mechanize-2.02/META.json --- old/WWW-Mechanize-2.01/META.json 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/META.json 2020-10-13 15:50:41.000000000 +0200 @@ -111,23 +111,22 @@ "URI" : "0", "URI::Escape" : "0", "bytes" : "0", - "lib" : "0", - "vars" : "0" + "lib" : "0" } } }, "provides" : { "WWW::Mechanize" : { "file" : "lib/WWW/Mechanize.pm", - "version" : "2.01" + "version" : "2.02" }, "WWW::Mechanize::Image" : { "file" : "lib/WWW/Mechanize/Image.pm", - "version" : "2.01" + "version" : "2.02" }, "WWW::Mechanize::Link" : { "file" : "lib/WWW/Mechanize/Link.pm", - "version" : "2.01" + "version" : "2.02" } }, "release_status" : "stable", @@ -142,7 +141,7 @@ "web" : "https://github.com/libwww-perl/WWW-Mechanize" } }, - "version" : "2.01", + "version" : "2.02", "x_Dist_Zilla" : { "perl" : { "version" : "5.030002" @@ -666,7 +665,7 @@ "branch" : null, "changelog" : "Changes", "signed" : 0, - "tag" : "v2.01", + "tag" : "v2.02", "tag_format" : "v%V", "tag_message" : "v%V" }, @@ -908,6 +907,7 @@ "Gareth Tunley <gjtun...@gmail.com>", "gregor herrmann <gre...@debian.org>", "Grigor Karavardanyan <k.gri...@yahoo.com>", + "James Raspass <jrasp...@gmail.com>", "Jason May <jason...@bestpractical.com>", "Jesse Vincent <je...@bestpractical.com>", "John Beppu <john.be...@gmail.com>", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/META.yml new/WWW-Mechanize-2.02/META.yml --- old/WWW-Mechanize-2.01/META.yml 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/META.yml 2020-10-13 15:50:41.000000000 +0200 @@ -28,7 +28,6 @@ URI::Escape: '0' bytes: '0' lib: '0' - vars: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 @@ -46,13 +45,13 @@ provides: WWW::Mechanize: file: lib/WWW/Mechanize.pm - version: '2.01' + version: '2.02' WWW::Mechanize::Image: file: lib/WWW/Mechanize/Image.pm - version: '2.01' + version: '2.02' WWW::Mechanize::Link: file: lib/WWW/Mechanize/Link.pm - version: '2.01' + version: '2.02' requires: Carp: '0' Getopt::Long: '0' @@ -77,7 +76,7 @@ bugtracker: https://github.com/libwww-perl/WWW-Mechanize/issues homepage: https://github.com/libwww-perl/WWW-Mechanize repository: https://github.com/libwww-perl/WWW-Mechanize.git -version: '2.01' +version: '2.02' x_Dist_Zilla: perl: version: '5.030002' @@ -483,7 +482,7 @@ branch: ~ changelog: Changes signed: 0 - tag: v2.01 + tag: v2.02 tag_format: v%V tag_message: v%V Dist::Zilla::Role::Git::Repo: @@ -667,6 +666,7 @@ - 'Gareth Tunley <gjtun...@gmail.com>' - 'gregor herrmann <gre...@debian.org>' - 'Grigor Karavardanyan <k.gri...@yahoo.com>' + - 'James Raspass <jrasp...@gmail.com>' - 'Jason May <jason...@bestpractical.com>' - 'Jesse Vincent <je...@bestpractical.com>' - 'John Beppu <john.be...@gmail.com>' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/Makefile.PL new/WWW-Mechanize-2.02/Makefile.PL --- old/WWW-Mechanize-2.01/Makefile.PL 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/Makefile.PL 2020-10-13 15:50:41.000000000 +0200 @@ -64,10 +64,9 @@ "URI" => 0, "URI::Escape" => 0, "bytes" => 0, - "lib" => 0, - "vars" => 0 + "lib" => 0 }, - "VERSION" => "2.01", + "VERSION" => "2.02", "test" => { "TESTS" => "t/*.t t/local/*.t t/mech-dump/*.t" } @@ -117,7 +116,6 @@ "bytes" => 0, "lib" => 0, "strict" => 0, - "vars" => 0, "warnings" => 0 ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/README.md new/WWW-Mechanize-2.02/README.md --- old/WWW-Mechanize-2.01/README.md 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/README.md 2020-10-13 15:50:41.000000000 +0200 @@ -4,7 +4,7 @@ # VERSION -version 2.01 +version 2.02 # SYNOPSIS @@ -403,6 +403,15 @@ Returns the contents of the `<TITLE>` tag, as parsed by [HTML::HeadParser](https://metacpan.org/pod/HTML%3A%3AHeadParser). Returns undef if the content is not HTML. +## $mech->redirects() + +Convenience method to get the [redirects](https://metacpan.org/pod/HTTP%3A%3AResponse#r-redirects) from the most recent [HTTP::Response](https://metacpan.org/pod/HTTP%3A%3AResponse). + +Note that you can also use [is\_redirect](https://metacpan.org/pod/HTTP%3A%3AResponse#r-is_redirect) to see if the most recent response was a redirect like this. + + $mech->get($url); + do_stuff() if $mech->res->is_redirect; + # CONTENT-HANDLING METHODS ## $mech->content(...) @@ -449,6 +458,9 @@ ignored unless none of `raw | decoded_by_headers | charset` is specified and the text is HTML, in which case an error will be triggered. +A fresh instance of WWW::Mechanize will return `undef` when `$mech->content()` +is called, because no content is present before a request has been made. + ## $mech->text() Returns the text of the current HTML content. If the content isn't @@ -993,9 +1005,10 @@ ## $mech->click\_button( ... ) Has the effect of clicking a button on the current form by specifying -its name, value, or index. Its arguments are a list of key/value -pairs. Only one of name, number, input or value must be specified in -the keys. +its attributes. The arguments are a list of key/value pairs. Only one +of name, id, number, input or value must be specified in the keys. + +Dies if no button is found. - `name => name` @@ -1007,7 +1020,8 @@ - `number => n` - Clicks the _n_th button in the current form. Numbering starts at 1. + Clicks the _n_th button with type _submit_ in the current form. + Numbering starts at 1. - `value => value` @@ -1020,7 +1034,7 @@ $mech->current_form()->find_input( undef, 'submit' ) - $inputobject must belong to the current form. + `$inputobject` must belong to the current form. - `x => x` - `y => y` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/cpanfile new/WWW-Mechanize-2.02/cpanfile --- old/WWW-Mechanize-2.01/cpanfile 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/cpanfile 2020-10-13 15:50:41.000000000 +0200 @@ -47,7 +47,6 @@ requires "URI::Escape" => "0"; requires "bytes" => "0"; requires "lib" => "0"; - requires "vars" => "0"; }; on 'test' => sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/lib/WWW/Mechanize/Cookbook.pod new/WWW-Mechanize-2.02/lib/WWW/Mechanize/Cookbook.pod --- old/WWW-Mechanize-2.01/lib/WWW/Mechanize/Cookbook.pod 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/lib/WWW/Mechanize/Cookbook.pod 2020-10-13 15:50:41.000000000 +0200 @@ -13,7 +13,7 @@ =head1 VERSION -version 2.01 +version 2.02 =head1 INTRODUCTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/lib/WWW/Mechanize/Examples.pod new/WWW-Mechanize-2.02/lib/WWW/Mechanize/Examples.pod --- old/WWW-Mechanize-2.01/lib/WWW/Mechanize/Examples.pod 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/lib/WWW/Mechanize/Examples.pod 2020-10-13 15:50:41.000000000 +0200 @@ -13,7 +13,7 @@ =head1 VERSION -version 2.01 +version 2.02 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/lib/WWW/Mechanize/FAQ.pod new/WWW-Mechanize-2.02/lib/WWW/Mechanize/FAQ.pod --- old/WWW-Mechanize-2.01/lib/WWW/Mechanize/FAQ.pod 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/lib/WWW/Mechanize/FAQ.pod 2020-10-13 15:50:41.000000000 +0200 @@ -13,7 +13,7 @@ =head1 VERSION -version 2.01 +version 2.02 =head1 How to get help with WWW::Mechanize diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/lib/WWW/Mechanize/Image.pm new/WWW-Mechanize-2.02/lib/WWW/Mechanize/Image.pm --- old/WWW-Mechanize-2.01/lib/WWW/Mechanize/Image.pm 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/lib/WWW/Mechanize/Image.pm 2020-10-13 15:50:41.000000000 +0200 @@ -3,7 +3,7 @@ use strict; use warnings; -our $VERSION = '2.01'; +our $VERSION = '2.02'; #ABSTRACT: Image object for WWW::Mechanize @@ -69,7 +69,7 @@ =head1 VERSION -version 2.01 +version 2.02 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/lib/WWW/Mechanize/Link.pm new/WWW-Mechanize-2.02/lib/WWW/Mechanize/Link.pm --- old/WWW-Mechanize-2.01/lib/WWW/Mechanize/Link.pm 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/lib/WWW/Mechanize/Link.pm 2020-10-13 15:50:41.000000000 +0200 @@ -3,7 +3,7 @@ use strict; use warnings; -our $VERSION = '2.01'; +our $VERSION = '2.02'; #ABSTRACT: Link object for WWW::Mechanize @@ -65,7 +65,7 @@ =head1 VERSION -version 2.01 +version 2.02 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/lib/WWW/Mechanize.pm new/WWW-Mechanize-2.02/lib/WWW/Mechanize.pm --- old/WWW-Mechanize-2.01/lib/WWW/Mechanize.pm 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/lib/WWW/Mechanize.pm 2020-10-13 15:50:41.000000000 +0200 @@ -6,7 +6,7 @@ use strict; use warnings; -our $VERSION = '2.01'; +our $VERSION = '2.02'; use Tie::RefHash; use HTTP::Request 1.30; @@ -288,6 +288,13 @@ } +sub redirects { + my $self = shift; + + return $self->response->redirects; +} + + sub content { my $self = shift; my %params = @_; @@ -985,6 +992,7 @@ $request = $input->click( $form, $args{x}, $args{y} ); } elsif ( $args{number} ) { + # changing this 'submit' to qw/submit button image/ will probably break people's code my $input = $form->find_input( undef, 'submit', $args{number} ); $request = $input->click( $form, $args{x}, $args{y} ); } @@ -992,14 +1000,13 @@ $request = $args{input}->click( $form, $args{x}, $args{y} ); } elsif ( $args{value} ) { - my $i = 1; - while ( my $input = $form->find_input(undef, 'submit', $i) ) { - if ( $args{value} && ($args{value} eq $input->value) ) { + my @inputs = map { $form->find_input(undef, $_) } qw/submit button image/; + foreach my $input ( @inputs ) { + if ( $input->value && ($args{value} eq $input->value) ) { $request = $input->click( $form, $args{x}, $args{y} ); last; } - $i++; - } # while + } # foreach } # $args{value} return $self->request( $request ); @@ -1762,7 +1769,7 @@ =head1 VERSION -version 2.01 +version 2.02 =head1 SYNOPSIS @@ -2202,6 +2209,15 @@ Returns the contents of the C<< <TITLE> >> tag, as parsed by L<HTML::HeadParser>. Returns undef if the content is not HTML. +=head2 $mech->redirects() + +Convenience method to get the L<< redirects|HTTP::Response/$r->redirects >> from the most recent L<HTTP::Response>. + +Note that you can also use L<< is_redirect|HTTP::Response/$r->is_redirect >> to see if the most recent response was a redirect like this. + + $mech->get($url); + do_stuff() if $mech->res->is_redirect; + =head1 CONTENT-HANDLING METHODS =head2 $mech->content(...) @@ -2252,6 +2268,9 @@ ignored unless none of C<< raw | decoded_by_headers | charset >> is specified and the text is HTML, in which case an error will be triggered. +A fresh instance of WWW::Mechanize will return C<undef> when C<< $mech->content() >> +is called, because no content is present before a request has been made. + =head2 $mech->text() Returns the text of the current HTML content. If the content isn't @@ -2817,9 +2836,10 @@ =head2 $mech->click_button( ... ) Has the effect of clicking a button on the current form by specifying -its name, value, or index. Its arguments are a list of key/value -pairs. Only one of name, number, input or value must be specified in -the keys. +its attributes. The arguments are a list of key/value pairs. Only one +of name, id, number, input or value must be specified in the keys. + +Dies if no button is found. =over 4 @@ -2833,7 +2853,8 @@ =item * C<< number => n >> -Clicks the I<n>th button in the current form. Numbering starts at 1. +Clicks the I<n>th button with type I<submit> in the current form. +Numbering starts at 1. =item * C<< value => value >> @@ -2846,7 +2867,7 @@ $mech->current_form()->find_input( undef, 'submit' ) -$inputobject must belong to the current form. +C<$inputobject> must belong to the current form. =item * C<< x => x >> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/script/mech-dump new/WWW-Mechanize-2.02/script/mech-dump --- old/WWW-Mechanize-2.01/script/mech-dump 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/script/mech-dump 2020-10-13 15:50:41.000000000 +0200 @@ -131,7 +131,7 @@ =head1 VERSION -version 2.01 +version 2.02 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/00-report-prereqs.dd new/WWW-Mechanize-2.02/t/00-report-prereqs.dd --- old/WWW-Mechanize-2.01/t/00-report-prereqs.dd 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/00-report-prereqs.dd 2020-10-13 15:50:41.000000000 +0200 @@ -89,8 +89,7 @@ 'URI' => '0', 'URI::Escape' => '0', 'bytes' => '0', - 'lib' => '0', - 'vars' => '0' + 'lib' => '0' } } }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/content.t new/WWW-Mechanize-2.02/t/content.t --- old/WWW-Mechanize-2.01/t/content.t 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/content.t 2020-10-13 15:50:41.000000000 +0200 @@ -1,6 +1,6 @@ use warnings; use strict; -use Test::More tests => 8; +use Test::More tests => 9; =head1 NAME @@ -33,6 +33,9 @@ # Well actually there is no base (and therefore it does not belong to us # :-), so let's kludge a bit. $mech->{base} = 'http://example.com/'; + +is($mech->content, undef, 'content starts out as undef'); + $mech->update_html($html); =head2 $mech->content(format => "text") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/dump.t new/WWW-Mechanize-2.02/t/dump.t --- old/WWW-Mechanize-2.01/t/dump.t 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/dump.t 2020-10-13 15:50:41.000000000 +0200 @@ -2,7 +2,7 @@ use warnings; use strict; -use Test::More 0.96 tests => 6; +use Test::More 0.96 tests => 7; use Test::Output; use URI::file; use File::Temp qw/tempdir/; @@ -109,6 +109,32 @@ x= (text) submit=Submit (submit) +POST https://localhost + 5a= (hidden readonly) + 5b=value (hidden readonly) + 5c= (hidden readonly) + 5d=foo (hidden readonly) + 5e=value (hidden readonly) + +EXPECTED +}; + +subtest "dump_forms multiselect", sub { + dump_tests('dump_forms', 't/form_133_regression.html', <<'EXPECTED'); +GET http://localhost/ + select1=1 (option) [*1|2|3|4] + select2=1 (option) [*1|2|3|4] + select3=1 (option) [*1|2|3|4] + select4=1 (option) [*1|2|3|4] + multiselect1=<UNDEF> (option) [*<UNDEF>/off|1] + multiselect1=<UNDEF> (option) [*<UNDEF>/off|2] + multiselect1=<UNDEF> (option) [*<UNDEF>/off|3] + multiselect1=<UNDEF> (option) [*<UNDEF>/off|4] + multiselect2=<UNDEF> (option) [*<UNDEF>/off|1] + multiselect2=<UNDEF> (option) [*<UNDEF>/off|2] + multiselect2=<UNDEF> (option) [*<UNDEF>/off|3] + multiselect2=<UNDEF> (option) [*<UNDEF>/off|4] + EXPECTED }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/field.html new/WWW-Mechanize-2.02/t/field.html --- old/WWW-Mechanize-2.01/t/field.html 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/field.html 2020-10-13 15:50:41.000000000 +0200 @@ -9,6 +9,10 @@ <INPUT TYPE="radio" NAME="wango" VALUE="wango!"> <INPUT TYPE="radio" NAME="wango" VALUE="wongo!"> <INPUT TYPE="text" NAME="dingo" VALUE="dingo2"> +<input type="hidden" name="__no_value"> +<input type="hidden" name="__value" value> +<input type="hidden" name="__value_empty" value=""> +<input type="hidden" name="__value_full" value="full"> </FORM> </BODY> </HTML> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/field.t new/WWW-Mechanize-2.02/t/field.t --- old/WWW-Mechanize-2.01/t/field.t 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/field.t 2020-10-13 15:50:41.000000000 +0200 @@ -2,7 +2,7 @@ use warnings; use strict; -use Test::More tests => 8; +use Test::More tests => 14; use URI::file; BEGIN { @@ -28,3 +28,18 @@ $mech->set_visible( [ radio => 'wongo!' ], 'boingo' ); is( $mech->value( 'wango' ), 'wongo!', 'wango changed' ); is( $mech->value( 'dingo', 2 ), 'boingo', 'dingo changed' ); + +for my $name (qw/__no_value __value_empty/) { + ok( ! $mech->value( $name ), "$name is empty" ) or diag $mech->field($name); + $mech->field( $name, 'foo'); + is( $mech->value( $name ), 'foo', "$name changed" ); +} + +for my $name (qw/__value/) { + TODO: { + local $TODO = 'HTML::TokeParser does not understand how to parse this and returns a value where it should not have one'; + ok( ! $mech->value( $name ), "$name is empty" ) or diag $mech->field($name); + } + $mech->field( $name, 'foo'); + is( $mech->value( $name ), 'foo', "$name changed" ); +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/find_inputs.html new/WWW-Mechanize-2.02/t/find_inputs.html --- old/WWW-Mechanize-2.01/t/find_inputs.html 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/find_inputs.html 2020-10-13 15:50:41.000000000 +0200 @@ -4,7 +4,7 @@ <form action="http://localhost/" method="post" enctype="multipart/form-data" name="1st_form"> <input type="text" name="1a" /> <input type="IMAGE" name="submit1" value="Submit" label="Submit" /> - <input type="submit" name="submit2" value="Submit" label="Submit" /> + <button type="submit" name="submit2" value="Submit" label="Submit" /> </form> <form action="http://localhost/" method="post" name="2nd_form"> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/form_133_regression.html new/WWW-Mechanize-2.02/t/form_133_regression.html --- old/WWW-Mechanize-2.01/t/form_133_regression.html 1970-01-01 01:00:00.000000000 +0100 +++ new/WWW-Mechanize-2.02/t/form_133_regression.html 2020-10-13 15:50:41.000000000 +0200 @@ -0,0 +1,45 @@ +<html> + <head> + <title>Test Page</title> + </head> + <body> + <form action="http://localhost/" method="GET"> + <select type="select" name="select1"> + <option value="1"></option> + <option value="2"></option> + <option value="3"></option> + <option value="4"></option> + </select> + <select type="select" name="select2"> + <option value="1"></option> + <option value="2"></option> + <option value="3"></option> + <option value="4"></option> + </select> + <select type="select" name="select3"> + <option value="1"></option> + <option value="2"></option> + <option value="3"></option> + <option value="4"></option> + </select> + <select type="select" name="select4"> + <option value="1"></option> + <option value="2"></option> + <option value="3"></option> + <option value="4"></option> + </select> + <select type="select" name="multiselect1" multiple="multiple"> + <option value="1"></option> + <option value="2"></option> + <option value="3"></option> + <option value="4"></option> + </select> + <select type="select" name="multiselect2" multiple="multiple"> + <option value="1"></option> + <option value="2"></option> + <option value="3"></option> + <option value="4"></option> + </select> + </form> + </body> +</html> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/form_with_fields.html new/WWW-Mechanize-2.02/t/form_with_fields.html --- old/WWW-Mechanize-2.01/t/form_with_fields.html 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/form_with_fields.html 2020-10-13 15:50:41.000000000 +0200 @@ -40,4 +40,12 @@ <input type="Submit" name="submit" value="Submit" label="Submit" /> </form> +<form action="https://localhost" method="post"> + <input type="hidden" name="5a" /> + <input type="hidden" name="5b" value /> + <input type="hidden" name="5c" value="" /> + <input type="hidden" name="5d" value="foo" /> + <input type="hidden" name="5e" value="value" /> +</form> + </body> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/google.html new/WWW-Mechanize-2.02/t/google.html --- old/WWW-Mechanize-2.01/t/google.html 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/google.html 2020-10-13 15:50:41.000000000 +0200 @@ -10,5 +10,5 @@ // --> </script> </head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onLoad=sf()><center><table border=0 cellspacing=0 cellpadding=0><tr><td><img src="/images/logo.gif" width=276 height=110 alt="Google"></td></tr></table><br> -<table border=0 cellspacing=0 cellpadding=0><tr><td width=15> </td><td id=0 bgcolor=#3366cc align=center width=95 nowrap><font color=#ffffff size=-1><b>Web</b></font></td><td width=15> </td><td id=1 bgcolor=#efefef align=center width=95 nowrap onClick="" style=cursor:pointer;cursor:hand;><a id=1a class=q href="/imghp?hl=en&tab=wi&ie=UTF-8"><font size=-1>Images</font></a></td><td width=15> </td><td id=2 bgcolor=#efefef align=center width=95 nowrap onClick="" style=cursor:pointer;cursor:hand;><a id=2a class=q href="/grphp?hl=en&tab=wg&ie=UTF-8"><font size=-1>Groups</font></a></td><td width=15> </td><td id=3 bgcolor=#efefef align=center width=95 nowrap onClick="" style=cursor:pointer;cursor:hand;><a id=3a class=q href="/dirhp?hl=en&tab=wd&ie=UTF-8"><font size=-1>Directory</font></a></td><td width=15> </td><td id=4 bgcolor=#efefef align=center width=95 nowrap onClick="" style=cursor:pointer;cursor:hand;><a id=4a class=q href="/nwshp?hl=en&tab=wn&ie=UTF-8"><font size=-1>News</font></a></td><td width=15> </td></tr><tr><td colspan=12 bgcolor=#3366cc><img width=1 height=1 alt=""></td></tr></table><br><form action="/target-page" name="bob-the-form"><table cellspacing=0 cellpadding=0><tr><td width=75> </td><td align=center><input type=hidden name=hl value=en><span id=hf></span><input type=hidden name=ie value="ISO-8859-1"><input maxLength=256 size=55 name=q value=""><br><input type=submit value="Google Search" name=btnG><input type=submit value="I'm Feeling Lucky" name=btnI></td><td valign=top nowrap><font size=-2> • <a href=/advanced_search?hl=en>Advanced Search</a><br> • <a href=/preferences?hl=en>Preferences</a><br> • <a href=/language_tools?hl=en>Language Tools</a></font></td></tr></table></form><br><p><font size=-1>Want more from Google? Try these <a href="/tour/services/query.html">expert search tips</a></font><p> +<table border=0 cellspacing=0 cellpadding=0><tr><td width=15> </td><td id=0 bgcolor=#3366cc align=center width=95 nowrap><font color=#ffffff size=-1><b>Web</b></font></td><td width=15> </td><td id=1 bgcolor=#efefef align=center width=95 nowrap onClick="" style=cursor:pointer;cursor:hand;><a id=1a class=q href="/imghp?hl=en&tab=wi&ie=UTF-8"><font size=-1>Images</font></a></td><td width=15> </td><td id=2 bgcolor=#efefef align=center width=95 nowrap onClick="" style=cursor:pointer;cursor:hand;><a id=2a class=q href="/grphp?hl=en&tab=wg&ie=UTF-8"><font size=-1>Groups</font></a></td><td width=15> </td><td id=3 bgcolor=#efefef align=center width=95 nowrap onClick="" style=cursor:pointer;cursor:hand;><a id=3a class=q href="/dirhp?hl=en&tab=wd&ie=UTF-8"><font size=-1>Directory</font></a></td><td width=15> </td><td id=4 bgcolor=#efefef align=center width=95 nowrap onClick="" style=cursor:pointer;cursor:hand;><a id=4a class=q href="/nwshp?hl=en&tab=wn&ie=UTF-8"><font size=-1>News</font></a></td><td width=15> </td></tr><tr><td colspan=12 bgcolor=#3366cc><img width=1 height=1 alt=""></td></tr></table><br><form action="/target-page" name="bob-the-form"><table cellspacing=0 cellpadding=0><tr><td width=75> </td><td align=center><input type=hidden name=hl value=en><span id=hf></span><input type=hidden name=ie value="ISO-8859-1"><input type=hidden name=notgoogle value=""><input maxLength=256 size=55 name=q value=""><br><input type=submit value="Google Search" name=btnG><input type=submit value="I'm Feeling Lucky" name=btnI></td><td valign=top nowrap><font size=-2> • <a href=/advanced_search?hl=en>Advanced Search</a><br> • <a href=/preferences?hl=en>Preferences</a><br> • <a href=/language_tools?hl=en>Language Tools</a></font></td></tr></table></form><br><p><font size=-1>Want more from Google? Try these <a href="/tour/services/query.html">expert search tips</a></font><p> <br><font size=-1><a href="/ads/">Advertise with Us</a> - <a href="/services/">Business Solutions</a> - <a href="/options/">Services & Tools</a> - <a href=/about.html>Jobs, Press, & Help</a></font><p><font size=-2>©2003 Google - Searching 3,083,324,652 web pages</font></p></center></body></html> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/local/LocalServer.pm new/WWW-Mechanize-2.02/t/local/LocalServer.pm --- old/WWW-Mechanize-2.01/t/local/LocalServer.pm 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/local/LocalServer.pm 2020-10-13 15:50:41.000000000 +0200 @@ -235,8 +235,7 @@ =cut -use vars qw(%urls); -%urls = ( +my %urls = ( 'quit_server' => 'quit_server', 'get_server_log' => 'get_server_log', 'redirect' => 'redirect/%s', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/local/click_button.t new/WWW-Mechanize-2.02/t/local/click_button.t --- old/WWW-Mechanize-2.01/t/local/click_button.t 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/local/click_button.t 2020-10-13 15:50:41.000000000 +0200 @@ -39,7 +39,7 @@ $mech->click_button(number => 1); test_click( $mech ); - ok(! eval { $mech->click_button(number => 2); 1 }, 'Button number out of range'); + ok(! eval { $mech->click_button(number => 3); 1 }, 'Button number out of range'); }; subtest 'click by name' => sub { @@ -50,6 +50,33 @@ 'Button name unknown'); }; +subtest 'click a <button> tag' => sub { + $mech->click_button(name => 'button_tag'); + test_click( $mech, 'button_tag', 'Walk' ); +}; + +subtest 'click by value' => sub { + # input tag + $mech->click_button(value => 'Go'); + test_click( $mech ); + + # button tag + $mech->click_button(value => 'Walk'); + test_click( $mech, 'button_tag', 'Walk' ); + + # image type + $mech->click_button(value => 'image'); + { + like( $mech->uri, qr/formsubmit/, 'Clicking on button' ); + like( $mech->uri, qr/image_input\.x=1/, 'Correct button was pressed' ); + like( $mech->uri, qr/cat_foo/, 'Parameters got transmitted OK' ); + unlike( $mech->uri, qr/Go/, 'Submit button was not transmitted' ); + } + + ok(! eval { $mech->click_button(value => 'bogus'); 1 }, + 'Button name unknown'); +}; + CLICK_BY_OBJECT_REFERENCE: { subtest 'click by object reference' => sub { my $clicky_button = $form->find_input( undef, 'submit' ); @@ -65,9 +92,11 @@ sub test_click { my $mech = shift; + my $name = shift || 'submit'; + my $value = shift || 'Go'; like( $mech->uri, qr/formsubmit/, 'Clicking on button' ); - like( $mech->uri, qr/submit=Go/, 'Correct button was pressed' ); - like( $mech->uri, qr/cat_foo/, 'Parameters got transmitted OK' ); + like( $mech->uri, qr/$name=$value/, 'Correct button was pressed' ); + like( $mech->uri, qr/cat_foo/, 'Parameters got transmitted OK' ); $mech->back; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/local/get.t new/WWW-Mechanize-2.02/t/local/get.t --- old/WWW-Mechanize-2.01/t/local/get.t 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/local/get.t 2020-10-13 15:50:41.000000000 +0200 @@ -1,6 +1,6 @@ use warnings; use strict; -use Test::More tests => 32; +use Test::More tests => 34; use lib qw( t t/local ); use LocalServer; @@ -69,3 +69,9 @@ memory_cycle_ok( $agent, 'Mech: no cycles' ); } + +$agent->get('/foo/'); +ok( ! $agent->redirects, 'redirects is false before we have a redirect'); +$agent->get($server->redirect('/foo/')); +is( scalar $agent->redirects, 1, 'redirects picks up a redirect'); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/local/log-server new/WWW-Mechanize-2.02/t/local/log-server --- old/WWW-Mechanize-2.01/t/local/log-server 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/local/log-server 2020-10-13 15:50:41.000000000 +0200 @@ -178,6 +178,8 @@ <input type="checkbox" name="cat" value="cat_bar" %s /> <input type="checkbox" name="cat" value="cat_baz" %s /> <input type="file" name="upload" value="README" /> + <button type="submit" name="button_tag" value="Walk" /> + <input type="image" name="image_input" value="image" /> </form> <form id="pounder" action="/formsubmit" class="test" foo=""> <input type="text" name="query" value="%s"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/local/select_multiple.t new/WWW-Mechanize-2.02/t/local/select_multiple.t --- old/WWW-Mechanize-2.01/t/local/select_multiple.t 1970-01-01 01:00:00.000000000 +0100 +++ new/WWW-Mechanize-2.02/t/local/select_multiple.t 2020-10-13 15:50:41.000000000 +0200 @@ -0,0 +1,114 @@ +use warnings; +use strict; +use Test::More; + +use lib 't/local'; +use LocalServer; + +BEGIN { + use_ok( 'WWW::Mechanize' ); + delete @ENV{ qw( http_proxy HTTP_PROXY ) }; + delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) }; + +} + +my $mech = WWW::Mechanize->new(cookie_jar => {}); +isa_ok( $mech, "WWW::Mechanize" ); +ok(defined($mech->cookie_jar()), + 'this $mech starts with a cookie jar'); + +my $html = <<'HTML'; +<html> +<head><title>%s</title></head> +<body>Whatever. + <form action="foo.thing"> + <select name="chanId" MULTIPLE> + <option value="130" selected>Anime Network</option> + <option value="119" >COM 250</option> + </select> + </form> +</body> +</html> +HTML + +my $server = LocalServer->spawn( html => $html ); +isa_ok( $server, "LocalServer" ); + +$mech->get($server->url); +ok( $mech->success, 'Fetched OK' ); + +eval { + $mech->submit_form( + form_number => 1, + fields => { + chanId => 119, + } + ); +}; +is( $@, '', 'submit_form, second value' ); +like( $mech->uri, qr/chanId=119/, '... and the second value was set'); + +eval { + $mech->form_number(1); + $mech->set_fields( + chanId => 119, + ); +}; +is( $@, '', 'set_fields, second value' ); +like( $mech->uri, qr/chanId=119/, '... and the second value was set'); + + +eval { + $mech->submit_form( + form_number => 1, + fields => { + chanId => [119], + } + ); +}; +is( $@, '', 'submit_form, second value as array' ); +like( $mech->uri, qr/chanId=119/, '... and the second value was set'); + + +eval { + $mech->form_number(1); + $mech->field( + chanId => 119, + ); + $mech->submit; +}; +is( $@, '', 'field, second value' ); +like( $mech->uri, qr/chanId=119/, '... and the second value was set'); + + +eval { + $mech->form_number(1); + $mech->field( + chanId => [119], + ); + $mech->submit; +}; +is( $@, '', 'field, second value as array' ); +like( $mech->uri, qr/chanId=119/, '... and the second value was set'); + + +eval { + $mech->submit_form( + form_number => 1, + fields => { + chanId => 130, + } + ); +}; +is( $@, '', 'submit_form, first value' ); +like( $mech->uri, qr/chanId=130/, '... and the first value was set'); + + +SKIP: { + eval "use Test::Memory::Cycle"; + skip "Test::Memory::Cycle not installed", 1 if $@; + + memory_cycle_ok( $mech, "No memory cycles found" ); +} + +done_testing; \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/t/mech-dump/mech-dump.t new/WWW-Mechanize-2.02/t/mech-dump/mech-dump.t --- old/WWW-Mechanize-2.01/t/mech-dump/mech-dump.t 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/t/mech-dump/mech-dump.t 2020-10-13 15:50:41.000000000 +0200 @@ -35,6 +35,7 @@ GET file:/target-page [bob-the-form] hl=en (hidden) ie=ISO-8859-1 (hidden) + notgoogle= (hidden readonly) q= btnG=Google Search (submit) btnI=I'm Feeling Lucky (submit) @@ -62,6 +63,7 @@ GET file:/target-page [bob-the-form] hl=en (hidden readonly) ie=ISO-8859-1 (hidden readonly) + notgoogle= (hidden readonly) q= (text) btnG=Google Search (submit) btnI=I'm Feeling Lucky (submit) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WWW-Mechanize-2.01/xt/author/eol.t new/WWW-Mechanize-2.02/xt/author/eol.t --- old/WWW-Mechanize-2.01/xt/author/eol.t 2020-09-18 19:51:23.000000000 +0200 +++ new/WWW-Mechanize-2.02/xt/author/eol.t 2020-10-13 15:50:41.000000000 +0200 @@ -47,6 +47,7 @@ 't/find_link_xhtml.html', 't/find_link_xhtml.t', 't/form-parsing.t', + 't/form_133_regression.html', 't/form_with_fields.html', 't/form_with_fields.t', 't/form_with_fields_passthrough_params.t', @@ -84,6 +85,7 @@ 't/local/referer-server', 't/local/referer.t', 't/local/reload.t', + 't/local/select_multiple.t', 't/local/submit.t', 't/mech-dump/mech-dump.t', 't/new.t',