r26299 - in /branches/upstream/libwww-mechanize-perl/current: ./ lib/WWW/ lib/WWW/Mechanize/ t/ t/live/ t/local/

rmayorga-guest at users.alioth.debian.org rmayorga-guest at users.alioth.debian.org
Tue Oct 28 17:54:12 UTC 2008


Author: rmayorga-guest
Date: Tue Oct 28 17:54:05 2008
New Revision: 26299

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=26299
Log:
[svn-upgrade] Integrating new upstream version, libwww-mechanize-perl (1.50)

Added:
    branches/upstream/libwww-mechanize-perl/current/t/live/encoding.t
Modified:
    branches/upstream/libwww-mechanize-perl/current/Changes
    branches/upstream/libwww-mechanize-perl/current/MANIFEST
    branches/upstream/libwww-mechanize-perl/current/META.yml
    branches/upstream/libwww-mechanize-perl/current/Makefile.PL
    branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize.pm
    branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize/FAQ.pod
    branches/upstream/libwww-mechanize-perl/current/t/autocheck.t
    branches/upstream/libwww-mechanize-perl/current/t/find_link_id.t
    branches/upstream/libwww-mechanize-perl/current/t/live/computers4sure.t
    branches/upstream/libwww-mechanize-perl/current/t/local/back.t
    branches/upstream/libwww-mechanize-perl/current/t/local/failure.t
    branches/upstream/libwww-mechanize-perl/current/t/local/follow.t
    branches/upstream/libwww-mechanize-perl/current/t/local/get.t
    branches/upstream/libwww-mechanize-perl/current/t/local/log-server

Modified: branches/upstream/libwww-mechanize-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/Changes?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/Changes (original)
+++ branches/upstream/libwww-mechanize-perl/current/Changes Tue Oct 28 17:54:05 2008
@@ -7,6 +7,49 @@
 
 Mech now has its own mailing list at Google Groups:
 http://groups.google.com/group/www-mechanize-users
+
+1.50        Sun Sun Oct 26 22:42:46 CDT 2008
+========================================
+[THINGS THAT MAY BREAK YOUR CODE]
+WWW::Mechanize now requires version 5.815 of LWP.  This in itself
+may cause problems for you because of changes in how LWP does
+authentication.
+
+
+1.49_01     Sat Sep 27 23:50:04 CDT 2008
+========================================
+[THINGS THAT MAY BREAK YOUR CODE]
+The autocheck argument to the constructor is now ON by default,
+unless WWW::Mechanize is being subclassed.  There are so many new
+programmers whose ->get() calls fail unchecked that I'm now putting
+on the seat belts for them.
+
+[FIXES]
+I do believe we are on the way to having all the encoding problems
+ironed out.  This version incorporates a patch from here:
+
+    http://code.google.com/p/www-mechanize/issues/detail?id=61
+
+and tests from Miyagawa's WWW::Mechanize::DecodedContent
+
+    http://search.cpan.org/dist/WWW-Mechanize-DecodedContent/
+
+to finally fix this.
+
+[ENHANCEMENTS]
+You can now specify not to set up the proxy, if there is one.  The
+proxy causes problems for Crypt::SSLeay.  For details see:
+http://code.google.com/p/www-mechanize/issues/detail?id=39
+
+[DOCUMENTATION]
+Fixed internal links.
+
+[INTERNALS]
+Lots of refactoring based on Schwern's "Skimmable Code" talk.
+
+http://use.perl.org/~schwern/journal/36704
+http://schwern.org/~schwern/talks/Skimmable%20Code%20-%20YAPC-NA-2008.pdf
+
 
 1.34        Mon Dec 10 00:30:39 CST 2007
 ========================================

Modified: branches/upstream/libwww-mechanize-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/MANIFEST?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/MANIFEST (original)
+++ branches/upstream/libwww-mechanize-perl/current/MANIFEST Tue Oct 28 17:54:05 2008
@@ -60,6 +60,7 @@
 t/warnings.t
 
 t/live/computers4sure.t
+t/live/encoding.t
 t/live/wikipedia.t
 
 t/local/LocalServer.pm

Modified: branches/upstream/libwww-mechanize-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/META.yml?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/META.yml (original)
+++ branches/upstream/libwww-mechanize-perl/current/META.yml Tue Oct 28 17:54:05 2008
@@ -1,9 +1,11 @@
 --- #YAML:1.0
 name:                WWW-Mechanize
