r59996 - in /trunk/libwww-mechanize-perl: ./ bin/ debian/ debian/patches/ lib/WWW/ lib/WWW/Mechanize/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sat Jul 3 03:39:20 UTC 2010


Author: ansgar-guest
Date: Sat Jul  3 03:39:03 2010
New Revision: 59996

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59996
Log:
* New upstream release.
  + This release has changes that might break older code.
    Refer to the upstream changelog for more details.
* debian/copyright: Now licensed under Artistic-2.0 or GPL-1+.
* Drop patches adding_pod_see_also.patch, spelling.patch: Applied upstream.
* Bump Standards-Version to 3.9.0.

Added:
    trunk/libwww-mechanize-perl/debian/NEWS
Removed:
    trunk/libwww-mechanize-perl/debian/patches/adding_pod_see_also.patch
    trunk/libwww-mechanize-perl/debian/patches/spelling.patch
Modified:
    trunk/libwww-mechanize-perl/Changes
    trunk/libwww-mechanize-perl/META.yml
    trunk/libwww-mechanize-perl/bin/mech-dump
    trunk/libwww-mechanize-perl/debian/changelog
    trunk/libwww-mechanize-perl/debian/control
    trunk/libwww-mechanize-perl/debian/copyright
    trunk/libwww-mechanize-perl/debian/patches/series
    trunk/libwww-mechanize-perl/lib/WWW/Mechanize.pm
    trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Cookbook.pod
    trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Examples.pod
    trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Image.pm
    trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Link.pm

Modified: trunk/libwww-mechanize-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/Changes?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/Changes (original)
+++ trunk/libwww-mechanize-perl/Changes Sat Jul  3 03:39:03 2010
@@ -8,7 +8,32 @@
 Mech now has its own mailing list at Google Groups:
 http://groups.google.com/group/www-mechanize-users
 
-NEXT        Sat Apr 10 23:10:07 CDT 2010
+
+1.64        Thu Jul  1 10:41:00 CDT 2010
+========================================
+[THINGS THAT MAY BREAK YOUR CODE]
+If you've been accessing $mech->{forms} or $mech->{form} values
+directly, instead of going through the $mech->forms or $mech->current_form
+accessors, respectively, then this version of Mech will break your
+code.
+
+[ENHANCEMENTS]
+Parsing of forms has been delayed until they're actually needed.
+If don't use forms on a page, you'll no longer waste time and memory
+parsing them.
+
+$mech->title now caches the title of the page after parsing the
+page to find it.
+
+mech-dump now takes a --cookie-file parameter for keeping cookies
+between calls.
+
+
+[DOCUMENTATION]
+Typo fixes.
+
+
+1.62        Sat Apr 10 23:10:07 CDT 2010
 ========================================
 [FIXED]
 Fixed a declaration in the Movable Type example in

Modified: trunk/libwww-mechanize-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/META.yml?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/META.yml (original)
+++ trunk/libwww-mechanize-perl/META.yml Sat Jul  3 03:39:03 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               WWW-Mechanize
-version:            1.62
+version:            1.64
 abstract:           Handy web browsing in a Perl object
 author:
     - Andy Lester <andy at petdance.com>

Modified: trunk/libwww-mechanize-perl/bin/mech-dump
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/bin/mech-dump?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/bin/mech-dump (original)
+++ trunk/libwww-mechanize-perl/bin/mech-dump Sat Jul  3 03:39:03 2010
@@ -8,10 +8,11 @@
 
 use warnings;
 use strict;
-use WWW::Mechanize;
+use WWW::Mechanize ();
 use Getopt::Long;
 use Pod::Usage;
 
+use HTTP::Cookies;
 my @actions;
 my $absolute;
 
@@ -19,6 +20,7 @@
 my $pass;
 my $agent;
 my $agent_alias;
+my $cookie_filename;
 
 GetOptions(
     'user=s'        => \$user,
@@ -31,6 +33,7 @@
     absolute        => \$absolute,
     'agent=s'       => \$agent,
     'agent-alias=s' => \$agent_alias,
+    'cookie-file=s' => \$cookie_filename,
     help            => sub { pod2usage(1); },
 ) or pod2usage(2);
 
@@ -40,28 +43,29 @@
 
 Options:
 
