Changeset 2342

Show
Ignore:
Timestamp:
09/15/07 09:49:09
Author:
miyagawa
Message:

make user_agent an accessor as well

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Web-Scraper/trunk/lib/Web/Scraper.pm

    r2341 r2342  
    2929} 
    3030 
     31sub user_agent { 
     32    my $self = shift; 
     33    $self->{user_agent} = shift if @_; 
     34    $self->{user_agent} || __ua; 
     35} 
     36 
    3137sub define { 
    3238    my($class, $coderef) = @_; 
     
    4854        require Encode; 
    4955        require HTTP::Response::Encoding; 
    50         my $ua  = __ua
     56        my $ua  = $self->user_agent
    5157        my $res = $ua->get($stuff); 
    5258        if ($res->is_success) {