projects
/
libwww-opensearch-perl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
imported new upstream 0.13
[libwww-opensearch-perl.git]
/
lib
/
WWW
/
OpenSearch
/
Url.pm
diff --git
a/lib/WWW/OpenSearch/Url.pm
b/lib/WWW/OpenSearch/Url.pm
index
320c1f4
..
7c04b82
100644
(file)
--- a/
lib/WWW/OpenSearch/Url.pm
+++ b/
lib/WWW/OpenSearch/Url.pm
@@
-61,32
+61,32
@@
it under the same terms as Perl itself.
=cut
sub new {
=cut
sub new {
- my( $class, %options ) = @_;
-
+ my
( $class, %options ) = @_;
+
$options{ method } ||= 'GET';
$options{ template } = URI::Template->new( $options{ template } );
$options{ method } ||= 'GET';
$options{ template } = URI::Template->new( $options{ template } );
-
+
my $self = $class->SUPER::new( \%options );
return $self;
}
sub prepare_query {
my $self = $class->SUPER::new( \%options );
return $self;
}
sub prepare_query {
- my( $self, $params ) = @_;
+ my
( $self, $params ) = @_;
my $tmpl = $self->template;
my $tmpl = $self->template;
-
- for( qw( startIndex startPage ) ) {
+
+ for
( qw( startIndex startPage ) ) {
$params->{ $_ } = 1 if !defined $params->{ $_ };
}
$params->{ $_ } = 1 if !defined $params->{ $_ };
}
- $params->{ language
}
||= '*';
+ $params->{ language
}
||= '*';
$params->{ outputEncoding } ||= 'UTF-8';
$params->{ outputEncoding } ||= 'UTF-8';
- $params->{ inputEncoding
}
||= 'UTF-8';
-
+ $params->{ inputEncoding
}
||= 'UTF-8';
+
# fill the uri template
my $url = $tmpl->process( %$params );
# attempt to handle POST
# fill the uri template
my $url = $tmpl->process( %$params );
# attempt to handle POST
- if( $self->method eq 'post' ) {
+ if
( $self->method eq 'post' ) {
my $post = $self->params;
for my $key ( keys %$post ) {
$post->{ $key } =~ s/{(.+)}/$params->{ $1 } || ''/eg;
my $post = $self->params;
for my $key ( keys %$post ) {
$post->{ $key } =~ s/{(.+)}/$params->{ $1 } || ''/eg;
@@
-94,7
+94,7
@@
sub prepare_query {
return $url, [ %$post ];
}
return $url, [ %$post ];
}
-
+
return $url;
}
return $url;
}