|
Revision 810
(checked in by miyagawa, 6 years ago)
|
- added Plagger::Mechanize for a wrapper class around WWW::Mech (to set User-Agent from global config)
- Updated plugins to use Plagger::Mechanize where WWW::Mech was used.
|
| Line | |
|---|
| 1 |
package Plagger::Mechanize; |
|---|
| 2 |
use strict; |
|---|
| 3 |
use base qw( WWW::Mechanize ); |
|---|
| 4 |
|
|---|
| 5 |
sub new { |
|---|
| 6 |
my $class = shift; |
|---|
| 7 |
my $self = $class->SUPER::new(@_); |
|---|
| 8 |
|
|---|
| 9 |
my $conf = Plagger->context->conf->{user_agent}; |
|---|
| 10 |
$self->agent( $conf->{agent} || "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" ); |
|---|
| 11 |
$self->timeout( $conf->{timeout} || 15 ); |
|---|
| 12 |
|
|---|
| 13 |
$self; |
|---|
| 14 |
} |
|---|
| 15 |
|
|---|
| 16 |
1; |
|---|