Show
Ignore:
Timestamp:
04/24/08 13:22:15 (7 years ago)
Author:
yusukebe
Message:

example を修正、そろそろCPANにあげる

Location:
lang/perl/WebService-Simple/trunk
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/WebService-Simple/trunk/Changes

    r8870 r10275  
    11Revision history for WebService-Simple 
    22 
    3 0.0.3  Fri Apr 04 15:41:00 2008 
     30.03  Fri Apr 04 15:41:00 2008 
    44       - Fixed Makefile.PL and Build.PL 
    5 0.0.2  Thu Apr 03 16:13:00 2008 
     50.02  Thu Apr 03 16:13:00 2008 
    66       - Added CHACHING 
    7 0.0.1  Thu Mar 27 10:06:09 2008 
     70.01  Thu Mar 27 10:06:09 2008 
    88       - original version 
  • lang/perl/WebService-Simple/trunk/Makefile.PL

    r10117 r10275  
    1919build_requires( 'Test::More' ); 
    2020build_requires( 'Test::Pod' ); 
    21 build_requires( 'Test::Pod::Coverage' ); 
    2221 
    2322auto_include; 
  • lang/perl/WebService-Simple/trunk/README

    r8870 r10275  
    33DESCRIPTION 
    44 
    5 WebService::Simple provides you a simple interface to Web Services APIs. 
     5WebService::Simple is a simple class to interact with web services. 
     6 
     7It's basically an LWP::UserAgent that remembers recurring api URLs and 
     8parameters, plus sugar to parse the results. 
    69 
    710INSTALLATION 
     
    1417        make install 
    1518 
    16 Alternatively, to install with Module::Build, you can use the following commands: 
    17  
    18         perl Build.PL 
    19         ./Build 
    20         ./Build test 
    21         ./Build install 
    22  
    2319LICENSE AND COPYRIGHT 
    24  
    25 Copyright (c) 2008 Yusuke Wada, All rights reserved. 
    2620 
    2721This module is free software; you can redistribute it 
  • lang/perl/WebService-Simple/trunk/example/flickr_echo.pl

    r8681 r10275  
    22use warnings; 
    33use WebService::Simple; 
    4 use Cache::File; 
     4use Data::Dumper; 
    55 
    6 my $api_key = "your_api_key"; 
    7 my $cache   = Cache::File->new( 
    8     cache_root      => '/tmp/mycache', 
    9     default_expires => '30 min', 
    10 ); 
     6my $api_key = $ARGV[0] || "your_api_key"; 
    117 
    128my $flickr = WebService::Simple->new( 
    139    base_url => "http://api.flickr.com/services/rest/", 
    14     cache    => $cache, 
    1510    param    => { api_key => $api_key, } 
    1611); 
     
    1813my $response = 
    1914  $flickr->get( { method => "flickr.test.echo", name => "value" } ); 
    20 my $ref = $response->parse_xml; 
    21 print $ref->{name} . "\n"; 
     15my $ref = $response->parse_response; 
     16print Dumper $ref; 
  • lang/perl/WebService-Simple/trunk/example/flickr_search.pl

    r8742 r10275  
    22use warnings; 
    33use WebService::Simple; 
    4 use YAML; 
     4use Data::Dumper; 
    55use utf8; 
    66binmode STDOUT, ":utf8"; 
    77 
    8 my $api_key = "your_api_key"; 
     8my $api_key = $ARGV[0] || "your_api_key"; 
    99 
    1010my $flickr = WebService::Simple->new( 
     
    1414 
    1515my $response = 
    16   $flickr->get( { method => "flickr.photos.search", text => "富士山" } ); 
    17 print Dump $response->parse_xml; 
     16  $flickr->get( { method => "flickr.photos.search", text => "cat" } ); 
     17print Dumper $response->parse_response; 
  • lang/perl/WebService-Simple/trunk/example/lingr.pl

    r10071 r10275  
    33use WebService::Simple; 
    44 
    5 my $api_key  = "your_api_key"; 
    6 my $room_id  = "hO4SmQWTdJ4"; # http://www.lingr.com/room/hO4SmQWTdJ4 
     5my $api_key = $ARGV[0] || "your_api_key"; 
     6my $room_id = "hO4SmQWTdJ4";    # http://www.lingr.com/room/hO4SmQWTdJ4 
    77my $nickname = "lingr.pl"; 
    8 my $message  = $ARGV[0] || "Hello, World."; 
     8my $message  = "Hello, World."; 
    99 
    1010my $lingr = WebService::Simple->new( 
     
    2121$response = $lingr->get( 
    2222    'api/room/enter', 
    23                     { 
     23    { 
    2424        session  => $session, 
    2525        id       => $room_id, 
     
    3232$response = $lingr->get( 
    3333    'api/room/say', 
    34                     { 
     34    { 
    3535        session => $session, 
    3636        ticket  => $ticket, 
     
    4141 
    4242# destroy session 
    43 $lingr->get( 'api/session/destroy' , { session => $session, } ); 
     43$lingr->get( 'api/session/destroy', { session => $session, } ); 
  • lang/perl/WebService-Simple/trunk/lib/WebService/Simple.pm

    r10211 r10275  
    1111use UNIVERSAL::require; 
    1212 
    13 our $VERSION = '0.00001'; 
     13our $VERSION = '0.03'; 
    1414 
    1515__PACKAGE__->config( 
     
    261261=head1 CACHING 
    262262 
     263Cache the response of Web Service by using Cache object. 
     264 
    263265  my $cache   = Cache::File->new( 
    264266      cache_root      => '/tmp/mycache', 
  • lang/perl/WebService-Simple/trunk/lib/WebService/Simple/Response.pm

    r10211 r10275  
    2222} 
    2323 
     24sub parse_xml 
     25{ 
     26    my $self = shift; 
     27    $self->parse_response; 
     28} 
     29 
    24301; 
    2531