Change history for libwww-perl
+6.23 2017-03-06
+ - Fix bug where Protocol::NNTP called undef on a variable before being done
+ using it. (GH PR #121)
+ - Ran perltidy on LWP::Protocol::NNTP
+ - Re-organized current documentation set.
+
6.22 2017-03-01
- Update Travis-CI to test on minimum versions of prereqs. (GH PR #109)
- Fix tests that depended on a newer version of HTTP::Message (GH PR #119)
t/00-report-prereqs.t
t/base/default_content_type.t
t/base/protocols.t
+t/base/protocols/nntp.t
t/base/proxy.t
t/base/simple.t
t/base/ua.t
"provides" : {
"LWP" : {
"file" : "lib/LWP.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Authen::Basic" : {
"file" : "lib/LWP/Authen/Basic.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Authen::Digest" : {
"file" : "lib/LWP/Authen/Digest.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Authen::Ntlm" : {
"file" : "lib/LWP/Authen/Ntlm.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::ConnCache" : {
"file" : "lib/LWP/ConnCache.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Debug" : {
"file" : "lib/LWP/Debug.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Debug::TraceHTTP" : {
"file" : "lib/LWP/Debug/TraceHTTP.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Debug::TraceHTTP::Socket" : {
"file" : "lib/LWP/Debug/TraceHTTP.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::DebugFile" : {
"file" : "lib/LWP/DebugFile.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::MemberMixin" : {
"file" : "lib/LWP/MemberMixin.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol" : {
"file" : "lib/LWP/Protocol.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::MyFTP" : {
"file" : "lib/LWP/Protocol/ftp.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::cpan" : {
"file" : "lib/LWP/Protocol/cpan.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::data" : {
"file" : "lib/LWP/Protocol/data.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::file" : {
"file" : "lib/LWP/Protocol/file.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::ftp" : {
"file" : "lib/LWP/Protocol/ftp.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::gopher" : {
"file" : "lib/LWP/Protocol/gopher.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::http" : {
"file" : "lib/LWP/Protocol/http.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::http::Socket" : {
"file" : "lib/LWP/Protocol/http.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::http::SocketMethods" : {
"file" : "lib/LWP/Protocol/http.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::loopback" : {
"file" : "lib/LWP/Protocol/loopback.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::mailto" : {
"file" : "lib/LWP/Protocol/mailto.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::nntp" : {
"file" : "lib/LWP/Protocol/nntp.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Protocol::nogo" : {
"file" : "lib/LWP/Protocol/nogo.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::RobotUA" : {
"file" : "lib/LWP/RobotUA.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::Simple" : {
"file" : "lib/LWP/Simple.pm",
- "version" : "6.22"
+ "version" : "6.23"
},
"LWP::UserAgent" : {
"file" : "lib/LWP/UserAgent.pm",
- "version" : "6.22"
+ "version" : "6.23"
}
},
"release_status" : "stable",
"x_IRC" : "irc://irc.perl.org/#lwp",
"x_MailingList" : "mailto:libwww@perl.org"
},
- "version" : "6.22",
+ "version" : "6.23",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.024000"
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
- "git --version" : "2.11.0",
+ "git --version" : "2.10.2",
"repo_root" : "."
}
},
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
- "git --version" : "2.11.0",
+ "git --version" : "2.10.2",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
"branch" : null,
"changelog" : "Changes",
"signed" : 0,
- "tag" : "v6.22",
+ "tag" : "v6.23",
"tag_format" : "v%v",
"tag_message" : "v%v"
},
"Dist::Zilla::Role::Git::Repo" : {
- "git --version" : "2.11.0",
+ "git --version" : "2.10.2",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
"remotes_must_exist" : 1
},
"Dist::Zilla::Role::Git::Repo" : {
- "git --version" : "2.11.0",
+ "git --version" : "2.10.2",
"repo_root" : "."
}
},
"class" : "Dist::Zilla::Plugin::Git::Contributors",
"config" : {
"Dist::Zilla::Plugin::Git::Contributors" : {
- "git --version" : "2.11.0",
+ "git --version" : "2.10.2",
"include_authors" : 0,
"include_releaser" : 1,
"order_by" : "name",
"afPuUsSedvhx",
"de",
"erik",
+ "getprint",
+ "getstore",
"peterm",
"shildreth"
],
provides:
LWP:
file: lib/LWP.pm
- version: '6.22'
+ version: '6.23'
LWP::Authen::Basic:
file: lib/LWP/Authen/Basic.pm
- version: '6.22'
+ version: '6.23'
LWP::Authen::Digest:
file: lib/LWP/Authen/Digest.pm
- version: '6.22'
+ version: '6.23'
LWP::Authen::Ntlm:
file: lib/LWP/Authen/Ntlm.pm
- version: '6.22'
+ version: '6.23'
LWP::ConnCache:
file: lib/LWP/ConnCache.pm
- version: '6.22'
+ version: '6.23'
LWP::Debug:
file: lib/LWP/Debug.pm
- version: '6.22'
+ version: '6.23'
LWP::Debug::TraceHTTP:
file: lib/LWP/Debug/TraceHTTP.pm
- version: '6.22'
+ version: '6.23'
LWP::Debug::TraceHTTP::Socket:
file: lib/LWP/Debug/TraceHTTP.pm
- version: '6.22'
+ version: '6.23'
LWP::DebugFile:
file: lib/LWP/DebugFile.pm
- version: '6.22'
+ version: '6.23'
LWP::MemberMixin:
file: lib/LWP/MemberMixin.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol:
file: lib/LWP/Protocol.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::MyFTP:
file: lib/LWP/Protocol/ftp.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::cpan:
file: lib/LWP/Protocol/cpan.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::data:
file: lib/LWP/Protocol/data.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::file:
file: lib/LWP/Protocol/file.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::ftp:
file: lib/LWP/Protocol/ftp.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::gopher:
file: lib/LWP/Protocol/gopher.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::http:
file: lib/LWP/Protocol/http.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::http::Socket:
file: lib/LWP/Protocol/http.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::http::SocketMethods:
file: lib/LWP/Protocol/http.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::loopback:
file: lib/LWP/Protocol/loopback.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::mailto:
file: lib/LWP/Protocol/mailto.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::nntp:
file: lib/LWP/Protocol/nntp.pm
- version: '6.22'
+ version: '6.23'
LWP::Protocol::nogo:
file: lib/LWP/Protocol/nogo.pm
- version: '6.22'
+ version: '6.23'
LWP::RobotUA:
file: lib/LWP/RobotUA.pm
- version: '6.22'
+ version: '6.23'
LWP::Simple:
file: lib/LWP/Simple.pm
- version: '6.22'
+ version: '6.23'
LWP::UserAgent:
file: lib/LWP/UserAgent.pm
- version: '6.22'
+ version: '6.23'
requires:
Digest::MD5: '0'
Encode: '2.12'
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=libwww-perl
homepage: https://github.com/libwww-perl/libwww-perl
repository: https://github.com/libwww-perl/libwww-perl.git
-version: '6.22'
+version: '6.23'
x_Dist_Zilla:
perl:
version: '5.024000'
allow_dirty_match: []
changelog: Changes
Dist::Zilla::Role::Git::Repo:
- 'git --version': 2.11.0
+ 'git --version': 2.10.2
repo_root: .
name: '@Git/Check'
version: '2.041'
allow_dirty_match: []
changelog: Changes
Dist::Zilla::Role::Git::Repo:
- 'git --version': 2.11.0
+ 'git --version': 2.10.2
repo_root: .
Dist::Zilla::Role::Git::StringFormatter:
time_zone: local
branch: ~
changelog: Changes
signed: 0
- tag: v6.22
+ tag: v6.23
tag_format: v%v
tag_message: v%v
Dist::Zilla::Role::Git::Repo:
- 'git --version': 2.11.0
+ 'git --version': 2.10.2
repo_root: .
Dist::Zilla::Role::Git::StringFormatter:
time_zone: local
- origin
remotes_must_exist: 1
Dist::Zilla::Role::Git::Repo:
- 'git --version': 2.11.0
+ 'git --version': 2.10.2
repo_root: .
name: '@Git/Push'
version: '2.041'
class: Dist::Zilla::Plugin::Git::Contributors
config:
Dist::Zilla::Plugin::Git::Contributors:
- 'git --version': 2.11.0
+ 'git --version': 2.10.2
include_authors: 0
include_releaser: 1
order_by: name
- afPuUsSedvhx
- de
- erik
+ - getprint
+ - getstore
- peterm
- shildreth
wordlist: Pod::Wordlist
"Test::More" => 0,
"Test::RequiresInternet" => 0
},
- "VERSION" => "6.22",
+ "VERSION" => "6.23",
"test" => {
- "TESTS" => "t/*.t t/base/*.t t/local/*.t t/robot/*.t"
+ "TESTS" => "t/*.t t/base/*.t t/base/protocols/*.t t/local/*.t t/robot/*.t"
}
);
# user/password if document is protected.
{
package RequestAgent;
-$RequestAgent::VERSION = '6.22';
+$RequestAgent::VERSION = '6.23';
use base qw(LWP::UserAgent);
sub new
copyright_holder = Gisle Aas
copyright_year = 1995
-version = 6.22
+version = 6.23
; Gather stuff in
[Git::GatherDir]
xt_mode = 1
[Test::Portability]
-; TODO perltidy for NoTabs and namespace::autoclean
+; TODO perltidy for NoTabs and namespace::autoclean
; [Test::CleanNamespaces] ; TODO
; [Test::NoTabs] ; TODO
[Test::EOL]
stopword = peterm
stopword = de
stopword = erik
+stopword = getprint
+stopword = getstore
[RunExtraTests]
package LWP;
-our $VERSION = '6.22';
+our $VERSION = '6.23';
require 5.008;
require LWP::UserAgent; # this should load everything you need
package LWP::Authen::Basic;
-$LWP::Authen::Basic::VERSION = '6.22';
+$LWP::Authen::Basic::VERSION = '6.23';
use strict;
require MIME::Base64;
package LWP::Authen::Digest;
-$LWP::Authen::Digest::VERSION = '6.22';
+$LWP::Authen::Digest::VERSION = '6.23';
use strict;
use base 'LWP::Authen::Basic';
use strict;
-our $VERSION = '6.22';
+our $VERSION = '6.23';
use Authen::NTLM "1.02";
use MIME::Base64 "2.12";
use strict;
-our $VERSION = '6.22';
+our $VERSION = '6.23';
our $DEBUG;
sub new {
The C<LWP::ConnCache> class is the standard connection cache manager
for L<LWP::UserAgent>.
+=head1 METHODS
+
The following basic methods are provided:
-=over
+=head2 new
-=item $cache = LWP::ConnCache->new( %options )
+ my $cache = LWP::ConnCache->new( %options )
This method constructs a new L<LWP::ConnCache> object. The only
-option currently accepted is 'total_capacity'. If specified it
-initialize the total_capacity option. It defaults to the value 1.
+option currently accepted is C<total_capacity>. If specified it
+initialize the L<LWP::ConnCache/total_capacity> option. It defaults to C<1>.
+
+=head2 total_capacity
-=item $cache->total_capacity( [$num_connections] )
+ my $cap = $cache->total_capacity;
+ $cache->total_capacity(0); # drop all immediately
+ $cache->total_capacity(undef); # no limit
+ $cache->total_capacity($number);
Get/sets the number of connection that will be cached. Connections
will start to be dropped when this limit is reached. If set to C<0>,
then all connections are immediately dropped. If set to C<undef>,
then there is no limit.
-=item $cache->capacity($type, [$num_connections] )
+=head2 capacity
+
+ my $http_capacity = $cache->capacity('http');
+ $cache->capacity('http', 2 );
Get/set a limit for the number of connections of the specified type
-that can be cached. The $type will typically be a short string like
+that can be cached. The first parameter is a short string like
"http" or "ftp".
-=item $cache->drop( [$checker, [$reason]] )
+=head2 drop
+
+ $cache->drop(); # Drop ALL connections
+ # which is just a synonym for:
+ $cache->drop(sub{1}); # Drop ALL connections
+ # drop all connections older than 22 seconds and add a reason for it!
+ $cache->drop(22, "Older than 22 secs dropped");
+ # which is just a synonym for:
+ $cache->drop(sub {
+ my ($conn, $type, $key, $deposit_time) = @_;
+ if ($deposit_time < 22) {
+ # true values drop the connection
+ return 1;
+ }
+ # false values don't drop the connection
+ return 0;
+ }, "Older than 22 secs dropped" );
Drop connections by some criteria. The $checker argument is a
subroutine that is called for each connection. If the routine returns
dropped. If $checker is a string then all connections of the given
type are dropped.
-The $reason argument is passed on to the dropped() method.
+The C<reason> is passed on to the L<LWP::ConnCache/dropped> method.
-=item $cache->prune
+=head2 prune
+
+ $cache->prune();
Calling this method will drop all connections that are dead. This is
-tested by calling the ping() method on the connections. If the ping()
-method exists and returns a FALSE value, then the connection is
-dropped.
+tested by calling the L<LWP::ConnCache/ping> method on the connections. If
+the L<LWP::ConnCache/ping> method exists and returns a false value, then the
+connection is dropped.
+
+=head2 get_types
-=item $cache->get_types
+ my @types = $cache->get_types();
-This returns all the 'type' fields used for the currently cached
+This returns all the C<type> fields used for the currently cached
connections.
-=item $cache->get_connections( [$type] )
+=head2 get_connections
+
+ my @conns = $cache->get_connections(); # all connections
+ my @conns = $cache->get_connections('http'); # connections for http
This returns all connection objects of the specified type. If no type
is specified then all connections are returned. In scalar context the
number of cached connections of the specified type is returned.
-=back
-
+=head1 PROTOCOL METHODS
The following methods are called by low-level protocol modules to
try to save away connections and to get them back.
-=over
+=head2 deposit
-=item $cache->deposit($type, $key, $conn)
+ $cache->deposit($type, $key, $conn);
-This method adds a new connection to the cache. As a result other
+This method adds a new connection to the cache. As a result, other
already cached connections might be dropped. Multiple connections with
-the same $type/$key might added.
+the same type/key might be added.
+
+=head2 withdraw
-=item $conn = $cache->withdraw($type, $key)
+ my $conn = $cache->withdraw($type, $key);
This method tries to fetch back a connection that was previously
deposited. If no cached connection with the specified $type/$key is
deposited connection can be withdrawn, as the cache manger is free to
drop connections at any time.
-=back
+=head1 INTERNAL METHODS
The following methods are called internally. Subclasses might want to
override them.
-=over
+=head2 enforce_limits
-=item $conn->enforce_limits([$type])
+ $conn->enforce_limits([$type])
This method is called with after a new connection is added (deposited)
in the cache or capacity limits are adjusted. The default
implementation drops connections until the specified capacity limits
are not exceeded.
-=item $conn->dropping($conn_record, $reason)
+=head2 dropping
+
+ $conn->dropping($conn_record, $reason)
This method is called when a connection is dropped. The record
belonging to the dropped connection is passed as the first argument
and a string describing the reason for the drop is passed as the
second argument. The default implementation makes some noise if the
-$LWP::ConnCache::DEBUG variable is set and nothing more.
-
-=back
+C<$LWP::ConnCache::DEBUG> variable is set and nothing more.
=head1 SUBCLASSING
For specialized cache policy it makes sense to subclass
-C<LWP::ConnCache> and perhaps override the deposit(), enforce_limits()
-and dropping() methods.
+C<LWP::ConnCache> and perhaps override the L<LWP::ConnCache/deposit>,
+L<LWP::ConnCache/enforce_limits>, and L<LWP::ConnCache/dropping> methods.
The object itself is a hash. Keys prefixed with C<cc_> are reserved
for the base class.
package LWP::Debug; # legacy
-$LWP::Debug::VERSION = '6.22';
+$LWP::Debug::VERSION = '6.23';
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(level trace debug conns);
package LWP::Debug::TraceHTTP;
-$LWP::Debug::TraceHTTP::VERSION = '6.22';
+$LWP::Debug::TraceHTTP::VERSION = '6.23';
# Just call:
#
# require LWP::Debug::TraceHTTP;
use base 'LWP::Protocol::http';
package LWP::Debug::TraceHTTP::Socket;
-$LWP::Debug::TraceHTTP::Socket::VERSION = '6.22';
+$LWP::Debug::TraceHTTP::Socket::VERSION = '6.23';
use Data::Dump 1.13;
use Data::Dump::Trace qw(autowrap mcall);
package LWP::DebugFile;
-$LWP::DebugFile::VERSION = '6.22';
+$LWP::DebugFile::VERSION = '6.23';
# legacy stub
1;
package LWP::MemberMixin;
-$LWP::MemberMixin::VERSION = '6.22';
+$LWP::MemberMixin::VERSION = '6.23';
sub _elem {
my $self = shift;
my $elem = shift;
=head1 SYNOPSIS
package Foo;
- require LWP::MemberMixin;
- @ISA=qw(LWP::MemberMixin);
+ use base qw(LWP::MemberMixin);
=head1 DESCRIPTION
variables in the C<%$self>.
Ideally there should be better Perl language support for this.
+=head1 METHODS
+
There is only one method provided:
-=over 4
+=head2 _elem
-=item _elem($elem [, $val])
+ _elem($elem [, $val])
Internal method to get/set the value of member variable
C<$elem>. If C<$val> is present it is used as the new value
value is not touched. In both cases the previous value of
the member variable is returned.
-=back
-
=cut
use base 'LWP::MemberMixin';
-our $VERSION = '6.22';
+our $VERSION = '6.23';
use strict;
use Carp ();
=head1 SYNOPSIS
package LWP::Protocol::foo;
- require LWP::Protocol;
- @ISA=qw(LWP::Protocol);
+ use base qw(LWP::Protocol);
=head1 DESCRIPTION
When creating an instance of this class using
C<LWP::Protocol::create($url)>, and you get an initialized subclass
appropriate for that access method. In other words, the
-LWP::Protocol::create() function calls the constructor for one of its
+L<LWP::Protocol/create> function calls the constructor for one of its
subclasses.
All derived C<LWP::Protocol> classes need to override the request()
make use of the collect() function to collect together chunks of data
as it is received.
+=head1 METHODS
+
The following methods and functions are provided:
-=over 4
+=head2 new
-=item $prot = LWP::Protocol->new()
+ my $prot = LWP::Protocol->new();
The LWP::Protocol constructor is inherited by subclasses. As this is a
virtual base class this method should B<not> be called directly.
-=item $prot = LWP::Protocol::create($scheme)
+=head2 create
+
+ my $prot = LWP::Protocol::create($scheme)
Create an object of the class implementing the protocol to handle the
given scheme. This is a function, not a method. It is more an object
factory than a constructor. This is the function user agents should
use to access protocols.
-=item $class = LWP::Protocol::implementor($scheme, [$class])
+=head2 implementor
+
+ my $class = LWP::Protocol::implementor($scheme, [$class])
-Get and/or set implementor class for a scheme. Returns '' if the
+Get and/or set implementor class for a scheme. Returns C<''> if the
specified scheme is not supported.
-=item $prot->request(...)
+=head2 request
- $response = $protocol->request($request, $proxy, undef);
- $response = $protocol->request($request, $proxy, '/tmp/sss');
- $response = $protocol->request($request, $proxy, \&callback, 1024);
+ $response = $protocol->request($request, $proxy, undef);
+ $response = $protocol->request($request, $proxy, '/tmp/sss');
+ $response = $protocol->request($request, $proxy, \&callback, 1024);
Dispatches a request over the protocol, and returns a response
object. This method needs to be overridden in subclasses. Refer to
L<LWP::UserAgent> for description of the arguments.
-=item $prot->collect($arg, $response, $collector)
+=head2 collect
-Called to collect the content of a request, and process it
-appropriately into a scalar, file, or by calling a callback. If $arg
-is undefined, then the content is stored within the $response. If
-$arg is a simple scalar, then $arg is interpreted as a file name and
-the content is written to this file. If $arg is a reference to a
-routine, then content is passed to this routine.
+ my $res = $prot->collect(undef, $response, $collector); # stored in $response
+ my $res = $prot->collect($filename, $response, $collector);
+ my $res = $prot->collect(sub { ... }, $response, $collector);
-The $collector is a routine that will be called and which is
+Collect the content of a request, and process it appropriately into a scalar,
+file, or by calling a callback. If the first parameter is undefined, then the
+content is stored within the C<$response>. If it's a simple scalar, then it's
+interpreted as a file name and the content is written to this file. If it's a
+code reference, then content is passed to this routine.
+
+The collector is a routine that will be called and which is
responsible for returning pieces (as ref to scalar) of the content to
-process. The $collector signals EOF by returning a reference to an
+process. The C<$collector> signals C<EOF> by returning a reference to an
empty string.
-The return value from collect() is the $response object reference.
+The return value is the L<HTTP::Response> object reference.
B<Note:> We will only use the callback or file argument if
-$response->is_success(). This avoids sending content data for
+C<< $response->is_success() >>. This avoids sending content data for
redirects and authentication responses to the callback which would be
confusing.
-=item $prot->collect_once($arg, $response, $content)
+=head2 collect_once
-Can be called when the whole response content is available as
-$content. This will invoke collect() with a collector callback that
-returns a reference to $content the first time and an empty string the
-next.
+ $prot->collect_once($arg, $response, $content)
-=back
+Can be called when the whole response content is available as content. This
+will invoke L<LWP::Protocol/collect> with a collector callback that
+returns a reference to C<$content> the first time and an empty string the
+next.
=head1 SEE ALSO
package LWP::Protocol::cpan;
-$LWP::Protocol::cpan::VERSION = '6.22';
+$LWP::Protocol::cpan::VERSION = '6.23';
use strict;
use base qw(LWP::Protocol);
package LWP::Protocol::data;
-$LWP::Protocol::data::VERSION = '6.22';
+$LWP::Protocol::data::VERSION = '6.23';
# Implements access to data:-URLs as specified in RFC 2397
use strict;
package LWP::Protocol::file;
-$LWP::Protocol::file::VERSION = '6.22';
+$LWP::Protocol::file::VERSION = '6.23';
use base qw(LWP::Protocol);
use strict;
package LWP::Protocol::ftp;
-$LWP::Protocol::ftp::VERSION = '6.22';
+$LWP::Protocol::ftp::VERSION = '6.23';
# Implementation of the ftp protocol (RFC 959). We let the Net::FTP
# package do all the dirty work.
use strict;
eval {
package LWP::Protocol::MyFTP;
-$LWP::Protocol::MyFTP::VERSION = '6.22';
+$LWP::Protocol::MyFTP::VERSION = '6.23';
require Net::FTP;
Net::FTP->require_version(2.00);
package LWP::Protocol::gopher;
-$LWP::Protocol::gopher::VERSION = '6.22';
+$LWP::Protocol::gopher::VERSION = '6.23';
# Implementation of the gopher protocol (RFC 1436)
#
# This code is based on 'wwwgopher.pl,v 0.10 1994/10/17 18:12:34 shelden'
package LWP::Protocol::http;
-$LWP::Protocol::http::VERSION = '6.22';
+$LWP::Protocol::http::VERSION = '6.23';
use strict;
require HTTP::Response;
#-----------------------------------------------------------
package LWP::Protocol::http::SocketMethods;
-$LWP::Protocol::http::SocketMethods::VERSION = '6.22';
+$LWP::Protocol::http::SocketMethods::VERSION = '6.23';
sub ping {
my $self = shift;
!$self->can_read(0);
#-----------------------------------------------------------
package LWP::Protocol::http::Socket;
-$LWP::Protocol::http::Socket::VERSION = '6.22';
+$LWP::Protocol::http::Socket::VERSION = '6.23';
use base qw(LWP::Protocol::http::SocketMethods Net::HTTP);
1;
package LWP::Protocol::loopback;
-$LWP::Protocol::loopback::VERSION = '6.22';
+$LWP::Protocol::loopback::VERSION = '6.23';
use strict;
require HTTP::Response;
package LWP::Protocol::mailto;
-$LWP::Protocol::mailto::VERSION = '6.22';
+$LWP::Protocol::mailto::VERSION = '6.23';
# This module implements the mailto protocol. It is just a simple
# frontend to the Unix sendmail program except on MacOS, where it uses
# Mail::Internet.
package LWP::Protocol::nntp;
-$LWP::Protocol::nntp::VERSION = '6.22';
+$LWP::Protocol::nntp::VERSION = '6.23';
# Implementation of the Network News Transfer Protocol (RFC 977)
use base qw(LWP::Protocol);
use strict;
-sub request
-{
- my($self, $request, $proxy, $arg, $size, $timeout) = @_;
+sub request {
+ my ($self, $request, $proxy, $arg, $size, $timeout) = @_;
$size = 4096 unless $size;
# Check for proxy
if (defined $proxy) {
- return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
- 'You can not proxy through NNTP');
+ return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
+ 'You can not proxy through NNTP');
}
# Check that the scheme is as expected
- my $url = $request->uri;
+ my $url = $request->uri;
my $scheme = $url->scheme;
unless ($scheme eq 'news' || $scheme eq 'nntp') {
- return HTTP::Response->new(HTTP::Status::RC_INTERNAL_SERVER_ERROR,
- "LWP::Protocol::nntp::request called for '$scheme'");
+ return HTTP::Response->new(HTTP::Status::RC_INTERNAL_SERVER_ERROR,
+ "LWP::Protocol::nntp::request called for '$scheme'");
}
# check for a valid method
my $method = $request->method;
unless ($method eq 'GET' || $method eq 'HEAD' || $method eq 'POST') {
- return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
- 'Library does not allow method ' .
- "$method for '$scheme:' URLs");
+ return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
+ 'Library does not allow method ' . "$method for '$scheme:' URLs");
}
# extract the identifier and check against posting to an article
my $groupart = $url->_group;
- my $is_art = $groupart =~ /@/;
+ my $is_art = $groupart =~ /@/;
if ($is_art && $method eq 'POST') {
- return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
- "Can't post to an article <$groupart>");
+ return HTTP::Response->new(HTTP::Status::RC_BAD_REQUEST,
+ "Can't post to an article <$groupart>");
}
- my $nntp = Net::NNTP->new($url->host,
- #Port => 18574,
- Timeout => $timeout,
- #Debug => 1,
- );
+ my $nntp = Net::NNTP->new(
+ $url->host,
+
+ #Port => 18574,
+ Timeout => $timeout,
+
+ #Debug => 1,
+ );
die "Can't connect to nntp server" unless $nntp;
# Check the initial welcome message from the NNTP server
if ($nntp->status != 2) {
- return HTTP::Response->new(HTTP::Status::RC_SERVICE_UNAVAILABLE,
- $nntp->message);
+ return HTTP::Response->new(HTTP::Status::RC_SERVICE_UNAVAILABLE,
+ $nntp->message);
}
my $response = HTTP::Response->new(HTTP::Status::RC_OK, "OK");
# First we handle posting of articles
if ($method eq 'POST') {
- $nntp->quit; $nntp = undef;
- $response->code(HTTP::Status::RC_NOT_IMPLEMENTED);
- $response->message("POST not implemented yet");
- return $response;
+ $nntp->quit;
+ $nntp = undef;
+ $response->code(HTTP::Status::RC_NOT_IMPLEMENTED);
+ $response->message("POST not implemented yet");
+ return $response;
}
# The method must be "GET" or "HEAD" by now
if (!$is_art) {
- if (!$nntp->group($groupart)) {
- $response->code(HTTP::Status::RC_NOT_FOUND);
- $response->message($nntp->message);
- }
- $nntp->quit; $nntp = undef;
- # HEAD: just check if the group exists
- if ($method eq 'GET' && $response->is_success) {
- $response->code(HTTP::Status::RC_NOT_IMPLEMENTED);
- $response->message("GET newsgroup not implemented yet");
- }
- return $response;
+ if (!$nntp->group($groupart)) {
+ $response->code(HTTP::Status::RC_NOT_FOUND);
+ $response->message($nntp->message);
+ }
+ $nntp->quit;
+ $nntp = undef;
+
+ # HEAD: just check if the group exists
+ if ($method eq 'GET' && $response->is_success) {
+ $response->code(HTTP::Status::RC_NOT_IMPLEMENTED);
+ $response->message("GET newsgroup not implemented yet");
+ }
+ return $response;
}
# Send command to server to retrieve an article (or just the headers)
my $get = $method eq 'HEAD' ? "head" : "article";
my $art = $nntp->$get("<$groupart>");
unless ($art) {
- $nntp->quit; $nntp = undef;
- $response->code(HTTP::Status::RC_NOT_FOUND);
- $response->message($nntp->message);
- return $response;
+ $nntp->quit;
+ $response->code(HTTP::Status::RC_NOT_FOUND);
+ $response->message($nntp->message);
+ $nntp = undef;
+ return $response;
}
# Parse headers
- my($key, $val);
+ my ($key, $val);
local $_;
while ($_ = shift @$art) {
- if (/^\s+$/) {
- last; # end of headers
- }
- elsif (/^(\S+):\s*(.*)/) {
- $response->push_header($key, $val) if $key;
- ($key, $val) = ($1, $2);
- }
- elsif (/^\s+(.*)/) {
- next unless $key;
- $val .= $1;
- }
- else {
- unshift(@$art, $_);
- last;
- }
+ if (/^\s+$/) {
+ last; # end of headers
+ }
+ elsif (/^(\S+):\s*(.*)/) {
+ $response->push_header($key, $val) if $key;
+ ($key, $val) = ($1, $2);
+ }
+ elsif (/^\s+(.*)/) {
+ next unless $key;
+ $val .= $1;
+ }
+ else {
+ unshift(@$art, $_);
+ last;
+ }
}
$response->push_header($key, $val) if $key;
# Ensure that there is a Content-Type header
$response->header("Content-Type", "text/plain")
- unless $response->header("Content-Type");
+ unless $response->header("Content-Type");
# Collect the body
- $response = $self->collect_once($arg, $response, join("", @$art))
- if @$art;
+ $response = $self->collect_once($arg, $response, join("", @$art)) if @$art;
# Say goodbye to the server
$nntp->quit;
# LWP::Protocol::implementor(that_scheme, 'LWP::Protocol::nogo');
# For then on, attempts to access URLs with that scheme will generate
# a 500 error.
-$LWP::Protocol::nogo::VERSION = '6.22';
+$LWP::Protocol::nogo::VERSION = '6.23';
use strict;
require HTTP::Response;
use base qw(LWP::UserAgent);
-our $VERSION = '6.22';
+our $VERSION = '6.23';
require WWW::RobotRules;
require HTTP::Request;
and they should not make requests too frequently.
But before you consider writing a robot, take a look at
-<URL:http://www.robotstxt.org/>.
+L<URL:http://www.robotstxt.org/>.
When you use an I<LWP::RobotUA> object as your user agent, then you do not
really have to think about these things yourself; C<robots.txt> files
=head1 METHODS
-The LWP::RobotUA is a sub-class of LWP::UserAgent and implements the
+The LWP::RobotUA is a sub-class of L<LWP::UserAgent> and implements the
same methods. In addition the following methods are provided:
-=over 4
+=head2 new
-=item $ua = LWP::RobotUA->new( %options )
-
-=item $ua = LWP::RobotUA->new( $agent, $from )
-
-=item $ua = LWP::RobotUA->new( $agent, $from, $rules )
+ my $ua = LWP::RobotUA->new( %options )
+ my $ua = LWP::RobotUA->new( $agent, $from )
+ my $ua = LWP::RobotUA->new( $agent, $from, $rules )
The LWP::UserAgent options C<agent> and C<from> are mandatory. The
options C<delay>, C<use_sleep> and C<rules> initialize attributes
It is also possible to just pass the value of C<agent>, C<from> and
optionally C<rules> as plain positional arguments.
-=item $ua->delay
+=head2 delay
-=item $ua->delay( $minutes )
+ my $delay = $ua->delay;
+ $ua->delay( $minutes );
Get/set the minimum delay between requests to the same server, in
-I<minutes>. The default is 1 minute. Note that this number doesn't
-have to be an integer; for example, this sets the delay to 10 seconds:
+I<minutes>. The default is C<1> minute. Note that this number doesn't
+have to be an integer; for example, this sets the delay to C<10> seconds:
$ua->delay(10/60);
-=item $ua->use_sleep
+=head2 use_sleep
-=item $ua->use_sleep( $boolean )
+ my $bool = $ua->use_sleep;
+ $ua->use_sleep( $boolean );
-Get/set a value indicating whether the UA should sleep() if requests
-arrive too fast, defined as $ua->delay minutes not passed since
-last request to the given server. The default is TRUE. If this value is
-FALSE then an internal SERVICE_UNAVAILABLE response will be generated.
-It will have a Retry-After header that indicates when it is OK to
+Get/set a value indicating whether the UA should L<LWP::RobotUA/sleep> if
+requests arrive too fast, defined as C<< $ua->delay >> minutes not passed since
+last request to the given server. The default is true. If this value is
+false then an internal C<SERVICE_UNAVAILABLE> response will be generated.
+It will have a C<Retry-After> header that indicates when it is OK to
send another request to this server.
-=item $ua->rules
+=head2 rules
-=item $ua->rules( $rules )
+ my $rules = $ua->rules;
+ $ua->rules( $rules );
Set/get which I<WWW::RobotRules> object to use.
-=item $ua->no_visits( $netloc )
+=head2 no_visits
+
+ my $num = $ua->no_visits( $netloc )
Returns the number of documents fetched from this server host. Yeah I
-know, this method should probably have been named num_visits() or
+know, this method should probably have been named C<num_visits> or
something like that. :-(
-=item $ua->host_wait( $netloc )
+=head2 host_wait
+
+ my $num = $ua->host_wait( $netloc )
Returns the number of I<seconds> (from now) you must wait before you can
make a new request to this host.
-=item $ua->as_string
+=head2 as_string
+
+ my $string = $ua->as_string;
Returns a string that describes the state of the UA.
Mainly useful for debugging.
-=back
-
=head1 SEE ALSO
L<LWP::UserAgent>, L<WWW::RobotRules>
use strict;
-our $VERSION = '6.22';
+our $VERSION = '6.23';
require Exporter;
sent and responses received, then you should use the full object-oriented
interface provided by the L<LWP::UserAgent> module.
+The module will also export the L<LWP::UserAgent> object as C<$ua> if you
+ask for it explicitly.
+
+The user agent created by this module will identify itself as
+C<LWP::Simple/#.##>
+and will initialize its proxy defaults from the environment (by
+calling C<< $ua->env_proxy >>).
+
+=head1 FUNCTIONS
+
The following functions are provided (and exported) by this module:
-=over 3
+=head2 get
-=item get($url)
+ my $res = get($url);
The get() function will fetch the document identified by the given URL
-and return it. It returns C<undef> if it fails. The $url argument can
-be either a string or a reference to a URI object.
+and return it. It returns C<undef> if it fails. The C<$url> argument can
+be either a string or a reference to a L<URI> object.
You will not be able to examine the response code or response headers
-(like 'Content-Type') when you are accessing the web using this
+(like C<Content-Type>) when you are accessing the web using this
function. If you need that information you should use the full OO
interface (see L<LWP::UserAgent>).
-=item head($url)
+=head2 head
+
+ my $res = head($url);
Get document headers. Returns the following 5 values if successful:
($content_type, $document_length, $modified_time, $expires, $server)
Returns an empty list if it fails. In scalar context returns TRUE if
successful.
-=item getprint($url)
+=head2 getprint
+
+ my $code = getprint($url);
Get and print a document identified by a URL. The document is printed
to the selected default filehandle for output (normally STDOUT) as
status code and message are printed on STDERR. The return value is
the HTTP response code.
-=item getstore($url, $file)
+=head2 getstore
+
+ my $code = getstore($url, $file)
Gets a document identified by a URL and stores it in the file. The
return value is the HTTP response code.
-=item mirror($url, $file)
+=head2 mirror
+
+ my $code = mirror($url, $file);
Get and store a document identified by a URL, using
I<If-modified-since>, and checking the I<Content-Length>. Returns
the HTTP response code.
-=back
+=head1 STATUS CONSTANTS
-This module also exports the HTTP::Status constants and procedures.
-You can use them when you check the response code from getprint(),
-getstore() or mirror(). The constants are:
+This module also exports the L<HTTP::Status> constants and procedures.
+You can use them when you check the response code from L<LWP::Simple/getprint>,
+L<LWP::Simple/getstore> or L<LWP::Simple/mirror>. The constants are:
RC_CONTINUE
RC_SWITCHING_PROTOCOLS
RC_GATEWAY_TIMEOUT
RC_HTTP_VERSION_NOT_SUPPORTED
-The HTTP::Status classification functions are:
+=head1 CLASSIFICATION FUNCTIONS
+
+The L<HTTP::Status> classification functions are:
-=over 3
+=head2 is_success
-=item is_success($rc)
+ my $bool = is_success($rc);
True if response code indicated a successful request.
-=item is_error($rc)
+=head2 is_error
-True if response code indicated that an error occurred.
+ my $bool = is_error($rc)
-=back
-
-The module will also export the LWP::UserAgent object as C<$ua> if you
-ask for it explicitly.
-
-The user agent created by this module will identify itself as
-"LWP::Simple/#.##"
-and will initialize its proxy defaults from the environment (by
-calling $ua->env_proxy).
+True if response code indicated that an error occurred.
=head1 CAVEAT
-Note that if you are using both LWP::Simple and the very popular CGI.pm
+Note that if you are using both LWP::Simple and the very popular L<CGI>
module, you may be importing a C<head> function from each module,
-producing a warning like "Prototype mismatch: sub main::head ($) vs
-none". Get around this problem by just not importing LWP::Simple's
+producing a warning like C<Prototype mismatch: sub main::head ($) vs none>.
+Get around this problem by just not importing LWP::Simple's
C<head> function, like so:
use LWP::Simple qw(!head);
use Scalar::Util qw(blessed);
use Try::Tiny qw(try catch);
-our $VERSION = '6.22';
+our $VERSION = '6.23';
sub new
{
=head1 SYNOPSIS
- require LWP::UserAgent;
+ use strict;
+ use warnings;
+ use LWP::UserAgent ();
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
needs to be performed. This request is then passed to one of the
request method the UserAgent, which dispatches it using the relevant
protocol, and returns a L<HTTP::Response> object. There are
-convenience methods for sending the most common request types: get(),
-head(), post(), put() and delete(). When using these methods then the
-creation of the request object is hidden as shown in the synopsis above.
+convenience methods for sending the most common request types:
+L<LWP::UserAgent/get>, L<LWP::UserAgent/head>, L<LWP::UserAgent/post>,
+L<LWP::UserAgent/put> and L<LWP::UserAgent/delete>. When using these
+methods, the creation of the request object is hidden as shown in the
+synopsis above.
-The basic approach of the library is to use HTTP style communication
+The basic approach of the library is to use HTTP-style communication
for all protocol schemes. This means that you will construct
L<HTTP::Request> objects and receive L<HTTP::Response> objects even
for non-HTTP resources like I<gopher> and I<ftp>. In order to achieve
-even more similarity to HTTP style communications, gopher menus and
+even more similarity to HTTP-style communications, I<gopher> menus and
file directories are converted to HTML documents.
=head1 CONSTRUCTOR METHODS
The following constructor methods are available:
-=over 4
+=head2 clone
-=item $ua = LWP::UserAgent->new( %options )
+ my $ua2 = $ua->clone;
+
+Returns a copy of the L<LWP::UserAgent> object.
+
+=head2 new
+
+ my $ua = LWP::UserAgent->new( %options )
This method constructs a new L<LWP::UserAgent> object and returns it.
Key/value pair arguments may be provided to set up the initial state.
cookie_jar undef
default_headers HTTP::Headers->new
local_address undef
- ssl_opts { verify_hostname => 1 }
+ ssl_opts { verify_hostname => 1 }
max_size undef
max_redirect 7
parse_head 1
timeout 180
The following additional options are also accepted: If the C<env_proxy> option
-is passed in with a TRUE value, then proxy settings are read from environment
-variables (see env_proxy() method below). If C<env_proxy> isn't provided the
-C<PERL_LWP_ENV_PROXY> environment variable controls if env_proxy() is called
-during initialization. If the C<keep_alive> option is passed in, then a
-C<LWP::ConnCache> is set up (see conn_cache() method below). The C<keep_alive>
-value is passed on as the C<total_capacity> for the connection cache.
-
-=item $ua->clone
-
-Returns a copy of the LWP::UserAgent object.
-
-=back
+is passed in with a true value, then proxy settings are read from environment
+variables (see L<LWP::UserAgent/env_proxy>). If C<env_proxy> isn't provided, the
+C<PERL_LWP_ENV_PROXY> environment variable controls if
+L<LWP::UserAgent/env_proxy> is called during initialization. If the
+C<keep_alive> option is passed in, then a C<LWP::ConnCache> is set up (see
+L<LWP::UserAgent/conn_cache>). The C<keep_alive> value is passed on as the
+C<total_capacity> for the connection cache.
=head1 ATTRIBUTES
left unchanged if no argument is given. The return value from each
method is the old attribute value.
-=over
-
-=item $ua->agent
+=head2 agent
-=item $ua->agent( $product_id )
+ my $agent = $ua->agent;
+ $ua->agent('Checkbot/0.4 '); # append the defaul to the end
+ $ua->agent('Mozilla/5.0');
+ $ua->agent(""); # don't identify
Get/set the product token that is used to identify the user agent on
-the network. The agent value is sent as the "User-Agent" header in
-the requests. The default is the string returned by the _agent()
-method (see below).
+the network. The agent value is sent as the C<User-Agent> header in
+the requests.
-If the $product_id ends with space then the _agent() string is
-appended to it.
-
-The user agent string should be one or more simple product identifiers
-with an optional version number separated by the "/" character.
-Examples are:
+The default is a string of the form C<libwww-perl/#.###>, where C<#.###> is
+substituted with the version number of this library.
- $ua->agent('Checkbot/0.4 ' . $ua->_agent);
- $ua->agent('Checkbot/0.4 '); # same as above
- $ua->agent('Mozilla/5.0');
- $ua->agent(""); # don't identify
+If the provided string ends with space, the default C<libwww-perl/#.###>
+string is appended to it.
-=item $ua->_agent
-
-Returns the default agent identifier. This is a string of the form
-"libwww-perl/#.###", where "#.###" is substituted with the version number
-of this library.
-
-=item $ua->from
-
-=item $ua->from( $email_address )
+The user agent string should be one or more simple product identifiers
+with an optional version number separated by the C</> character.
-Get/set the e-mail address for the human user who controls
-the requesting user agent. The address should be machine-usable, as
-defined in RFC 822. The C<from> value is send as the "From" header in
-the requests. Example:
+=head2 conn_cache
- $ua->from('gaas@cpan.org');
+ my $cache_obj = $ua->conn_cache;
+ $ua->conn_cache( $cache_obj );
-The default is to not send a "From" header. See the default_headers()
-method for the more general interface that allow any header to be defaulted.
+Get/set the L<LWP::ConnCache> object to use. See L<LWP::ConnCache>
+for details.
-=item $ua->cookie_jar
+=head2 cookie_jar
-=item $ua->cookie_jar( $cookie_jar_obj )
+ my $jar = $ua->cookie_jar;
+ $ua->cookie_jar( $cookie_jar_obj );
Get/set the cookie jar object to use. The only requirement is that
-the cookie jar object must implement the extract_cookies($response) and
-add_cookie_header($request) methods. These methods will then be
+the cookie jar object must implement the C<extract_cookies($response)> and
+C<add_cookie_header($request)> methods. These methods will then be
invoked by the user agent as requests are sent and responses are
received. Normally this will be a L<HTTP::Cookies> object or some
subclass.
-The default is to have no cookie_jar, i.e. never automatically add
-"Cookie" headers to the requests.
+The default is to have no cookie jar, i.e. never automatically add
+C<Cookie> headers to the requests.
-Shortcut: If a reference to a plain hash is passed in as the
-$cookie_jar_object, then it is replaced with an instance of
-L<HTTP::Cookies> that is initialized based on the hash. This form also
-automatically loads the L<HTTP::Cookies> module. It means that:
+Shortcut: If a reference to a plain hash is passed in, it is replaced with an
+instance of L<HTTP::Cookies> that is initialized based on the hash. This form
+also automatically loads the L<HTTP::Cookies> module. It means that:
$ua->cookie_jar({ file => "$ENV{HOME}/.cookies.txt" });
require HTTP::Cookies;
$ua->cookie_jar(HTTP::Cookies->new(file => "$ENV{HOME}/.cookies.txt"));
-=item $ua->default_headers
+=head2 credentials
-=item $ua->default_headers( $headers_obj )
+ my $creds = $ua->credentials();
+ $ua->credentials( $netloc, $realm );
+ $ua->credentials( $netloc, $realm, $uname, $pass );
+ $ua->credentials("www.example.com:80", "Some Realm", "foo", "secret");
-Get/set the headers object that will provide default header values for
-any requests sent. By default this will be an empty L<HTTP::Headers>
-object.
+Get/set the user name and password to be used for a realm.
-=item $ua->default_header( $field )
+The C<$netloc> is a string of the form C<< <host>:<port> >>. The username and
+password will only be passed to this server.
-=item $ua->default_header( $field => $value )
+=head2 default_header
-This is just a short-cut for $ua->default_headers->header( $field =>
-$value ). Example:
+ $ua->default_header( $field );
+ $ua->default_header( $field => $value );
+ $ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodable());
+ $ua->default_header('Accept-Language' => "no, en");
- $ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodable());
- $ua->default_header('Accept-Language' => "no, en");
+This is just a shortcut for
+C<< $ua->default_headers->header( $field => $value ) >>.
-=item $ua->conn_cache
+=head2 default_headers
-=item $ua->conn_cache( $cache_obj )
+ my $headers = $ua->default_headers;
+ $ua->default_headers( $headers_obj );
-Get/set the L<LWP::ConnCache> object to use. See L<LWP::ConnCache>
-for details.
+Get/set the headers object that will provide default header values for
+any requests sent. By default this will be an empty L<HTTP::Headers>
+object.
-=item $ua->credentials( $netloc, $realm )
+=head2 from
-=item $ua->credentials( $netloc, $realm, $uname, $pass )
+ my $from = $ua->from;
+ $ua->from('foo@bar.com');
-Get/set the user name and password to be used for a realm.
+Get/set the email address for the human user who controls
+the requesting user agent. The address should be machine-usable, as
+defined in L<RFC2822|https://tools.ietf.org/html/rfc2822>. The C<from> value
+is sent as the C<From> header in the requests.
-The $netloc is a string of the form "<host>:<port>". The username and
-password will only be passed to this server. Example:
+The default is to not send a C<From> header. See
+L<LWP::UserAgent/default_headers> for the more general interface that allow
+any header to be defaulted.
- $ua->credentials("www.example.com:80", "Some Realm", "foo", "secret");
-=item $ua->local_address
+=head2 local_address
-=item $ua->local_address( $address )
+ my $address = $ua->local_address;
+ $ua->local_address( $address );
Get/set the local interface to bind to for network connections. The interface
can be specified as a hostname or an IP address. This value is passed as the
C<LocalAddr> argument to L<IO::Socket::INET>.
-=item $ua->max_size
+=head2 max_redirect
+
+ my $max = $ua->max_redirect;
+ $ua->max_redirect( $n );
-=item $ua->max_size( $bytes )
+This reads or sets the object's limit of how many times it will obey
+redirection responses in a given request cycle.
+
+By default, the value is C<7>. This means that if you call L<LWP::UserAgent/request>
+and the response is a redirect elsewhere which is in turn a
+redirect, and so on seven times, then LWP gives up after that seventh
+request.
+
+=head2 max_size
+
+ my $size = $ua->max_size;
+ $ua->max_size( $bytes );
Get/set the size limit for response content. The default is C<undef>,
which means that there is no limit. If the returned response content
is only partial, because the size limit was exceeded, then a
-"Client-Aborted" header will be added to the response. The content
+C<Client-Aborted> header will be added to the response. The content
might end up longer than C<max_size> as we abort once appending a
-chunk of data makes the length exceed the limit. The "Content-Length"
+chunk of data makes the length exceed the limit. The C<Content-Length>
header, if present, will indicate the length of the full content and
will normally not be the same as C<< length($res->content) >>.
-=item $ua->max_redirect
+=head2 parse_head
-=item $ua->max_redirect( $n )
-
-This reads or sets the object's limit of how many times it will obey
-redirection responses in a given request cycle.
-
-By default, the value is 7. This means that if you call request()
-method and the response is a redirect elsewhere which is in turn a
-redirect, and so on seven times, then LWP gives up after that seventh
-request.
-
-=item $ua->parse_head
-
-=item $ua->parse_head( $boolean )
+ my $bool = $ua->parse_head;
+ $ua->parse_head( $boolean );
Get/set a value indicating whether we should initialize response
headers from the E<lt>head> section of HTML documents. The default is
-TRUE. Do not turn this off, unless you know what you are doing.
+true. I<Do not turn this off> unless you know what you are doing.
-=item $ua->protocols_allowed
+=head2 protocols_allowed
-=item $ua->protocols_allowed( \@protocols )
+ my $aref = $ua->protocols_allowed; # get allowed protocols
+ $ua->protocols_allowed( \@protocols ); # allow ONLY these
+ $ua->protocols_allowed(undef); # delete the list
+ $ua->protocols_allowed(['http',]); # ONLY allow http
+
+By default, an object has neither a C<protocols_allowed> list, nor a
+L<LWP::UserAgent/protocols_forbidden> list.
This reads (or sets) this user agent's list of protocols that the
request methods will exclusively allow. The protocol names are case
For example: C<< $ua->protocols_allowed( [ 'http', 'https'] ); >>
means that this user agent will I<allow only> those protocols,
and attempts to use this user agent to access URLs with any other
-schemes (like "ftp://...") will result in a 500 error.
-
-To delete the list, call: C<< $ua->protocols_allowed(undef) >>
-
-By default, an object has neither a C<protocols_allowed> list, nor a
-C<protocols_forbidden> list.
+schemes (like C<ftp://...>) will result in a 500 error.
Note that having a C<protocols_allowed> list causes any
-C<protocols_forbidden> list to be ignored.
+L<LWP::UserAgent/protocols_forbidden> list to be ignored.
-=item $ua->protocols_forbidden
+=head2 protocols_forbidden
-=item $ua->protocols_forbidden( \@protocols )
+ my $aref = $ua->protocols_forbidden; # get the forbidden list
+ $ua->protocols_forbidden(\@protocols); # do not allow these
+ $ua->protocols_forbidden(['http',]); # All http reqs get a 500
+ $ua->protocols_forbidden(undef); # delete the list
This reads (or sets) this user agent's list of protocols that the
request method will I<not> allow. The protocol names are case
attempts to use this user agent to access URLs with those schemes
will result in a 500 error.
-To delete the list, call: C<< $ua->protocols_forbidden(undef) >>
-
-=item $ua->requests_redirectable
+=head2 requests_redirectable
-=item $ua->requests_redirectable( \@requests )
+ my $aref = $ua->requests_redirectable;
+ $ua->requests_redirectable( \@requests );
+ $ua->requests_redirectable(['GET', 'HEAD',]); # the default
This reads or sets the object's list of request names that
-C<< $ua->redirect_ok(...) >> will allow redirection for. By
-default, this is C<['GET', 'HEAD']>, as per RFC 2616. To
-change to include 'POST', consider:
+L<LWP::UserAgent/redirect_ok> will allow redirection for. By default, this
+is C<['GET', 'HEAD']>, as per L<RFC 2616|https://tools.ietf.org/html/rfc2616>.
+To change to include C<POST>, consider:
push @{ $ua->requests_redirectable }, 'POST';
-=item $ua->show_progress
+=head2 show_progress
-=item $ua->show_progress( $boolean )
+ my $bool = $ua->show_progress;
+ $ua->show_progress( $boolean );
Get/set a value indicating whether a progress bar should be displayed
-on the terminal as requests are processed. The default is FALSE.
+on the terminal as requests are processed. The default is false.
-=item $ua->timeout
+=head2 ssl_opts
-=item $ua->timeout( $secs )
-
-Get/set the timeout value in seconds. The default timeout() value is
-180 seconds, i.e. 3 minutes.
-
-The requests is aborted if no activity on the connection to the server
-is observed for C<timeout> seconds. This means that the time it takes
-for the complete transaction and the request() method to actually
-return might be longer.
-
-=item $ua->ssl_opts
-
-=item $ua->ssl_opts( $key )
-
-=item $ua->ssl_opts( $key => $value )
+ my @keys = $ua->ssl_opts;
+ my $val = $ua->ssl_opts( $key );
+ $ua->ssl_opts( $key => $value );
Get/set the options for SSL connections. Without argument return the list
of options keys currently set. With a single argument return the current
to install L<LWP::Protocol::https> separately to enable support for processing
https-URLs.
-=back
-
-=head2 Proxy attributes
+=head2 timeout
-The following methods set up when requests should be passed via a
-proxy server.
+ my $secs = $ua->timeout;
+ $ua->timeout( $secs );
-=over
-
-=item $ua->proxy(\@schemes, $proxy_url)
-
-=item $ua->proxy($scheme, $proxy_url)
-
-Set/retrieve proxy URL for a scheme:
-
- $ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
- $ua->proxy('gopher', 'http://proxy.sn.no:8001/');
-
-The first form specifies that the URL is to be used as a proxy for
-access methods listed in the list in the first method argument,
-i.e. 'http' and 'ftp'.
+Get/set the timeout value in seconds. The default value is
+180 seconds, i.e. 3 minutes.
-The second form shows a shorthand form for specifying
-proxy URL for a single access scheme.
+The requests is aborted if no activity on the connection to the server
+is observed for C<timeout> seconds. This means that the time it takes
+for the complete transaction and the L<LWP::UserAgent/request> method to
+actually return might be longer.
-=item $ua->no_proxy( $domain, ... )
+=head1 PROXY ATTRIBUTES
-Do not proxy requests to the given domains. Calling no_proxy without
-any domains clears the list of domains. For example:
+The following methods set up when requests should be passed via a
+proxy server.
- $ua->no_proxy('localhost', 'example.com');
+=head2 env_proxy
-=item $ua->env_proxy
+ $ua->env_proxy;
-Load proxy settings from *_proxy environment variables. You might
+Load proxy settings from C<*_proxy> environment variables. You might
specify proxies like this (sh-syntax):
gopher_proxy=http://proxy.my.place/
On systems with case insensitive environment variables there exists a
name clash between the CGI environment variables and the C<HTTP_PROXY>
-environment variable normally picked up by env_proxy(). Because of
+environment variable normally picked up by C<env_proxy>. Because of
this C<HTTP_PROXY> is not honored for CGI scripts. The
C<CGI_HTTP_PROXY> environment variable can be used instead.
-=back
+=head2 no_proxy
+
+ $ua->no_proxy( @domains );
+ $ua->no_proxy('localhost', 'example.com');
+ $ua->no_proxy(); # clear the list
+
+Do not proxy requests to the given domains. Calling C<no_proxy> without
+any domains clears the list of domains.
+
+=head2 proxy
+
+ $ua->proxy(\@schemes, $proxy_url)
+ $ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
+ # or, for a single scheme
+ $ua->proxy($scheme, $proxy_url)
+ $ua->proxy('gopher', 'http://proxy.sn.no:8001/');
-=head2 Handlers
+Set/retrieve proxy URL for a scheme.
+
+The first form specifies that the URL is to be used as a proxy for
+access methods listed in the list in the first method argument,
+i.e. C<http> and C<ftp>.
+
+The second form shows a shorthand form for specifying
+proxy URL for a single access scheme.
+
+=head1 HANDLERS
Handlers are code that injected at various phases during the
processing of requests. The following methods are provided to manage
the active handlers:
-=over
+=head2 add_handler
-=item $ua->add_handler( $phase => \&cb, %matchspec )
+ $ua->add_handler( $phase => \&cb, %matchspec )
Add handler to be invoked in the given processing phase. For how to
-specify %matchspec see L<HTTP::Config/"Matching">.
+specify C<%matchspec> see L<HTTP::Config/"Matching">.
-The possible values $phase and the corresponding callback signatures are:
+The possible values C<$phase> and the corresponding callback signatures are:
=over
-=item request_preprepare => sub { my($request, $ua, $h) = @_; ... }
+=item response_data => sub { my($response, $ua, $h, $data) = @_; ... }
-The handler is called before the C<request_prepare> and other standard
-initialization of the request. This can be used to set up headers
-and attributes that the C<request_prepare> handler depends on. Proxy
-initialization should take place here; but in general don't register
-handlers for this phase.
+This handler is called for each chunk of data received for the
+response. The handler might croak to abort the request.
+
+This handler needs to return a TRUE value to be called again for
+subsequent chunks for the same request.
+
+=item response_done => sub { my($response, $ua, $h) = @_; ... }
+
+The handler is called after the response has been fully received, but
+before any redirect handling is attempted. The handler can be used to
+extract information or modify the response.
+
+=item response_header => sub { my($response, $ua, $h) = @_; ... }
+
+This handler is called right after the response headers have been
+received, but before any content data. The handler might set up
+handlers for data and might croak to abort the request.
+
+The handler might set the $response->{default_add_content} value to
+control if any received data should be added to the response object
+directly. This will initially be false if the $ua->request() method
+was called with a $content_file or $content_cb argument; otherwise true.
=item request_prepare => sub { my($request, $ua, $h) = @_; ... }
raised it will abort the request and make the request method return a
"400 Bad request" response.
+=item request_preprepare => sub { my($request, $ua, $h) = @_; ... }
+
+The handler is called before the C<request_prepare> and other standard
+initialization of the request. This can be used to set up headers
+and attributes that the C<request_prepare> handler depends on. Proxy
+initialization should take place here; but in general don't register
+handlers for this phase.
+
=item request_send => sub { my($request, $ua, $h) = @_; ... }
This handler gets a chance of handling requests before they're sent to the
The C<response_header> and C<response_data> handlers will not be
invoked for this response, but the C<response_done> will be.
-=item response_header => sub { my($response, $ua, $h) = @_; ... }
-
-This handler is called right after the response headers have been
-received, but before any content data. The handler might set up
-handlers for data and might croak to abort the request.
-
-The handler might set the $response->{default_add_content} value to
-control if any received data should be added to the response object
-directly. This will initially be false if the $ua->request() method
-was called with a $content_file or $content_cb argument; otherwise true.
-
-=item response_data => sub { my($response, $ua, $h, $data) = @_; ... }
-
-This handler is called for each chunk of data received for the
-response. The handler might croak to abort the request.
-
-This handler needs to return a TRUE value to be called again for
-subsequent chunks for the same request.
-
-=item response_done => sub { my($response, $ua, $h) = @_; ... }
-
-The handler is called after the response has been fully received, but
-before any redirect handling is attempted. The handler can be used to
-extract information or modify the response.
-
=item response_redirect => sub { my($response, $ua, $h) = @_; ... }
The handler is called in $ua->request after C<response_done>. If the
=back
-=item $ua->remove_handler( undef, %matchspec )
+=head2 get_my_handler
-=item $ua->remove_handler( $phase, %matchspec )
+ $ua->get_my_handler( $phase, %matchspec );
+ $ua->get_my_handler( $phase, %matchspec, $init );
-Remove handlers that match the given %matchspec. If $phase is not
-provided remove handlers from all phases.
+Will retrieve the matching handler as hash ref.
-Be careful as calling this function with %matchspec that is not
-specific enough can remove handlers not owned by you. It's probably
-better to use the set_my_handler() method instead.
+If C<$init> is passed as a true value, create and add the
+handler if it's not found. If C<$init> is a subroutine reference, then
+it's called with the created handler hash as argument. This sub might
+populate the hash with extra fields; especially the callback. If
+C<$init> is a hash reference, merge the hashes.
-The removed handlers are returned.
+=head2 handlers
-=item $ua->set_my_handler( $phase, $cb, %matchspec )
+ $ua->handlers( $phase, $request )
+ $ua->handlers( $phase, $response )
-Set handlers private to the executing subroutine. Works by defaulting
-an C<owner> field to the %matchspec that holds the name of the called
-subroutine. You might pass an explicit C<owner> to override this.
+Returns the handlers that apply to the given request or response at
+the given processing phase.
-If $cb is passed as C<undef>, remove the handler.
+=head2 remove_handler
-=item $ua->get_my_handler( $phase, %matchspec )
+ $ua->remove_handler( undef, %matchspec );
+ $ua->remove_handler( $phase, %matchspec );
+ $ua->remove_handlers(); # REMOVE ALL HANDLERS IN ALL PHASES
-=item $ua->get_my_handler( $phase, %matchspec, $init )
+Remove handlers that match the given C<%matchspec>. If C<$phase> is not
+provided, remove handlers from all phases.
-Will retrieve the matching handler as hash ref.
+Be careful as calling this function with C<%matchspec> that is not
+specific enough can remove handlers not owned by you. It's probably
+better to use the L<LWP::UserAgent/set_my_handler> method instead.
-If C<$init> is passed as a TRUE value, create and add the
-handler if it's not found. If $init is a subroutine reference, then
-it's called with the created handler hash as argument. This sub might
-populate the hash with extra fields; especially the callback. If
-$init is a hash reference, merge the hashes.
+The removed handlers are returned.
-=item $ua->handlers( $phase, $request )
+=head2 set_my_handler
-=item $ua->handlers( $phase, $response )
+ $ua->set_my_handler( $phase, $cb, %matchspec );
+ $ua->set_my_handler($phase, undef); # remove handler for phase
-Returns the handlers that apply to the given request or response at
-the given processing phase.
+Set handlers private to the executing subroutine. Works by defaulting
+an C<owner> field to the C<%matchspec> that holds the name of the called
+subroutine. You might pass an explicit C<owner> to override this.
-=back
+If $cb is passed as C<undef>, remove the handler.
=head1 REQUEST METHODS
The methods described in this section are used to dispatch requests
via the user agent. The following request methods are provided:
+=head2 delete
+
+ my $res = $ua->delete( $url );
+ my $res = $ua->delete( $url, $field_name => $value, ... );
+
+This method will dispatch a C<DELETE> request on the given URL. Additional
+headers and content options are the same as for the L<LWP::UserAgent/get>
+method.
+
+This method will use the DELETE() function from L<HTTP::Request::Common>
+to build the request. See L<HTTP::Request::Common> for a details on
+how to pass form content and other advanced features.
+
=head2 get
my $res = $ua->get( $url );
This method will dispatch a C<HEAD> request on the given URL.
Otherwise it works like the L<LWP::UserAgent/get> method described above.
+=head2 is_protocol_supported
+
+ my $bool = $ua->is_protocol_supported( $scheme );
+
+You can use this method to test whether this user agent object supports the
+specified C<scheme>. (The C<scheme> might be a string (like C<http> or
+C<ftp>) or it might be an L<URI> object reference.)
+
+Whether a scheme is supported is determined by the user agent's
+C<protocols_allowed> or C<protocols_forbidden> lists (if any), and by
+the capabilities of LWP. I.e., this will return true only if LWP
+supports this protocol I<and> it's permitted for this particular
+object.
+
+=head2 is_online
+
+ my $bool = $ua->is_online;
+
+Tries to determine if you have access to the Internet. Returns C<1> (true)
+if the built-in heuristics determine that the user agent is
+able to access the Internet (over HTTP) or C<0> (false).
+
+See also L<LWP::Online>.
+
+=head2 mirror
+
+ my $res = $ua->mirror( $url, $filename );
+
+This method will get the document identified by URL and store it in
+file called C<$filename>. If the file already exists, then the request
+will contain an C<If-Modified-Since> header matching the modification
+time of the file. If the document on the server has not changed since
+this time, then nothing happens. If the document has been updated, it
+will be downloaded again. The modification time of the file will be
+forced to match that of the server.
+
+The return value is an L<HTTP::Response> object.
+
=head2 post
my $res = $ua->post( $url, \%form );
to build the request. See L<HTTP::Request::Common> for a details on
how to pass form content and other advanced features.
-=head2 delete
-
- my $res = $ua->delete( $url );
- my $res = $ua->delete( $url, $field_name => $value, ... );
-
-This method will dispatch a C<DELETE> request on the given URL. Additional
-headers and content options are the same as for the L<LWP::UserAgent/get>
-method.
-
-This method will use the DELETE() function from L<HTTP::Request::Common>
-to build the request. See L<HTTP::Request::Common> for a details on
-how to pass form content and other advanced features.
-
-=head2 mirror
-
- my $res = $ua->mirror( $url, $filename );
-
-This method will get the document identified by URL and store it in
-file called C<$filename>. If the file already exists, then the request
-will contain an C<If-Modified-Since> header matching the modification
-time of the file. If the document on the server has not changed since
-this time, then nothing happens. If the document has been updated, it
-will be downloaded again. The modification time of the file will be
-forced to match that of the server.
-
-The return value is an L<HTTP::Response> object.
-
=head2 request
my $res = $ua->request( $request );
handle redirects or authentication responses. The L<LWP::Simple/request> method
will, in fact, invoke this method for each simple request it sends.
-=head2 is_online
-
- my $bool = $ua->is_online;
-
-Tries to determine if you have access to the Internet. Returns C<1> (true)
-if the built-in heuristics determine that the user agent is
-able to access the Internet (over HTTP) or C<0> (false).
-
-See also L<LWP::Online>.
-
-=head2 is_protocol_supported
-
- my $bool = $ua->is_protocol_supported( $scheme );
-
-You can use this method to test whether this user agent object supports the
-specified C<scheme>. (The C<scheme> might be a string (like C<http> or
-C<ftp>) or it might be an L<URI> object reference.)
-
-Whether a scheme is supported is determined by the user agent's
-C<protocols_allowed> or C<protocols_forbidden> lists (if any), and by
-the capabilities of LWP. I.e., this will return true only if LWP
-supports this protocol I<and> it's permitted for this particular
-object.
-
-=head1 Callback methods
+=head1 CALLBACK METHODS
The following methods will be invoked as requests are processed. These
methods are documented here because subclasses of L<LWP::UserAgent>
might want to override their behaviour.
-=head2 prepare_request
-
- $request = $ua->prepare_request( $request );
-
-This method is invoked by L<LWP::UserAgent/simple_request>. Its task is
-to modify the given C<$request> object by setting up various headers based
-on the attributes of the user agent. The return value should normally be the
-C<$request> object passed in. If a different request object is returned
-it will be the one actually processed.
-
-The headers affected by the base implementation are; C<User-Agent>,
-C<From>, C<Range> and C<Cookie>.
-
-=head2 redirect_ok
-
- my $bool = $ua->redirect_ok( $prospective_request, $response );
-
-This method is called by L<LWP::UserAgent/request> before it tries to follow a
-redirection to the request in C<$response>. This should return a true
-value if this redirection is permissible. The C<$prospective_request>
-will be the request to be sent if this method returns true.
-
-The base implementation will return false unless the method
-is in the object's C<requests_redirectable> list,
-false if the proposed redirection is to a C<file://...>
-URL, and true otherwise.
-
=head2 get_basic_credentials
# This checks wantarray and can either return an array:
The base implementation simply checks a set of pre-stored member
variables, set up with the L<LWP::UserAgent/credentials> method.
+=head2 prepare_request
+
+ $request = $ua->prepare_request( $request );
+
+This method is invoked by L<LWP::UserAgent/simple_request>. Its task is
+to modify the given C<$request> object by setting up various headers based
+on the attributes of the user agent. The return value should normally be the
+C<$request> object passed in. If a different request object is returned
+it will be the one actually processed.
+
+The headers affected by the base implementation are; C<User-Agent>,
+C<From>, C<Range> and C<Cookie>.
+
=head2 progress
my $prog = $ua->progress( $status, $request_or_response );
When C<$status> is "begin" the second argument is the L<HTTP::Request> object,
otherwise it is the L<HTTP::Response> object.
+=head2 redirect_ok
+
+ my $bool = $ua->redirect_ok( $prospective_request, $response );
+
+This method is called by L<LWP::UserAgent/request> before it tries to follow a
+redirection to the request in C<$response>. This should return a true
+value if this redirection is permissible. The C<$prospective_request>
+will be the request to be sent if this method returns true.
+
+The base implementation will return false unless the method
+is in the object's C<requests_redirectable> list,
+false if the proposed redirection is to a C<file://...>
+URL, and true otherwise.
+
=head1 SEE ALSO
See L<LWP> for a complete overview of libwww-perl5. See L<lwpcook>
--- /dev/null
+use strict;
+use warnings;
+
+use LWP::UserAgent ();
+use Test::More;
+use Test::RequiresInternet ( 'nntp.perl.org' => 119 );
+
+plan tests => 1;
+my $ua = LWP::UserAgent->new;
+
+my $res = $ua->get('nntp://nntp.perl.org/blahblahblah@blahblahblah');
+is($res->code, 404, '404 on fake nntp url');
't/00-report-prereqs.t',
't/base/default_content_type.t',
't/base/protocols.t',
+ 't/base/protocols/nntp.t',
't/base/proxy.t',
't/base/simple.t',
't/base/ua.t',
plan tests => scalar @modules;
my %trustme = (
- 'LWP::RobotUA' => [
- qr/^host_count$/
- ],
- 'LWP::UserAgent' => [
- qr/^(?:run_handlers|send_request|use_alarm|use_eval)$/
- ],
'LWP::Protocol' => [
qr/^(?:max_size|timeout)$/
],
+ 'LWP::UserAgent' => [
+ qr/^(?:run_handlers|send_request|use_alarm|use_eval)$/
+ ],
+ 'LWP::Protocol::gopher' => [
+ qr/^(?:gopher2url|menu2html)$/
+ ],
'LWP::Protocol::http' => [
qr/^(?:hlist_remove|socket_class|socket_type)$/
],
- 'LWP::Protocol::gopher' => [
- qr/^(?:gopher2url|menu2html)$/
- ]
+ 'LWP::RobotUA' => [
+ qr/^host_count$/
+ ]
);
my @also_private;
freeerider
ftp
gerhard
+getprint
+getstore
gisle
github
gong
note 'Checking Changes';
my $changes_file = 'Changes';
-my $newver = '6.22';
+my $newver = '6.23';
my $trial_token = '-TRIAL';
SKIP: {