-    --headers       Dump HTTP response headers
-    --forms         Dump table of forms (default action)
-    --links         Dump table of links
-    --images        Dump table of images
-    --all           Dump all four of the above, in that order
+    --headers              Dump HTTP response headers
+    --forms                Dump table of forms (default action)
+    --links                Dump table of links
+    --images               Dump table of images
+    --all                  Dump all four of the above, in that order
 
-    --user=user     Set the username
-    --password=pass Set the password
+    --user=user            Set the username
+    --password=pass        Set the password
+    --cookie-file=filename Set the filename to use for persistent cookies
 
-    --agent=agent   Specify the UserAgent to pass
+    --agent=agent          Specify the UserAgent to pass
     --agent-alias=alias
-                    Specify the alias for the UserAgent to pass.
-                    Pick one of:
-                        * Windows IE 6
-                        * Windows Mozilla
-                        * Mac Safari
-                        * Mac Mozilla
-                        * Linux Mozilla
-                        * Linux Konqueror
+                           Specify the alias for the UserAgent to pass.
+                           Pick one of:
+                               * Windows IE 6
+                               * Windows Mozilla
+                               * Mac Safari
+                               * Mac Mozilla
+                               * Linux Mozilla
+                               * Linux Konqueror
 
-    --absolute      Show URLs as absolute, even if relative in the page
-    --help          Show this message
+    --absolute             Show URLs as absolute, even if relative in the page
+    --help                 Show this message
 
 The order of the options specified is relevant.  Repeated options
 get repeated dumps.
@@ -76,13 +80,22 @@
 
 @actions = (\&dump_forms) unless @actions;
 
-my $mech = WWW::Mechanize->new( cookie_jar => undef );
+my $mech = WWW::Mechanize->new();
 if ( defined $agent ) {
     $mech->agent( $agent );
 }
 elsif ( defined $agent_alias ) {
     $mech->agent_alias( $agent_alias );
 }
+if ( defined $cookie_filename ) {
+    my $cookies = HTTP::Cookies->new( file => $cookie_filename, autosave => 1, ignore_discard => 1 );
+    $cookies->load() ;
+    $mech->cookie_jar($cookies);
+}
+else {
+    $mech->cookie_jar(undef) ;
+}
+
 $mech->env_proxy();
 my $response = $mech->get( $uri );
 if (!$response->is_success and defined ($response->www_authenticate)) {
@@ -124,3 +137,7 @@
     $mech->dump_images( undef, $absolute );
     return;
 }
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>

Added: trunk/libwww-mechanize-perl/debian/NEWS
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/debian/NEWS?rev=59996&op=file
==============================================================================
--- trunk/libwww-mechanize-perl/debian/NEWS (added)
+++ trunk/libwww-mechanize-perl/debian/NEWS Sat Jul  3 03:39:03 2010
@@ -1,0 +1,13 @@
+libwww-mechanize-perl (1.64-1) unstable; urgency=low
+
+  This release introduces changes that might break applications.  From the
+  upstream changelog:
+
+    [THINGS THAT MAY BREAK YOUR CODE]
+    If you've been accessing $mech->{forms} or $mech->{form} values directly,
+    instead of going through the $mech->forms or $mech->current_form
+    accessors, respectively, then this version of Mech will break your code.
+  
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Sat, 03 Jul 2010 12:26:25 +0900
+

Modified: trunk/libwww-mechanize-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/debian/changelog?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/debian/changelog (original)
+++ trunk/libwww-mechanize-perl/debian/changelog Sat Jul  3 03:39:03 2010
@@ -1,3 +1,14 @@
+libwww-mechanize-perl (1.64-1) unstable; urgency=low
+
+  * New upstream release.
+    + This release has changes that might break older code.
+      Refer to the upstream changelog for more details.
+  * debian/copyright: Now licensed under Artistic-2.0 or GPL-1+.
+  * Drop patches adding_pod_see_also.patch, spelling.patch: Applied upstream.
+  * Bump Standards-Version to 3.9.0.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Sat, 03 Jul 2010 12:27:53 +0900
+
 libwww-mechanize-perl (1.62-1) unstable; urgency=low
 
   [ Ryan Niebur ]

