-
-
14 Feb 2011 11:47:14 UTC
- Distribution: WWW-Mechanize-Cached-GZip
- Module version: 0.12
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (1)
- Testers (4652 / 17 / 0)
- Kwalitee
Bus factor: 0- 50.00% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (3.07KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Test::More
- WWW::Mechanize::Cached
- WWW::Mechanize::GZip
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
WWW::Mechanize::Cached::GZip - like WWW::Mechanize + caching + gzip-compression
VERSION
Version 0.12
SYNOPSIS
use WWW::Mechanize::Cached::GZip; my $mech_cached = WWW::Mechanize::Cached::GZip->new(); my $response = $mech_cached->get($url); print "x-content-length (before unzip) = ", $response->header('x-content-length'); print "content-length (after unzip) = ", $response->header('content-length'); ... # for the same $url - the already uncompressed $response2 is now taken from cache: my $response2 = $mech_cached->get($url);
DESCRIPTION
The WWW::Mechanize::Cached::GZip module tries to fetch a URL by requesting gzip-compression from the webserver.
Caching is done by inheriting from WWW::Mechanize::Cached. Constructor parameters are identically and described there.
DECOMPRESSION
If the response contains a header with 'Content-Encoding: gzip', it decompresses the response-body 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.
The decompression of the response is handled by Compress::Zlib::memGunzip.
There is a small webform, you can instantly test, whether a webserver supports gzip-compression on a particular URL: http://www.computerhandlung.de/www-mechanize-cached-gzip.htm
CACHING
This modules is a direct subclass of WWW::Mechanize::Cached and will therefore accept the same constructor parameters and support any methods provided by WWW::Mechanize::Cached.
The default behavoir is to use Cache::FileCache which stores its files somewhere under /tmp.
METHODS
- prepare_request
-
Adds 'Accept-Encoding' => 'gzip' to outgoing HTTP-headers before sending.
- send_request
-
Unzips response-body if 'content-encoding' is 'gzip' and corrects 'content-length' to unzipped content-length.
SEE ALSO
AUTHOR
Peter Giessner
cardb@planet-elektronik.de
LICENCE AND COPYRIGHT
Copyright (c) 2011, Peter Giessner
cardb@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.
Module Install Instructions
To install WWW::Mechanize::Cached::GZip, copy and paste the appropriate command in to your terminal.
cpanm WWW::Mechanize::Cached::GZip
perl -MCPAN -e shell install WWW::Mechanize::Cached::GZip
For more information on module installation, please visit the detailed CPAN module installation guide.