- Timestamp:
- 04/03/08 15:56:41 (8 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/WebService-Simple/trunk/lib/WebService/Simple.pm
r8680 r8741 23 23 24 24 sub get { 25 my ($self, $request_param ) = @_;26 my $url = $self->_make_url($request_param );25 my ($self, $request_param, $opt) = @_; 26 my $url = $self->_make_url($request_param, $opt->{path}); 27 27 my $response = $self->_fetch_url($url); 28 28 return $response; … … 45 45 return $response; 46 46 } 47 47 48 sub _make_url{ 48 my ($self, $request_param ) = @_;49 my ($self, $request_param, $path) = @_; 49 50 my $base_url = $self->{base_url}; 51 if($path){ 52 $path =~ s!^/!! if $base_url =~ /\/$/; 53 $base_url = $base_url . $path; 54 } 50 55 my $url = $base_url =~ /\?$/ ? $base_url : $base_url . "?"; 51 56 my @params; … … 74 79 =head1 NAME 75 80 76 WebService::Simple - Simple interface to anyWeb Service APIs81 WebService::Simple - Simple interface to Web Service APIs 77 82 78 83 =head1 VERSION … … 95 100 =head1 DESCRIPTION 96 101 97 WebService::Simple provides you a simple interface to anyWeb Servcie APIs102 WebService::Simple provides you a simple interface to Web Servcie APIs 98 103 99 104 =head1 METHODS … … 117 122 118 123 Get the WebService::Simple::Response object. 124 125 If you want to add a path to base URL, use option parameters. 126 127 my $lingr = WebService::Simple->new( 128 base_url => 'http://www.lingr.com/', 129 param => { api_key => "your_api_key", format => 'xml' } 130 ); 131 my $response = $lingr->get( {}, { path => '/api/session/create' } ); 119 132 120 133 =back … … 141 154 Yusuke Wada C<< <yusuke@kamawada.com> >> 142 155 143 144 156 =head1 LICENCE AND COPYRIGHT 145 157
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)