Show
Ignore:
Timestamp:
01/30/08 01:26:09 (5 years ago)
Author:
kentaro
Message:

lang/perl/WWW-HatenaDiary?:

  • Fixed a bug: creating/updating entry fails if diary is under private.
  • Updated the POD along with the update
Location:
lang/perl/WWW-HatenaDiary/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/WWW-HatenaDiary/trunk/Changes

    r3939 r5819  
    11Revision history for Perl extension WWW::HatenaDiary 
     2 
     30.02    Tue Jan 30 01:18:09 2008 
     4        - This module now uses WWW::HatenaLogin to login to Hatena::Diary. 
     5        (Thanks to Yappo++) 
     6        - Fixed a bug: creating/updating entry fails if diary is under private. 
    27 
    380.01    Tue Jan  1 22:45:04 2008 
  • lang/perl/WWW-HatenaDiary/trunk/Makefile.PL

    r5817 r5819  
    99    JSON::Syck 
    1010/); 
     11 
    1112requires WWW::HatenaLogin => 0.02; 
    1213 
  • lang/perl/WWW-HatenaDiary/trunk/lib/WWW/HatenaDiary.pm

    r5817 r5819  
    66use Web::Scraper; 
    77use WWW::Mechanize; 
     8use WWW::HatenaLogin; 
    89use JSON::Syck 'Load'; 
    9 use WWW::HatenaLogin; 
    1010 
    1111our $VERSION = '0.01'; 
     
    210210    }); 
    211211 
     212    $self->{login}->mech->get($uri); 
     213 
    212214    scraper { 
    213215        process '//div[@class="section"][1]/h3[1]/a[1]', 'uri' => '@href'; 
    214216        result 'uri'; 
    215     }->scrape(URI->new($uri)); 
     217    }->scrape($self->{login}->mech->content, URI->new($self->{diary})); 
    216218} 
    217219 
     
    238240  }); 
    239241 
     242  # Or just pass a WWW::HatenaLogin object like below if you already have it. 
     243  # See the POD of it for details 
     244  my $diary = WWW::HatenaDiary->new({ 
     245      login => $login                 # it's a WWW::HatenaLogin object 
     246  }); 
     247 
    240248  # Check if already logged in to Hatena::Diary 
    241249  # If you have a valid cookie, you can omit this process 
     
    305313=head1 METHODS 
    306314 
    307 =head2 new ( [I<\%args>] ) 
     315=head2 new ( I<\%args> ) 
    308316 
    309317=over 4 
     
    319327  }); 
    320328 
     329  # or... 
     330 
     331  my $diary = WWW::HatenaDiary->new({ 
     332      login => $login                 # it's a WWW::HatenaLogin object 
     333  }); 
     334 
     335 
    321336Creates and returns a new WWW::HatenaDiary object. If you have a valid 
    322337cookie and pass it into this method as one of C<mech_opt>, you can 
     
    328343with your diary on Hatena::Group. 
    329344 
    330 C<mech_opt> field is also optional. You can use it to customize the 
     345C<mech_opt> field is optional. You can use it to customize the 
    331346behavior of this module in the way you like. See the POD of 
    332347L<WWW::Mechanize> for more details. 
     348 
     349C<login> field is also optional. If you already have a 
     350L<WWW::HatenaLogin> object, you can use it to communicate with 
     351Hatena::Diary after just passing it as the value of the field. See the 
     352POD of L<WWW::HatenaLogin> for more details. 
    333353 
    334354=back 
     
    510530L<http://d.hatena.ne.jp/> 
    511531 
     532=item * L<WWW::HatenaLogin> 
     533 
    512534=item * L<WWW::Mechanize> 
    513535 
     
    516538=head1 ACKNOWLEDGMENT 
    517539 
    518 typester++ for some codes copied from Fuse::Hatena. 
     540typester++ for some codes copied from L<Fuse::Hatena>. 
     541 
     542Yappo++ for improving this module using L<WWW::HatenaLogin> 
    519543 
    520544=head1 AUTHOR