Changeset 21499

Show
Ignore:
Timestamp:
10/17/08 17:29:05 (5 years ago)
Author:
bayashi
Message:

カスタムのScraperを指定できるようにした

Location:
lang/perl/Net-DMM/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Net-DMM/trunk/Changes

    r21378 r21499  
    11Revision history for Net-DMM 
     2 
     30.0.5  Wed Oct 17 17:17:17 2008 
     4       fixed Net::DMM(add option 'custom_scraper' in do_scrape method) 
    25 
    360.0.4  Wed Oct 15 18:15:15 2008 
  • lang/perl/Net-DMM/trunk/META.yml

    r21374 r21499  
    11--- 
    22name: Net-DMM 
    3 version: 0.0.3 
     3version: 0.0.5 
    44author: 
    55  - 'Dai Okabayashi <genkivogue@ybb.ne.jp>' 
     
    1919  Net::DMM: 
    2020    file: lib/Net/DMM.pm 
    21     version: 0.0.3 
     21    version: 0.0.5 
    2222  Net::DMM::Scraper::ItemDetail: 
    2323    file: lib/Net/DMM/Scraper/ItemDetail.pm 
  • lang/perl/Net-DMM/trunk/lib/Net/DMM.pm

    r21378 r21499  
    1010use URI; 
    1111 
    12 use version; our $VERSION = qv('0.0.4'); 
     12use version; our $VERSION = qv('0.0.5'); 
    1313 
    1414sub new { 
     
    2424    my $opt  = shift; 
    2525    croak "no url." unless $opt->{url}; 
    26     croak "no scraper." unless $opt->{scraper}; 
    27     my $scrape_module = __PACKAGE__ . "::Scraper::" . $opt->{scraper}; 
     26    croak "no scraper." if !$opt->{scraper} and !$opt->{custom_scraper}; 
     27    my $scrape_module = ''; 
     28    $scrape_module = __PACKAGE__ . "::Scraper::" . $opt->{scraper} if $opt->{scraper}; 
     29    $scrape_module = $opt->{custom_scraper} if $opt->{custom_scraper}; 
    2830    return $scrape_module->new({ 
    2931        url => $opt->{url}, 
     
    100102            url     => $search->{search_url}, 
    101103            scraper => 'SearchResult', 
     104            # u can use custom scraper class 
     105            custom_scraper => 'Custom::Scraper', # This is option. 
    102106        } 
    103107    );