File Coverage

blib/lib/WWW/Opentracker/Stats/UserAgent.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1             package WWW::Opentracker::Stats::UserAgent;
2              
3 12     12   67530 use strict;
  12         30  
  12         549  
4 12     12   64 use warnings;
  12         25  
  12         360  
5              
6 12     12   24344 use LWP::UserAgent;
  12         867141  
  12         1349  
7              
8             =head1 NAME
9              
10             WWW::Opentracker::Stats::UserAgent - Factory package for creating a user agents
11              
12             =head1 DESCRIPTION
13              
14             A factory package with helper methods for creating user agents for use with
15             opentracker statistics.
16              
17             =head1 METHODS
18              
19             =head2 default
20              
21             Returns a default user agent object.
22              
23             This creates a new L object, sets the timeout to 5 seconds,
24             uses any proxy settings from the environment and sets a custom agent name.
25              
26             =cut
27              
28             sub default {
29 11     11 1 21886 my $ua = LWP::UserAgent->new;
30              
31 11         64436 $ua->timeout(5);
32 11         2093 $ua->env_proxy;
33 11         313052 $ua->agent('Opentracker Stats/1.0 ');
34              
35 11         1369 return $ua;
36             }
37              
38              
39             =head1 SEE ALSO
40              
41             L
42              
43              
44             =head1 AUTHOR
45              
46             Knut-Olav Hoven, Eknutolav@gmail.comE
47              
48             =head1 COPYRIGHT AND LICENSE
49              
50             Copyright (C) 2009 by Knut-Olav Hoven
51              
52             This library is free software; you can redistribute it and/or modify
53             it under the same terms as Perl itself, either Perl version 5.8.8 or,
54             at your option, any later version of Perl 5 you may have available.
55              
56             =cut
57              
58             1;