Changeset 810

Show
Ignore:
Timestamp:
05/24/06 19:46:42
Author:
miyagawa
Message:
  • 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.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/CustomFeed/AmazonAssociateReportJP.pm

    r430 r810  
    44use base qw (Plagger::Plugin); 
    55 
    6 use WWW::Mechanize; 
     6use Plagger::Mechanize; 
    77 
    88sub register { 
     
    5151use strict; 
    5252use warnings; 
    53 use WWW::Mechanize; 
     53use Plagger::Mechanize; 
    5454use base qw(Class::Accessor::Fast); 
    5555 
     
    5959    my $class = shift; 
    6060    my $plugin = shift; 
    61     my $mech = WWW::Mechanize->new; 
     61    my $mech = Plagger::Mechanize->new; 
    6262    $mech->agent_alias( "Windows IE 6" ); 
    6363    return bless { 
     
    144144=head1 SEE ALSO 
    145145 
    146 L<Plagger>, L<WWW::Mechanize> 
     146L<Plagger>, L<Plagger::Mechanize> 
    147147 
    148148=cut 
  • trunk/plagger/lib/Plagger/Plugin/CustomFeed/Frepa.pm

    r809 r810  
    77use Time::HiRes; 
    88use UNIVERSAL::require; 
    9 use WWW::Mechanize; 
     9use Plagger::Mechanize; 
    1010 
    1111sub plugin_id { 
     
    2525    my ($self, $context) = @_; 
    2626 
    27     $self->{mech} = WWW::Mechanize->new(cookie_jar => $self->cookie_jar); 
    28     $self->{mech}->agent_alias( "Windows IE 6" ); 
     27    $self->{mech} = Plagger::Mechanize->new(cookie_jar => $self->cookie_jar); 
    2928 
    3029    my $feed = Plagger::Feed->new; 
     
    229228=head1 SEE ALSO 
    230229 
    231 L<Plagger>, L<Plagger::Plugin::CustomFeed::Mixi>, L<WWW::Mechanize>, 
     230L<Plagger>, L<Plagger::Plugin::CustomFeed::Mixi>, L<Plagger::Mechanize>, 
    232231L<http://frepa.livedoor.com/> 
    233232 
  • trunk/plagger/lib/Plagger/Plugin/CustomFeed/Yahoo360JP.pm

    r808 r810  
    66use Encode; 
    77use Time::HiRes; 
    8 use WWW::Mechanize; 
     8use Plagger::Mechanize; 
    99 
    1010sub plugin_id { 
     
    3535    my $start = "http://360.yahoo.co.jp/"; 
    3636 
    37     my $mech = WWW::Mechanize->new(cookie_jar => $self->cookie_jar); 
    38     $mech->agent_alias( 'Windows IE 6' ); 
     37    my $mech = Plagger::Mechanize->new(cookie_jar => $self->cookie_jar); 
    3938    $mech->get($start); 
    4039 
     
    302301=head1 SEE ALSO 
    303302 
    304 L<Plagger>, L<WWW::Mechanize>, L<Plagger::Plugin::CustomFeed::Mixi> 
     303L<Plagger>, L<Plagger::Mechanize>, L<Plagger::Plugin::CustomFeed::Mixi> 
    305304 
    306305=cut 
  • trunk/plagger/lib/Plagger/Plugin/Notify/Campfire.pm

    r808 r810  
    4343 
    4444use strict; 
    45 use WWW::Mechanize; 
     45use Plagger::Mechanize; 
    4646use HTTP::Request::Common; 
    4747use Encode; 
     
    5151    my $plugin = shift; 
    5252 
    53     my $mech = WWW::Mechanize->new(cookie_jar => $plugin->cookie_jar); 
     53    my $mech = Plagger::Mechanize->new(cookie_jar => $plugin->cookie_jar); 
    5454    $mech->agent_alias("Windows IE 6"); 
    5555 
  • trunk/plagger/lib/Plagger/Plugin/Subscription/HatenaRSS.pm

    r117 r810  
    33use base qw( Plagger::Plugin::Subscription::OPML ); 
    44 
    5 use WWW::Mechanize; 
     5use Plagger::Mechanize; 
    66 
    77sub register { 
     
    2222    my $start = "https://www.hatena.ne.jp/login?backurl=http%3A%2F%2Fr.hatena.ne.jp%2F"; 
    2323 
    24     # TODO: we should save the cookie and reuse 
    25     my $mech = WWW::Mechanize->new; 
     24    # support cookie_jar 
     25    my $mech = Plagger::Mechanize->new; 
    2626    $mech->get($start); 
    2727 
  • trunk/plagger/lib/Plagger/Plugin/Subscription/LivedoorReader.pm

    r808 r810  
    55use JSON::Syck; 
    66use URI; 
    7 use WWW::Mechanize; 
     7use Plagger::Mechanize; 
    88use Plagger::Util; 
    99 
     
    2525sub init_reader { 
    2626    my $self = shift; 
    27     $self->{mech} = WWW::Mechanize->new(cookie_jar => $self->cookie_jar); 
     27    $self->{mech} = Plagger::Mechanize->new(cookie_jar => $self->cookie_jar); 
    2828 
    2929    unless (defined($self->conf->{username}) && defined($self->conf->{password})) { 
  • trunk/plagger/lib/Plagger/UserAgent.pm

    r807 r810  
    99    my $class = shift; 
    1010    my $self  = $class->SUPER::new(); 
    11     $self->agent("Plagger/$Plagger::VERSION (http://plagger.bulknews.net/)"); 
    12     $self->timeout(15); # xxx to be config 
    1311 
    1412    my $conf = Plagger->context->conf->{user_agent}; 
     
    1614        $self->cookie_jar( Plagger::Cookies->create($conf->{cookies}) ); 
    1715    } 
     16 
     17    $self->agent( $conf->{agent} || "Plagger/$Plagger::VERSION (http://plagger.org/)" ); 
     18    $self->timeout( $conf->{timeout} || 15 ); 
    1819 
    1920    $self;