-version:             1.34
+version:             1.50
 abstract:            Handy web browsing in a Perl object
 license:             ~
-generated_by:        ExtUtils::MakeMaker version 6.36
+author:              
+    - Andy Lester <andy at petdance.com>
+generated_by:        ExtUtils::MakeMaker version 6.44
 distribution_type:   module
 requires:     
     Carp:                          0
@@ -16,22 +18,15 @@
     HTML::TokeParser:              2.28
     HTTP::Daemon:                  0
     HTTP::Request:                 1.3
+    HTTP::Response::Encoding:      0.05
     HTTP::Status:                  0
-    LWP:                           5.802
-    LWP::UserAgent:                2.024
+    LWP:                           5.815
+    LWP::UserAgent:                5.815
     Pod::Usage:                    0
     Test::More:                    0.34
     URI:                           1.25
     URI::file:                     0
     URI::URL:                      0
 meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.2.html
-    version: 1.2
-author:
-    - Andy Lester <andy at petdance.com>
-resources:
-    license: http://dev.perl.org/licenses/
-    homepage: http://code.google.com/p/www-mechanize/
-    bugtracker: http://code.google.com/p/www-mechanize/issues/list
-    Repository: http://code.google.com/p/www-mechanize/source
-    MailingList: http://groups.google.com/group/www-mechanize-users
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: branches/upstream/libwww-mechanize-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/Makefile.PL?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/Makefile.PL (original)
+++ branches/upstream/libwww-mechanize-perl/current/Makefile.PL Tue Oct 28 17:54:05 2008
@@ -29,24 +29,25 @@
     AUTHOR          => 'Andy Lester <andy at petdance.com>',
     EXE_FILES       => [ 'bin/mech-dump' ],
     PREREQ_PM       => {
-        'Carp'              => 0,
-        'File::Temp'        => 0,
-        'FindBin'           => 0,
-        'Getopt::Long'      => 0,
-        'HTML::Form'        => 1.038,
-        'HTML::HeadParser'  => 0,
-        'HTML::Parser'      => 3.33,
-        'HTML::TokeParser'  => 2.28,
-        'HTTP::Daemon'      => 0,
-        'HTTP::Request'     => 1.30,
-        'HTTP::Status'      => 0,
-        'LWP'               => 5.802,
-        'LWP::UserAgent'    => 2.024,
-        'Pod::Usage'        => 0,
-        'Test::More'        => 0.34,
-        'URI'               => 1.25,
-        'URI::URL'          => 0,
-        'URI::file'         => 0,
+        'Carp'                     => 0,
+        'File::Temp'               => 0,
+        'FindBin'                  => 0,
+        'Getopt::Long'             => 0,
+        'HTML::Form'               => 1.038,
+        'HTML::HeadParser'         => 0,
+        'HTML::Parser'             => 3.33,
+        'HTML::TokeParser'         => 2.28,
+        'HTTP::Daemon'             => 0,
+        'HTTP::Request'            => 1.30,
+        'HTTP::Response::Encoding' => 0.05,
+        'HTTP::Status'             => 0,
+        'LWP'                      => 5.815,
+        'LWP::UserAgent'           => 5.815,
+        'Pod::Usage'               => 0,
+        'Test::More'               => 0.34,
+        'URI'                      => 1.25,
+        'URI::URL'                 => 0,
+        'URI::file'                => 0,
     },
     test            => { TESTS => join( ' ', @tests ) },
     clean           => { FILES => 'WWW-Mechanize-*' },

Modified: branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize.pm?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize.pm (original)
+++ branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize.pm Tue Oct 28 17:54:05 2008
@@ -6,11 +6,11 @@
 
 =head1 VERSION
 
-Version 1.34
-
-=cut
-
-our $VERSION = '1.34';
+Version 1.50
+
+=cut
+
+our $VERSION = '1.50';
 
 =head1 SYNOPSIS
 
@@ -106,6 +106,7 @@
 use LWP::UserAgent 2.003;
 use HTML::Form 1.00;
 use HTML::TokeParser;
+use HTTP::Response::Encoding 0.05;
 
 use base 'LWP::UserAgent';
 
@@ -146,9 +147,26 @@
 
 =item * C<< autocheck => [0|1] >>
 
