X-Git-Url: http://erislabs.net/gitweb/?p=libwww-opensearch-perl.git;a=blobdiff_plain;f=lib%2FWWW%2FOpenSearch%2FDescription.pm;h=0075e355ca2fbf6c99da6a534aa01037f717a11f;hp=807c5761d391194efeade417e3d2f678549cb7db;hb=0418a266d571b99934f124a6d8e2b1d4b99f22fc;hpb=3b5cb6bbbb1e0ab3c88dde5067ab53cbcb613aa2 diff --git a/lib/WWW/OpenSearch/Description.pm b/lib/WWW/OpenSearch/Description.pm index 807c576..0075e35 100644 --- a/lib/WWW/OpenSearch/Description.pm +++ b/lib/WWW/OpenSearch/Description.pm @@ -125,7 +125,7 @@ whose type is equal to $type. =head1 COPYRIGHT AND LICENSE -Copyright 2006 by Tatsuhiko Miyagawa and Brian Cassidy +Copyright 2007 by Tatsuhiko Miyagawa and Brian Cassidy This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. @@ -165,12 +165,13 @@ sub load { my $ns = $element->getNamespace->value; my $version; - if( $ns eq 'http://a9.com/-/spec/opensearch/1.1/' ) { - $self->ns( $ns ); - $version = '1.1'; + if( $ns eq 'http://a9.com/-/spec/opensearchdescription/1.0/' ) { + $self->ns( 'http://a9.com/-/spec/opensearchrss/1.0/' ); + $version = '1.0'; } else { - $version = '1.0'; + $self->ns( $ns ); + ( $version ) = $ns =~ m{([^/]+)/?$}; } $self->version( $version ); @@ -178,7 +179,7 @@ sub load { my $node = $doc->documentElement->getChildrenByTagName( $column ) or next; if( $column eq 'Url' ) { if( $version eq '1.0' ) { - $self->Url( [ WWW::OpenSearch::Url->new( template => $node->string_value, type => 'application/rss+xml' ) ] ); + $self->Url( [ WWW::OpenSearch::Url->new( template => $node->string_value, type => 'application/rss+xml', ns => $self->ns ) ] ); next; } @@ -198,7 +199,7 @@ sub load { $params{ $param } = $value; } - push @url, WWW::OpenSearch::Url->new( template => $url, type => $type, method => $method, params => \%params ); + push @url, WWW::OpenSearch::Url->new( template => $url, type => $type, method => $method, params => \%params, ns => $self->ns ); } $self->Url( \@url ); } @@ -229,10 +230,6 @@ sub load { $self->image( $images ); } - elsif( $version eq '1.0' and $column eq 'Format' ) { - $self->Format( $node->string_value ); - $self->ns( $self->Format ); - } else { $self->$column( $node->string_value ); } @@ -252,13 +249,11 @@ sub get_url_by_type { my $self = shift; my $type = shift; - my $template; for( $self->urls ) { - $template = $_ if $_->type eq $type; - last; + return $_ if $_->type eq $type; }; - return $template; + return; } sub urls {