Modified: trunk/libwww-mechanize-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/debian/control?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/debian/control (original)
+++ trunk/libwww-mechanize-perl/debian/control Sat Jul  3 03:39:03 2010
@@ -12,7 +12,7 @@
  netbase, libtest-exception-perl, libtest-warn-perl (>= 0.11), libtest-taint-perl,
  libhttp-server-simple-perl (>= 0.35), libtest-pod-coverage-perl,
  libtest-memory-cycle-perl, libtest-nowarnings-perl
-Standards-Version: 3.8.4
+Standards-Version: 3.9.0
 Homepage: http://search.cpan.org/dist/WWW-Mechanize/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libwww-mechanize-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libwww-mechanize-perl/

Modified: trunk/libwww-mechanize-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/debian/copyright?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/debian/copyright (original)
+++ trunk/libwww-mechanize-perl/debian/copyright Sat Jul  3 03:39:03 2010
@@ -4,7 +4,7 @@
 Name: WWWW-Mechanize
 
 Copyright: 2004-2010, Andy Lester. All rights reserved.
-License: Artistic or GPL-1+
+License: Artistic-2.0 or GPL-1+
 
 Files: t/local/LocalServer.pm
 Copyright: 2003, Max Maischein <corion at cpan.org>
@@ -18,6 +18,197 @@
  2007-2009 gregor herrmann <gregoa at debian.org>
 License: Artistic or GPL-1+
 