-Checks each request made to see if it was successful.  This saves you
-the trouble of manually checking yourself.  Any errors found are errors,
-not warnings.  Default is off.
+Checks each request made to see if it was successful.  This saves
+you the trouble of manually checking yourself.  Any errors found
+are errors, not warnings.
+
+The default value is ON, unless it's being subclassed, in which
+case it is OFF.  This means that standalone L<WWW::Mechanize>instances
+have autocheck turned on, which is protective for the vast majority
+of Mech users who don't bother checking the return value of get()
+and post() and can't figure why their code fails. However, if
+L<WWW::Mechanize> is subclassed, such as for L<Test::WWW::Mechanize>
+or L<Test::WWW::Mechanize::Catalyst>, this may not be an appropriate
+default, so it's off.
+
+=item * C<< noproxy => [0|1] >>
+
+Turn off the automatic call to the L<LWP::UserAgent> C<env_proxy> function.
+
+This needs to be explicitly turned off if you're using L<Crypt::SSLeay> to
+access a https site via a proxy server.  Note: you still need to set your
+HTTPS_PROXY environment variable as appropriate.
 
 =item * C<< onwarn => \&func >>
 
@@ -195,7 +213,7 @@
     );
 
     my %mech_parms = (
-        autocheck   => 0,
+        autocheck   => ($class eq 'WWW::Mechanize' ? 1 : 0),
         onwarn      => \&WWW::Mechanize::_warn,
         onerror     => \&WWW::Mechanize::_die,
         quiet       => 0,
@@ -223,7 +241,7 @@
         $self->{$parm} = $mech_parms{$parm};
     }
     $self->{page_stack} = [];
-    $self->env_proxy();
+    $self->env_proxy() unless $parent_parms{noproxy};
 
     # libwww-perl 5.800 (and before, I assume) has a problem where
     # $ua->{proxy} can be undef and clone() doesn't handle it.
@@ -392,7 +410,7 @@
 =head2 $mech->reload()
 
 Acts like the reload button in a browser: repeats the current
-request. The history (as per the L<back> method) is not altered.
+request. The history (as per the L</back> method) is not altered.
 
 Returns the L<HTTP::Response> object from the reload, or C<undef>
 if there's no current request.
@@ -556,30 +574,57 @@
 
     if ( $self->is_html ) {
         my %parms = @_;
+
         if ( exists $parms{base_href} ) {
-            my $arg = (delete $parms{base_href}) || $self->base;
-            $content=~s/<head>/<head>\n<base href="$arg">/i;
-        }
-        if ( my $arg = delete $parms{format} ) {
-            if ($arg eq 'text') {
-                require HTML::TreeBuilder;
-                my $tree = HTML::TreeBuilder->new();
-                $tree->parse($content);
-                $tree->eof();
-                $tree->elementify(); # just for safety
-                $content = $tree->as_text();
-                $tree->delete;
-            }
-            else {
-                $self->die( qq{Unknown "format" parameter "$arg"} );
-            }
-        }
-        for my $cmd ( sort keys %parms ) {
-            $self->die( qq{Unknown named argument "$cmd"} );
-        }
-    } # is HTML
+            my $base_href = (delete $parms{base_href}) || $self->base;
+            $content=~s/<head>/<head>\n<base href="$base_href">/i;
+        }
+
+        if ( my $format = delete $parms{format} ) {
+            $content = $self->_format_content( $format, $content );
+        }
+
+        $self->_check_unhandled_parms( %parms );
+    }
 
     return $content;
+}
+
+sub _format_content {
+    my $self = shift;
+    my $format = shift;
+    my $content = shift;
+
+    if ( $format eq 'text' ) {
+        return $self->_content_as_text($content);
+    }
+    else {
+        $self->die( qq{Unknown "format" parameter "$format"} );
+    }
+}
+
+sub _content_as_text {
+    my $self = shift;
+    my $content = shift;
+
+    require HTML::TreeBuilder;
+    my $tree = HTML::TreeBuilder->new();
+    $tree->parse($content);
+    $tree->eof();
+    $tree->elementify(); # just for safety
+    my $formatted_content = $tree->as_text();
+    $tree->delete;
+
+    return $formatted_content;
+}
+
+sub _check_unhandled_parms {
+    my $self  = shift;
+    my %parms = @_;
+
+    for my $cmd ( sort keys %parms ) {
+        $self->die( qq{Unknown named argument "$cmd"} );
+    }
 }
 
 =head1 LINK METHODS
