r43876 - in /branches/upstream/libwww-mechanize-gzip-perl: ./ current/ current/lib/ current/lib/WWW/ current/lib/WWW/Mechanize/ current/t/

christine at users.alioth.debian.org christine at users.alioth.debian.org
Wed Sep 9 21:44:25 UTC 2009


Author: christine
Date: Wed Sep  9 21:44:20 2009
New Revision: 43876

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=43876
Log:
[svn-inject] Installing original source of libwww-mechanize-gzip-perl

Added:
    branches/upstream/libwww-mechanize-gzip-perl/
    branches/upstream/libwww-mechanize-gzip-perl/current/
    branches/upstream/libwww-mechanize-gzip-perl/current/.cvsignore   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/Changes   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/MANIFEST   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/META.yml   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/Makefile.PL   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/README   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/lib/
    branches/upstream/libwww-mechanize-gzip-perl/current/lib/WWW/
    branches/upstream/libwww-mechanize-gzip-perl/current/lib/WWW/Mechanize/
    branches/upstream/libwww-mechanize-gzip-perl/current/lib/WWW/Mechanize/GZip.pm   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/t/
    branches/upstream/libwww-mechanize-gzip-perl/current/t/00-load.t   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/t/boilerplate.t   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/t/pod-coverage.t   (with props)
    branches/upstream/libwww-mechanize-gzip-perl/current/t/pod.t   (with props)