+License: Artistic-2.0
+ Copyright (c) 2000-2006, The Perl Foundation.
+ .
+ Everyone is permitted to copy and distribute verbatim copies of this
+ license document, but changing it is not allowed.
+ .
+ Preamble
+ .
+ This license establishes the terms under which a given free software
+ Package may be copied, modified, distributed, and/or redistributed.
+ The intent is that the Copyright Holder maintains some artistic
+ control over the development of that Package while still keeping the
+ Package available as open source and free software.
+ .
+ You are always permitted to make arrangements wholly outside of this
+ license directly with the Copyright Holder of a given Package. If the
+ terms of this license do not permit the full use that you propose to
+ make of the Package, you should contact the Copyright Holder and seek
+ a different licensing arrangement.
+ .
+ Definitions
+ .
+ "Copyright Holder" means the individual(s) or organization(s) named in
+ the copyright notice for the entire Package.
+ .
+ "Contributor" means any party that has contributed code or other
+ material to the Package, in accordance with the Copyright Holder's
+ procedures.
+ .
+ "You" and "your" means any person who would like to copy, distribute,
+ or modify the Package.
+ .
+ "Package" means the collection of files distributed by the Copyright
+ Holder, and derivatives of that collection and/or of those files. A
+ given Package may consist of either the Standard Version, or a
+ Modified Version.
+ .
+ "Distribute" means providing a copy of the Package or making it
+ accessible to anyone else, or in the case of a company or
+ organization, to others outside of your company or organization.
+ .
+ "Distributor Fee" means any fee that you charge for Distributing this
+ Package or providing support for this Package to another party. It
+ does not mean licensing fees.
+ .
+ "Standard Version" refers to the Package if it has not been modified,
+ or has been modified only in ways explicitly requested by the
+ Copyright Holder.
+ .
+ "Modified Version" means the Package, if it has been changed, and such
+ changes were not explicitly requested by the Copyright Holder.
+ .
+ "Original License" means this Artistic License as Distributed with the
+ Standard Version of the Package, in its current version or as it may
+ be modified by The Perl Foundation in the future.
+ .
+ "Source" form means the source code, documentation source, and
+ configuration files for the Package.
+ .
+ "Compiled" form means the compiled bytecode, object code, binary, or
+ any other form resulting from mechanical transformation or translation
+ of the Source form.
+ .
+ Permission for Use and Modification Without Distribution
+ .
+ (1) You are permitted to use the Standard Version and create and use
+     Modified Versions for any purpose without restriction, provided
+     that you do not Distribute the Modified Version.
+ .
+ Permissions for Redistribution of the Standard Version
+ .
+ (2) You may Distribute verbatim copies of the Source form of the
+     Standard Version of this Package in any medium without
+     restriction, either gratis or for a Distributor Fee, provided
+     that you duplicate all of the original copyright notices and
+     associated disclaimers. At your discretion, such verbatim copies
+     may or may not include a Compiled form of the Package.
+ .
+ (3) You may apply any bug fixes, portability changes, and other
+     modifications made available from the Copyright Holder. The
+     resulting Package will still be considered the Standard Version,
+     and as such will be subject to the Original License.
+ .
+ Distribution of Modified Versions of the Package as Source
+ .
+ (4) You may Distribute your Modified Version as Source (either gratis
+     or for a Distributor Fee, and with or without a Compiled form of
+     the Modified Version) provided that you clearly document how it
+     differs from the Standard Version, including, but not limited to,
+     documenting any non-standard features, executables, or modules,
+     and provided that you do at least ONE of the following:
+ .
+    (a) make the Modified Version available to the Copyright Holder
+        of the Standard Version, under the Original License, so that
+        the Copyright Holder may include your modifications in the
+        Standard Version.
+    (b) ensure that installation of your Modified Version does not
+        prevent the user installing or running the Standard Version.
+        In addition, the Modified Version must bear a name that is
+        different from the name of the Standard Version.
+    (c) allow anyone who receives a copy of the Modified Version to
+        make the Source form of the Modified Version available to
+        others under
+        (i)  the Original License or
+        (ii) a license that permits the licensee to freely copy,
+             modify and redistribute the Modified Version using the
+             same licensing terms that apply to the copy that the
+             licensee received, and requires that the Source form of
+             the Modified Version, and of any works derived from it,
+             be made freely available in that license fees are
+             prohibited but Distributor Fees are allowed.
+ .
+ Distribution of Compiled Forms of the Standard Version or Modified
+ Versions without the Source
+ .
+ (5) You may Distribute Compiled forms of the Standard Version without
+     the Source, provided that you include complete instructions on
+     how to get the Source of the Standard Version. Such instructions
+     must be valid at the time of your distribution. If these
+     instructions, at any time while you are carrying out such
+     distribution, become invalid, you must provide new instructions
+     on demand or cease further distribution. If you provide valid
+     instructions or cease distribution within thirty days after you
+     become aware that the instructions are invalid, then you do not
+     forfeit any of your rights under this license.
+ .
+ (6) You may Distribute a Modified Version in Compiled form without
+     the Source, provided that you comply with Section 4 with respect
+     to the Source of the Modified Version.
+ .
+ Aggregating or Linking the Package
+ .
+ (7) You may aggregate the Package (either the Standard Version or
+     Modified Version) with other packages and Distribute the
+     resulting aggregation provided that you do not charge a licensing
+     fee for the Package. Distributor Fees are permitted, and licensing
+     fees for other components in the aggregation are permitted. The
+     terms of this license apply to the use and Distribution of the
+     Standard or Modified Versions as included in the aggregation.
+ .
+ (8) You are permitted to link Modified and Standard Versions with
+     other works, to embed the Package in a larger work of your own,
+     or to build stand-alone binary or bytecode versions of
+     applications that include the Package, and Distribute the result
+     without restriction, provided the result does not expose a direct
+     interface to the Package.
+ .
+ Items That are Not Considered Part of a Modified Version
+ .
+ (9) Works (including, but not limited to, modules and scripts) that
+     merely extend or make use of the Package, do not, by themselves,
+     cause the Package to be a Modified Version. In addition, such
+     works are not considered parts of the Package itself, and are
+     not subject to the terms of this license.
+ .
+ General Provisions
+ .
+ (10) Any use, modification, and distribution of the Standard or
+      Modified Versions is governed by this Artistic License. By
+      using, modifying or distributing the Package, you accept this
+      license. Do not use, modify, or distribute the Package, if you
+      do not accept this license.
+ .
+ (11) If your Modified Version has been derived from a Modified
+      Version made by someone other than you, you are nevertheless
+      required to ensure that your Modified Version complies with
+      the requirements of this license.
+ .
+ (12) This license does not grant you the right to use any trademark,
+      service mark, tradename, or logo of the Copyright Holder.
+ .
+ (13) This license includes the non-exclusive, worldwide,
+      free-of-charge patent license to make, have made, use, offer to
+      sell, import and otherwise transfer the Package with respect to
+      any patent claims licensable by the Copyright Holder that are
+      necessarily infringed by the Package. If you institute patent
+      litigation (including a cross-claim or counterclaim) against
+      any party alleging that the Package constitutes direct or
+      contributory patent infringement, then this Artistic License to
+      you shall terminate on the date that such litigation is filed.
+ .
+ (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT
+      HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR
+      IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+      FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE
+      DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
+      REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE
+      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+      DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN
+      IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
 License: Artistic
    This program is free software; you can redistribute it and/or modify
    it under the terms of the Artistic License, which comes with Perl.

Modified: trunk/libwww-mechanize-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/debian/patches/series?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/debian/patches/series (original)
+++ trunk/libwww-mechanize-perl/debian/patches/series Sat Jul  3 03:39:03 2010
@@ -1,3 +1,1 @@
 no_internet.patch
-adding_pod_see_also.patch
-spelling.patch

Modified: trunk/libwww-mechanize-perl/lib/WWW/Mechanize.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/lib/WWW/Mechanize.pm?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/lib/WWW/Mechanize.pm (original)
+++ trunk/libwww-mechanize-perl/lib/WWW/Mechanize.pm Sat Jul  3 03:39:03 2010
@@ -6,11 +6,11 @@
 
 =head1 VERSION
 
-Version 1.62
-
-=cut
-
-our $VERSION = '1.62';
+Version 1.64
+
+=cut
+
+our $VERSION = '1.64';
 
 =head1 SYNOPSIS
 
@@ -280,7 +280,7 @@
     $self->{proxy} = {} unless defined $self->{proxy};
     push( @{$self->requests_redirectable}, 'POST' );
 
-    $self->_reset_page;
+    $self->_reset_page();
 
     return $self;
 }