@@ -858,7 +903,7 @@
 =head2 $mech->find_all_links( ... )
 
 Returns all the links on the current page that match the criteria.  The
-method for specifying link criteria is the same as in C<L<find_link()>>.
+method for specifying link criteria is the same as in C<L</find_link()>>.
 Each of the links returned is a L<WWW::Mechanize::Link> object.
 
 In list context, C<find_all_links()> returns a list of the links.
@@ -1086,7 +1131,7 @@
 =head2 $mech->find_all_images( ... )
 
 Returns all the images on the current page that match the criteria.  The
-method for specifying image criteria is the same as in C<L<find_image()>>.
+method for specifying image criteria is the same as in C<L</find_image()>>.
 Each of the images returned is a L<WWW::Mechanize::Image> object.
 
 In list context, C<find_all_images()> returns a list of the images.
@@ -1121,11 +1166,11 @@
 =head2 $mech->form_number($number)
 
 Selects the I<number>th form on the page as the target for subsequent
-calls to C<L<field()>> and C<L<click()>>.  Also returns the form that was
+calls to C<L</field()>> and C<L</click()>>.  Also returns the form that was
 selected.
 
 If it is found, the form is returned as an L<HTML::Form> object and set internally
-for later use with Mech's form methods such as C<L<field()>> and C<L<click()>>.
+for later use with Mech's form methods such as C<L</field()>> and C<L</click()>>.
 
 Emits a warning and returns undef if no form is found.
 
@@ -1154,7 +1199,7 @@
 generated.
 
 If it is found, the form is returned as an L<HTML::Form> object and set internally
-for later use with Mech's form methods such as C<L<field()>> and C<L<click()>>.
+for later use with Mech's form methods such as C<L</field()>> and C<L</click()>>.
 
 Returns undef if no form is found.
 
@@ -1185,7 +1230,7 @@
 and a warning is generated.
 
 If it is found, the form is returned as an L<HTML::Form> object and set internally
-for later used with Mech's form methods such as C<L<field()>> and C<L<click()>>.
+for later used with Mech's form methods such as C<L</field()>> and C<L</click()>>.
 
 Returns undef if no form is found.
 
@@ -1222,9 +1267,10 @@
 
 =head2 $mech->field( $name, \@values, $number )
 
-Given the name of a field, set its value to the value specified.  This
-applies to the current form (as set by the L<form_name()> or L<form_number()> method or defaulting
-to the first form on the page).
+Given the name of a field, set its value to the value specified.
+This applies to the current form (as set by the L</form_name()> or
+L</form_number()> method or defaulting to the first form on the
+page).
 
 The optional I<$number> parameter is used to distinguish between two fields
 with the same name.  The fields are numbered from 1.
@@ -1258,7 +1304,8 @@
 C<$value> is an array, only the B<first> value will be set.  [Note:
 the documentation previously claimed that only the last value would
 be set, but this was incorrect.]  Passing C<$value> as a hash with