Added: branches/upstream/libwww-mechanize-gzip-perl/current/.cvsignore
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/.cvsignore?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/.cvsignore (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/.cvsignore Wed Sep  9 21:44:20 2009
@@ -1,0 +1,10 @@
+blib*
+Makefile
+Makefile.old
+Build
+_build*
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+WWW-Mechanize-GZip-*
+cover_db

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/.cvsignore
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/Changes?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/Changes (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/Changes Wed Sep  9 21:44:20 2009
@@ -1,0 +1,12 @@
+Revision history for WWW-Mechanize-GZip
+
+0.12    2009-06-24
+        - fixed warning on undefined 'content-encoding' - thanks to Edward Smirnov
+
+0.11    2009-06-16
+        - added comments to pass POD-Coverage - thanks to Jesse Vincent
+        - added 'use warnings;' - thanks to Jesse Vincent too
+
+0.10    2007-02-18
+        First version.
+

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/Changes
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/MANIFEST?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/MANIFEST (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/MANIFEST Wed Sep  9 21:44:20 2009
@@ -1,0 +1,10 @@
+Changes
+MANIFEST
+META.yml # Will be created by "make dist"
+Makefile.PL
+README
+lib/WWW/Mechanize/GZip.pm
+t/00-load.t
+t/boilerplate.t
+t/pod-coverage.t
+t/pod.t

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/MANIFEST
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/META.yml?rev=43876&op=file
==============================================================================
    (empty)

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/META.yml
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/Makefile.PL?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/Makefile.PL (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/Makefile.PL Wed Sep  9 21:44:20 2009
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+    NAME                => 'WWW::Mechanize::GZip',
+    AUTHOR              => 'Peter Giessner <cardb at planet-elektronik.de>',
+    VERSION_FROM        => 'lib/WWW/Mechanize/GZip.pm',
+    ABSTRACT_FROM       => 'lib/WWW/Mechanize/GZip.pm',
+    PL_FILES            => {},
+    PREREQ_PM => {
+        'Test::More' => 0,
+	'Compress::Zlib' => 0,
+	'WWW::Mechanize' => 0,
+    },
+    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+    clean               => { FILES => 'WWW-Mechanize-GZip-*' },
+);

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/Makefile.PL
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/README?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/README (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/README Wed Sep  9 21:44:20 2009
@@ -1,0 +1,18 @@
+WWW-Mechanize-GZip
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+    perl Makefile.PL
+    make
+    make test
+    make install
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2007 Peter Giessner
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/README
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/lib/WWW/Mechanize/GZip.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/lib/WWW/Mechanize/GZip.pm?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/lib/WWW/Mechanize/GZip.pm (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/lib/WWW/Mechanize/GZip.pm Wed Sep  9 21:44:20 2009
@@ -1,0 +1,118 @@
+=head1 NAME
+
+WWW::Mechanize::GZip - tries to fetch webpages with gzip-compression
+
+=head1 VERSION
+
+Version 0.10
+
+=head1 SYNOPSIS
+
+    use WWW::Mechanize::GZip;
+
+    my $mech = WWW::Mechanize::GZip->new();
+    my $response = $mech->get( $url );
+
+    print "x-content-length (before unzip) = ", $response->header('x-content-length');
+    print "content-length (after unzip) = ", $response->header('content-length');
+
+=head1 DESCRIPTION
+
+The L<WWW::Mechanize::GZip> module tries to fetch a URL by requesting
+gzip-compression from the webserver.
+
+If the response contains a header with 'Content-Encoding: gzip', it
+decompresses the response in order to get the original (uncompressed) content.
+
+This module will help to reduce bandwith fetching webpages, if supported by the
+webeserver. If the webserver does not support gzip-compression, no decompression
+will be made.
+
+This modules is a direct subclass of L<WWW::Mechanize> and will therefore support
+any methods provided by L<WWW::Mechanize>.
+
+The decompression is handled by L<Compress::Zlib>::memGunzip.
+
+There is a small webform, you can instantly test, whether a webserver supports
+gzip-compression on a particular URL:
+L<http://www.computerhandlung.de/www-mechanize-gzip.htm>
+
+=head2 METHODS
+
+=over 2
+
+=item prepare_request
+
+Adds 'Accept-Encoding' => 'gzip' to outgoing HTTP-headers before sending.
+
+=item send_request
+
+Unzips response-body if 'content-encoding' is 'gzip' and
+corrects 'content-length' to unzipped content-length.
+
+=back
+
+=head1 SEE ALSO
+
+L<WWW::Mechanize>
+
+L<Compress::Zlib>
+
+=head1 AUTHOR
+
+Peter Giessner C<cardb at planet-elektronik.de>
+
+=head1 LICENCE AND COPYRIGHT
+
+Copyright (c) 2007, Peter Giessner C<cardb at planet-elektronik.de>.
+All rights reserved.
+
+This module is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=cut
+
+package WWW::Mechanize::GZip;
+
+our $VERSION = '0.12';
+
+use strict;
+use warnings;
+use Compress::Zlib ();
+use base qw(WWW::Mechanize);
+
+################################################################################
+sub prepare_request {
+    my ($self, $request) = @_;
+
+    # call baseclass-method to prepare request...
+    $request = $self->SUPER::prepare_request($request);
+
+    # set HTTP-header to request gzip-transfer-encoding at the webserver
+    $request->header('Accept-Encoding' => 'gzip');
+
+    return ($request);
+}
+
+################################################################################
+sub send_request {
+    my ($self, $request, $arg, $size) = @_;
+
+    # call baseclass-method to make the actual request
+    my $response = $self->SUPER::send_request($request, $arg, $size);
+
+    # check if response is declared as gzipped and decode it
+    if ($response && defined($response->headers->header('content-encoding')) && $response->headers->header('content-encoding') eq 'gzip') {
+        # store original content-length in separate response-header
+        $response->headers->header('x-content-length', length($response->{_content}));
+        # decompress ...
+        $response->{_content} = Compress::Zlib::memGunzip(\($response->{_content}));
+        # store new content-length in response-header
+        $response->{_headers}->{'content-length'} = length($response->{_content});
+    }
+    return $response;
+}
+
+1;
+
+__END__

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/lib/WWW/Mechanize/GZip.pm
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/t/00-load.t?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/t/00-load.t (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/t/00-load.t Wed Sep  9 21:44:20 2009
@@ -1,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+	use_ok( 'WWW::Mechanize::GZip' );
+}
+
+diag( "Testing WWW::Mechanize::GZip $WWW::Mechanize::GZip::VERSION, Perl $], $^X" );

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/t/00-load.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/t/boilerplate.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/t/boilerplate.t?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/t/boilerplate.t (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/t/boilerplate.t Wed Sep  9 21:44:20 2009
@@ -1,0 +1,48 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+sub not_in_file_ok {
+    my ($filename, %regex) = @_;
+    open my $fh, "<", $filename
+        or die "couldn't open $filename for reading: $!";
+
+    my %violated;
+
+    while (my $line = <$fh>) {
+        while (my ($desc, $regex) = each %regex) {
+            if ($line =~ $regex) {
+                push @{$violated{$desc}||=[]}, $.;
+            }
+        }
+    }
+
+    if (%violated) {
+        fail("$filename contains boilerplate text");
+        diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
+    } else {
+        pass("$filename contains no boilerplate text");
+    }
+}
+
+not_in_file_ok(README =>
+    "The README is used..."       => qr/The README is used/,
+    "'version information here'"  => qr/to provide version information/,
+);
+
+not_in_file_ok(Changes =>
+    "placeholder date/time"       => qr(Date/time)
+);
+
+sub module_boilerplate_ok {
+    my ($module) = @_;
+    not_in_file_ok($module =>
+        'the great new $MODULENAME'   => qr/ - The great new /,
+        'boilerplate description'     => qr/Quick summary of what the module/,
+        'stub function definition'    => qr/function[12]/,
+    );
+}
+
+module_boilerplate_ok('lib/WWW/Mechanize/GZip.pm');

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/t/boilerplate.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/t/pod-coverage.t?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/t/pod-coverage.t (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/t/pod-coverage.t Wed Sep  9 21:44:20 2009
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/t/pod-coverage.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libwww-mechanize-gzip-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-mechanize-gzip-perl/current/t/pod.t?rev=43876&op=file
==============================================================================
--- branches/upstream/libwww-mechanize-gzip-perl/current/t/pod.t (added)
+++ branches/upstream/libwww-mechanize-gzip-perl/current/t/pod.t Wed Sep  9 21:44:20 2009
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();

Propchange: branches/upstream/libwww-mechanize-gzip-perl/current/t/pod.t
------------------------------------------------------------------------------
    svn:executable = 




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