@@ -559,7 +559,6 @@
 sub ct {            my $self = shift; return $self->{ct}; }
 sub content_type {  my $self = shift; return $self->{ct}; }
 sub base {          my $self = shift; return $self->{base}; }
-sub current_form {  my $self = shift; return $self->{form}; }
 sub is_html {       my $self = shift; return defined $self->ct && ($self->ct eq 'text/html'); }
 
 =head2 $mech->title()
@@ -571,12 +570,16 @@
 
 sub title {
     my $self = shift;
+
     return unless $self->is_html;
 
-    require HTML::HeadParser;
-    my $p = HTML::HeadParser->new;
-    $p->parse($self->content);
-    return $p->header('Title');
+    if ( not defined $self->{title} ) {
+        require HTML::HeadParser;
+        my $p = HTML::HeadParser->new;
+        $p->parse($self->content);
+        $self->{title} = $p->header('Title');
+    }
+    return $self->{title};
 }
 
 =head1 CONTENT-HANDLING METHODS
@@ -686,7 +689,7 @@
 sub links {
     my $self = shift;
 
-    $self->_extract_links() unless $self->{_extracted_links};
+    $self->_extract_links() unless $self->{links};
 
     return @{$self->{links}} if wantarray;
     return $self->{links};
@@ -1055,7 +1058,7 @@
 sub images {
     my $self = shift;
 
-    $self->_extract_images() unless $self->{_extracted_images};
+    $self->_extract_images() unless $self->{images};
 
     return @{$self->{images}} if wantarray;
     return $self->{images};
@@ -1213,10 +1216,22 @@
 
 sub forms {
     my $self = shift;
+
+    $self->_extract_forms() unless $self->{forms};
+
     return @{$self->{forms}} if wantarray;
     return $self->{forms};
 }
 
+sub current_form {
+    my $self = shift;
+
+    if ( !$self->{current_form} ) {
+        $self->form_number(1);
+    }
+
+    return $self->{current_form};
+}
 
 =head2 $mech->form_number($number)
 
@@ -1237,9 +1252,10 @@
     my ($self, $form) = @_;
     # XXX Should we die if no $form is defined? Same question for form_name()
 
-    if ($self->{forms}->[$form-1]) {
-        $self->{form} = $self->{forms}->[$form-1];
-        return $self->{form};
+    my $forms = $self->forms;
+    if ( $forms->[$form-1] ) {
+        $self->{current_form} = $forms->[$form-1];
+        return $self->{current_form};
     }
 
     return;
@@ -1264,10 +1280,13 @@
 
     my $temp;
     my @matches = grep {defined($temp = $_->attr('name')) and ($temp eq $form) } $self->forms;
-    if ( my $nmatches = @matches ) {
-        $self->warn( "There are $nmatches forms named $form.  The first one was used." )
-            if $nmatches > 1;
-        return $self->{form} = $matches[0];
+
+    my $nmatches = @matches;
+    if ( $nmatches > 0 ) {
+        if ( $nmatches > 1 ) {
+            $self->warn( "There are $nmatches forms named $form.  The first one was used." )
+        }
+        return $self->{current_form} = $matches[0];
     }
 
     return;
@@ -1294,7 +1313,7 @@
     if ( @matches ) {
         $self->warn( 'There are ', scalar @matches, " forms with ID $formid.  The first one was used." )
             if @matches > 1;
-        return $self->{form} = $matches[0];
+        return $self->{current_form} = $matches[0];
     }
     else {
         $self->warn( qq{ There is no form with ID "$formid"} );
@@ -1331,10 +1350,12 @@
         push @matches, $form;
     }
 
-    if ( my $nmatches = @matches ) {
-        $self->warn( "There are $nmatches forms with the named fields.  The first one was used." )
-            if $nmatches > 1;
-        return $self->{form} = $matches[0];
+    my $nmatches = @matches;
+    if ( $nmatches > 0 ) {
+        if ( $nmatches > 1 ) {
+            $self->warn( "There are $nmatches forms with the named fields.  The first one was used." )
+        }
+        return $self->{current_form} = $matches[0];
     }
     else {
         $self->warn( qq{There is no form with the requested fields} );
@@ -1364,7 +1385,7 @@
     my ($self, $name, $value, $number) = @_;
     $number ||= 1;
 
-    my $form = $self->{form};
+    my $form = $self->current_form();
     if ($number > 1) {
         $form->find_input($name, undef, $number)->value($value);
     }
@@ -1404,7 +1425,7 @@
 sub select {
     my ($self, $name, $value) = @_;
 
-    my $form = $self->{form};
+    my $form = $self->current_form();
 
     my $input = $form->find_input($name);
     if (!$input) {
@@ -1647,7 +1668,7 @@
     my $name = shift;
     my $number = shift || 1;
 
-    my $form = $self->{form};
+    my $form = $self->current_form;
     if ( $number > 1 ) {
         return $form->find_input( $name, undef, $number )->value();
     }
@@ -1673,7 +1694,7 @@
 sub click {
     my ($self, $button, $x, $y) = @_;
     for ($x, $y) { $_ = 1 unless defined; }
-    my $request = $self->{form}->click($button, $x, $y);
+    my $request = $self->current_form->click($button, $x, $y);
     return $self->request( $request );
 }
 
@@ -1732,7 +1753,7 @@
         $_ = 1 unless defined;
     }
 
-    my $form = $self->{form} or $self->die( 'click_button: No form has been selected' );
+    my $form = $self->current_form or $self->die( 'click_button: No form has been selected' );
 
     my $request;
     if ( $args{name} ) {
@@ -1774,7 +1795,7 @@
 sub submit {
     my $self = shift;
 
-    my $request = $self->{form}->make_request;
+    my $request = $self->current_form->make_request;
     return $self->request( $request );
 }
 
@@ -2232,17 +2253,7 @@
     $self->{ct} = 'text/html';
     $self->{content} = $html;
 
-    $self->{forms} = [ HTML::Form->parse($html, $self->base) ];
-    for my $form (@{ $self->{forms} }) {
-        for my $input ($form->inputs) {
-             if ($input->type eq 'file') {
-                 $input->value( undef );
-             }
-        }
-    }
-    $self->{form}  = $self->{forms}->[0];
-    $self->{_extracted_links} = 0;
-    $self->{_extracted_images} = 0;
+    $self->_reset_page();
 
     return;
 }
@@ -2456,13 +2467,11 @@
 sub _reset_page {
     my $self = shift;
 
-    $self->{_extracted_links}  = 0;
-    $self->{_extracted_images} = 0;
-    $self->{links}             = [];
-    $self->{images}            = [];
-    $self->{forms}             = [];
-
-    delete $self->{form};
+    $self->{links}        = undef;
+    $self->{images}       = undef;
+    $self->{forms}        = undef;
+    $self->{current_form} = undef;
+    $self->{title}        = undef;
 
     return;
 }
@@ -2496,8 +2505,6 @@
         } # while
     }
 
-    $self->{_extracted_links} = 1;
-
     return;
 }
 
@@ -2519,8 +2526,6 @@
             push( @{$self->{images}}, $image ) if $image;
         } # while
     }
-
-    $self->{_extracted_images} = 1;
 
     return;
 }
@@ -2606,6 +2611,23 @@
         });
 } # _link_from_token
 