-an C<n> key selects an item by number (e.g. C<{n => 3> or C<{n => [2,4]}>).
+an C<n> key selects an item by number (e.g.
+C<< {n => 3} >> or C<{ {n => [2,4]} >>).
 The numbering starts at 1.  This applies to the current form.
 
 Returns 1 on successfully setting the value. On failure, returns
@@ -1662,32 +1709,32 @@
 fields mentioned in C<\%fields>.  This is nice because you don't need to know
 the name or number of the form to do this.
 
-(calls C<L<form_with_fields>> and C<L<set_fields()>>).
+(calls C<L</form_with_fields()>> and C<L</set_fields()>>).
 
 If you choose this, the form_number, form_name and fields options will be ignored.
 
 =item * form_number => n
 
-Selects the I<n>th form (calls C<L<form_number()>>).  If this parm is not
+Selects the I<n>th form (calls C<L</form_number()>>).  If this parm is not
 specified, the currently-selected form is used.
 
 =item * form_name => name
 
-Selects the form named I<name> (calls C<L<form_name()>>)
+Selects the form named I<name> (calls C<L</form_name()>>)
 
 =item * button => button
 
-Clicks on button I<button> (calls C<L<click()>>)
+Clicks on button I<button> (calls C<L</click()>>)
 
 =item * x => x, y => y
 
-Sets the x or y values for C<L<click()>>
+Sets the x or y values for C<L</click()>>
 
 =back
 
 If no form is selected, the first form found is used.
 
-If I<button> is not passed, then the C<L<submit()>> method is used instead.
+If I<button> is not passed, then the C<L</submit()>> method is used instead.
 
 Returns an L<HTTP::Response> object.
 
@@ -2145,10 +2192,8 @@
     $self->_reset_page;
 
     # Try to decode the content. Undef will be returned if there's nothing to decompress.
-    # See docs in HTTP::Message for details. Do we need to expose the options there? 
-    # use charset => 'none' because while we want LWP to handle Content-Encoding for 
-    # the auto-gzipping with Compress::Zlib we don't want it messing with charset
-    my $content = $res->decoded_content( charset => 'none' );
+    # See docs in HTTP::Message for details. Do we need to expose the options there?
+    my $content = $res->decoded_content();
     $content = $res->content if (not defined $content);
 
     $content .= _taintedness();
@@ -2684,6 +2729,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>,
+Michael Schwern,
 Adriano Ferreira,
 Miyagawa,
 Peteris Krumins,
@@ -2725,7 +2771,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (c) 2005-2007 Andy Lester. All rights reserved. This program is
+Copyright (c) 2005-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.
 

Modified: branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize/FAQ.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize/FAQ.pod?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize/FAQ.pod (original)
+++ branches/upstream/libwww-mechanize-perl/current/lib/WWW/Mechanize/FAQ.pod Tue Oct 28 17:54:05 2008
@@ -77,7 +77,7 @@
 Javascript function. Do a regular expression match on
 C<< $mech->content() >>
 to find the link that you want and C<< $mech->get >> it directly (this
-assumes that you know what your are looking for in advance).
+assumes that you know what you are looking for in advance).
 
 In more difficult cases, the Javascript is used for URL mangling to
 satisfy the needs of some middleware. In this case you need to figure

Modified: branches/upstream/libwww-mechanize-perl/current/t/autocheck.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/t/autocheck.t?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/t/autocheck.t (original)
+++ branches/upstream/libwww-mechanize-perl/current/t/autocheck.t Tue Oct 28 17:54:05 2008
@@ -24,7 +24,7 @@
 }
 
 AUTOCHECK_OFF: {
-    my $mech = WWW::Mechanize->new;
+    my $mech = WWW::Mechanize->new( autocheck => 0 );
     isa_ok( $mech, 'WWW::Mechanize' );
 
     $mech->get( NONEXISTENT );
@@ -32,7 +32,7 @@
 }
 
 AUTOCHECK_ON: {
-    my $mech = WWW::Mechanize->new( autocheck => 1 );
+    my $mech = WWW::Mechanize->new;
     isa_ok( $mech, 'WWW::Mechanize' );
 
     dies_ok {

Modified: branches/upstream/libwww-mechanize-perl/current/t/find_link_id.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/t/find_link_id.t?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/t/find_link_id.t (original)
+++ branches/upstream/libwww-mechanize-perl/current/t/find_link_id.t Tue Oct 28 17:54:05 2008
@@ -2,7 +2,7 @@
 
 use warnings;
 use strict;
-use Test::More no_plan => 1;
+use Test::More 'no_plan';
 use URI::file;
 
 BEGIN {

Modified: branches/upstream/libwww-mechanize-perl/current/t/live/computers4sure.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/t/live/computers4sure.t?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/t/live/computers4sure.t (original)
+++ branches/upstream/libwww-mechanize-perl/current/t/live/computers4sure.t Tue Oct 28 17:54:05 2008
@@ -3,7 +3,6 @@
 use warnings;
 use strict;
 
-use Test::More skip_all => 'Still need to get the error-handling on here working';
 use Test::More tests => 9;
 
 BEGIN {
@@ -33,7 +32,6 @@
 $mech->get( $link_str );
 is( $mech->response->code, 200, "Fetched $link_str" );
 ok( $mech->content =~ /Your price/i, 'Found a likely phrase in the second page' );
-#print $mech->content;
 
 SKIP: {
     eval 'use Test::Memory::Cycle';
@@ -41,4 +39,3 @@
 
     memory_cycle_ok( $mech, 'No memory cycles found' );
 }
-

Added: branches/upstream/libwww-mechanize-perl/current/t/live/encoding.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/t/live/encoding.t?rev=26299&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/t/live/encoding.t (added)
+++ branches/upstream/libwww-mechanize-perl/current/t/live/encoding.t Tue Oct 28 17:54:05 2008
@@ -1,0 +1,34 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+use constant PAIRS => {
+    'http://delicious.com/'
+        => 'utf-8',
+    'http://www.liveinternet.ru/users/dashdi/blog'
+        => 'cp1251',
+    'http://oops-music.com/'
+        => 'EUC-JP',
+};
+
+use Test::More tests => (4 * keys %{+PAIRS}) + 1;
+use Encode;
+
+BEGIN {
+    use_ok( 'WWW::Mechanize' );
+}
+
+my %pairs = %{+PAIRS};
+for my $url ( sort keys %pairs ) {
+    my $want_encoding = $pairs{$url};
+
+    my $mech = WWW::Mechanize->new;
+    isa_ok( $mech, 'WWW::Mechanize' );
+
+    $mech->get( $url );
+    is( $mech->response->code, 200, "Fetched $url" );
+
+    like( $mech->res->encoding, qr/$want_encoding/i, "   ... Got encoding $want_encoding" );
+    ok( Encode::is_utf8( $mech->content ), 'Got back UTF-8' );
+}

Modified: branches/upstream/libwww-mechanize-perl/current/t/local/back.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/t/local/back.t?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/t/local/back.t (original)
+++ branches/upstream/libwww-mechanize-perl/current/t/local/back.t Tue Oct 28 17:54:05 2008
@@ -113,7 +113,7 @@
     memory_cycle_ok( $mech, 'No memory cycles found' );
 }
 
-$mech = WWW::Mechanize->new();
+$mech = WWW::Mechanize->new( autocheck => 0 );
 isa_ok( $mech, 'WWW::Mechanize' );
 $mech->get( $server->url );
 ok( $mech->success, 'Got root URL' );

Modified: branches/upstream/libwww-mechanize-perl/current/t/local/failure.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/t/local/failure.t?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/t/local/failure.t (original)
+++ branches/upstream/libwww-mechanize-perl/current/t/local/failure.t Tue Oct 28 17:54:05 2008
@@ -24,7 +24,7 @@
 isa_ok( $server, 'LocalServer' );
 
 
-my $mech = WWW::Mechanize->new;
+my $mech = WWW::Mechanize->new( autocheck => 0 );
 isa_ok( $mech, 'WWW::Mechanize', 'Created object' );
 
 GOOD_PAGE: {

Modified: branches/upstream/libwww-mechanize-perl/current/t/local/follow.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/t/local/follow.t?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/t/local/follow.t (original)
+++ branches/upstream/libwww-mechanize-perl/current/t/local/follow.t Tue Oct 28 17:54:05 2008
@@ -6,6 +6,7 @@
 use Test::More tests => 21;
 use lib 't/local';
 use LocalServer;
+use encoding 'iso-8859-1';
 
 BEGIN {
     delete @ENV{ grep { lc eq 'http_proxy' } keys %ENV };

Modified: branches/upstream/libwww-mechanize-perl/current/t/local/get.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/t/local/get.t?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/t/local/get.t (original)
+++ branches/upstream/libwww-mechanize-perl/current/t/local/get.t Tue Oct 28 17:54:05 2008
@@ -57,7 +57,7 @@
 ok( $agent->is_html, 'is HTML' );
 is( $agent->title, 'WWW::Mechanize::Shell test page', 'Title matches' );
 like( $agent->content, qr/WWW::Mechanize::Shell test page/, 'Got the right page' );
-my $rslength = length $agent->content;
+my $rslength = do {use bytes; length $agent->content};
 
 my $tempfile = './temp';
 unlink $tempfile;

Modified: branches/upstream/libwww-mechanize-perl/current/t/local/log-server
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-perl/current/t/local/log-server?rev=26299&op=diff
==============================================================================
--- branches/upstream/libwww-mechanize-perl/current/t/local/log-server (original)
+++ branches/upstream/libwww-mechanize-perl/current/t/local/log-server Tue Oct 28 17:54:05 2008
@@ -3,6 +3,7 @@
 use strict;
 use HTTP::Daemon;
 use CGI;
+use encoding 'iso-8859-1';
 
 $|++;
 
@@ -16,6 +17,7 @@
 };
 open LOG, ">", $logfile
   or die "Couldn't create logfile '$logfile' : $!\n";
+binmode DATA,':encoding(iso-8859-1)';
 my $body = join "", <DATA>;
 
 sub debug($) {




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