Changeset 111

Show
Ignore:
Timestamp:
06/25/01 19:26:51
Author:
miyagawa
Message:

add Imode.pm

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WWW-Cache-Google/trunk/lib/WWW/Cache/Google.pm

    r109 r111  
    22 
    33use strict; 
    4 use vars qw($VERSION @ISA @EXPORT_OK); 
     4use vars qw($VERSION); 
    55$VERSION = '0.02'; 
    6  
    7 require Exporter; 
    8 @ISA = qw(Exporter); 
    9 @EXPORT_OK = qw(url2google get_google_cache); 
    106 
    117use URI; 
    128use URI::Escape; 
    13  
    14 # functional wrapper 
    15 sub url2google { 
    16     my $url = shift; 
    17     return __PACKAGE__->new($url)->as_string; 
    18 } 
    19  
    20 sub get_google_cache { 
    21     my $url = shift; 
    22     return __PACKAGE__->new($url)->fetch; 
    23 } 
    249 
    2510sub cache_base { 
     
    8368  use WWW::Cache::Google; 
    8469 
    85   # OO decorator way 
    8670  $cache = WWW::Cache::Google->new('http://www.yahoo.com/'); 
    8771 
    8872  $url  = $cache->as_string;    # cache URL 
    8973  $html = $cache->fetch;        # fetches via LWP::Simple 
    90  
    91   # functional way 
    92   use WWW::Cache::Google qw(url2google get_google_cache); 
    93   $cache_url  = url2google('http://www.yahoo.com/'); 
    94   $cache_html = get_google_cache('http://www.yahoo.com'); 
    9574 
    9675=head1 DESCRIPTION 
     
    11998=item $html = $cache->fetch; 
    12099 
    121 gets HTML contents of Google cache. Requires L<LWP::Simple>
     100gets HTML contents of Google cache. Requires LWP::Simple
    122101 
    123102=item $url_str = $cache->as_string; 
     
    127106 
    128107=back 
    129  
    130 =head1 FUNCTIONS 
    131  
    132 Following functions are provided for non-OO programmers, or one-liners. 
    133  
    134 =over 4 
    135  
    136 =item $cache_url = url2google($url); 
    137  
    138 converts URL to Google cache URL. Same as 
    139  
    140   $cache_url = WWW::Cache::Google->new($url)->as_string; 
    141  
    142  
    143 =item $cache_html = get_google_cache($url); 
    144  
    145 returns HTML contents of Google cache. Same as: 
    146  
    147   $cache_html = WWW::Cache::Google->new($url)->fetch; 
    148  
    149 =back 
    150  
    151 These functions are not exported by default. 
    152  
    153108 
    154109=head1 AUTHOR