+
+sub _extract_forms {
+    my $self = shift;
+
+    my @forms = HTML::Form->parse( $self->content, $self->base );
+    $self->{forms} = \@forms;
+    for my $form ( @forms ) {
+        for my $input ($form->inputs) {
+             if ($input->type eq 'file') {
+                 $input->value( undef );
+             }
+        }
+    }
+
+    return;
+}
+
 =head2 $mech->_push_page_stack()
 
 The agent keeps a stack of visited pages, which it can pop when it needs
@@ -2852,6 +2874,7 @@
 Thanks to the numerous people who have helped out on WWW::Mechanize in
 one way or another, including
 Kirrily Robert for the original C<WWW::Automate>,
+Ansgar Burchardt,
 Gisle Aas,
 Jeremy Ary,
 Hilary Holz,

Modified: trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Cookbook.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Cookbook.pod?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Cookbook.pod (original)
+++ trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Cookbook.pod Sat Jul  3 03:39:03 2010
@@ -72,10 +72,15 @@
 Use Abe Timmerman's L<WWW::CheckSite>
 L<http://search.cpan.org/dist/WWW-CheckSite/>
 
+=head1 SEE ALSO
+
+L<WWW::Mechanize>
+
 =head1 AUTHORS
 
-Copyright 2005 Andy Lester C<< <andy at petdance.com> >>
+Copyright 2005-2010 Andy Lester C<< <andy at petdance.com> >>
 
-Later contributions by Peter Scott, Mark Stosberg and others.
+Later contributions by Peter Scott, Mark Stosberg and others.  See
+Acknowledgements section in L<WWW::Mechanize> for more.
 
 =cut

Modified: trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Examples.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Examples.pod?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Examples.pod (original)
+++ trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Examples.pod Sat Jul  3 03:39:03 2010
@@ -492,7 +492,7 @@
     use strict;
     use WWW::Mechanize;
 
-    # a tool to automatically post entries to a moveable type weblog, and set arbitary creation dates
+    # a tool to automatically post entries to a moveable type weblog, and set arbitrary creation dates
 
     my $mech = WWW::Mechanize->new();
     my $entry;

Modified: trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Image.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Image.pm?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Image.pm (original)
+++ trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Image.pm Sat Jul  3 03:39:03 2010
@@ -116,11 +116,26 @@
     return $self->URI->abs;
 }
 
-=head1 COPYRIGHT
+=head1 SEE ALSO
 
-Copyright (c) 2004 Andy Lester. All rights reserved. This program is
-free software; you can redistribute it and/or modify it under the same
-terms as Perl itself.
+L<WWW::Mechanize> and L<WWW::Mechanize::Link>
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2004-2010 Andy Lester.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+=over 4
+
+=item * the GNU General Public License as published by the Free
+Software Foundation; either version 1, or (at your option) any later
+version, or
+
+=item * the Artistic License version 2.0.
+
+=back
 
 =cut
 

Modified: trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Link.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Link.pm?rev=59996&op=diff
==============================================================================
--- trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Link.pm (original)
+++ trunk/libwww-mechanize-perl/lib/WWW/Mechanize/Link.pm Sat Jul  3 03:39:03 2010
@@ -112,11 +112,26 @@
     return $self->URI->abs;
 }
 
-=head1 COPYRIGHT
+=head1 SEE ALSO
 
-Copyright (c) 2004-2008 Andy Lester. All rights reserved. This program is
-free software; you can redistribute it and/or modify it under the same
-terms as Perl itself.
+L<WWW::Mechanize> and L<WWW::Mechanize::Image>
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2004-2010 Andy Lester.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+=over 4
+
+=item * the GNU General Public License as published by the Free
+Software Foundation; either version 1, or (at your option) any later
+version, or
+
+=item * the Artistic License version 2.0.
+
+=back
 
 =cut
 




More information about the Pkg-perl-cvs-commits mailing list