From: Ian Beckwith Date: Sat, 8 Jun 2013 14:28:00 +0000 (+0100) Subject: Imported Upstream version 0.17 X-Git-Tag: upstream/0.17^0 X-Git-Url: http://erislabs.net/gitweb/?p=libwww-opensearch-perl.git;a=commitdiff_plain;h=refs%2Fheads%2Fupstream Imported Upstream version 0.17 --- diff --git a/Changes b/Changes index 0c687a0..117cfa5 100644 --- a/Changes +++ b/Changes @@ -1,90 +1,89 @@ Revision history for Perl extension WWW::OpenSearch -0.16 Tue May 25 2010 - - Fix tests for Test::More 0.95_02 - -0.15 Thu Nov 19 2009 - - repackaged with a new version of Module::Install - -0.14 Thu Apr 17 2008 - - Handle broken LWP 5.810 in Makefile.PL - -0.13 Fri Dec 21 2007 - - Fix pod coverage (Ian Beckwith) - -0.12 Tue May 01 2007 - - switch from ||= to a "defined" idiom for some params - - switch to Module::Install - -0.11 Tue Apr 17 2007 - - added a simple OSD parsing test - -0.10_02 Tue Jan 23 2007 - - fix Request.pm to clone the extra attributes we've - added (Marc Tobias) - -0.10_01 Mon Jan 22 2007 - - use URI::Template for parsing OSD uri templates - - added opensearch-specific Request and Agent classes - - un-break get_best_url() - - you can now pass a WWW::OpenSearch::Url to WWW::OpenSearch's - search() method - - added ns() (namespace) field to Url.pm - - re-worked paging to use the new Request object - - [ THINGS THAT MAY BREAK YOUR CODE ] - - using URI::Template means some methods are now proxied to - that class - - removed agent argument in new() in OpenSearch.pm - - handling of POST requests in prepare_query() in Url.pm now - returns data suitable for passing to HTTP::Request - - un-link Response.pm and the parent WWW::OpenSearch object -- - a Response is now in the context of whatever - WWW::OpenSearch::Url was used - -0.09 Thu Dec 07 2006 - - fix link fetching from atom feeds - -0.08 Wed Sep 13 2006 - - fix optional attributes for Image - - added strict to Url object - -0.07 Mon Sep 11 2006 - - inflate query and image fields to objects for OSD 1.1 - - pod updates - -0.06_02 Thu Jul 20 2006 - - added tests - - updated available description info - - try to handle POST urls better - - update XML::Atom calls to latest release API - - added option to override the useragent from new() - - fix undef warning - - turn utf8 flag off for queries - -0.06_01 Thu May 18 2006 - - Complete re-write to handle OpenSearch 1.1/Atom - - Now uses XML::Feed to abstract RSS and Atom - - Improved OpenSearch Description/Url handling - - Encapsulate returns in a Response object - -0.05 Mon Jan 9 18:30:18 UTC 2006 - - Added partial support of OpenSearch 1.1. There's no API change and - old elements just work as before, with 1.1 OpenSearch document as - well. See http://opensearch.a9.com/docs/upgrading10.jsp - (Thanks to Masaaki Hirose) - -0.04 Sat Jul 29 18:34:31 PDT 2005 - - Drop off XML::Simple for efficiency. - LibXMLify everything. Now you need XML::RSS::LibXML - -0.03 Sun Jul 24 02:36:46 PDT 2005 - - Hacked current_page so you can specify page number correctly - (Thanks to Naoya Ito) - -0.02 Sat Mar 26 14:14:58 JST 2005 - - Added accessors for attributes - - Fixed POD - -0.01 Thu Mar 17 20:45:13 2005 - - original version +0.17 2013-01-18 + - Avoid hash randomization problem in test (RT #82796) + +0.16 2010-05-25 + - Fix tests for Test::More 0.95_02 + +0.15 2009-11-19 + - repackaged with a new version of Module::Install + +0.14 2008-04-17 + - Handle broken LWP 5.810 in Makefile.PL + +0.13 2007-12-21 + - Fix pod coverage (Ian Beckwith) + +0.12 2007-05-01 + - switch from ||= to a "defined" idiom for some params + - switch to Module::Install + +0.11 2007-04-17 + - added a simple OSD parsing test + +0.10_02 2007-01-23 + - fix Request.pm to clone the extra attributes we've added (Marc Tobias) + +0.10_01 2007-01-22 + - use URI::Template for parsing OSD uri templates + - added opensearch-specific Request and Agent classes + - un-break get_best_url() + - you can now pass a WWW::OpenSearch::Url to WWW::OpenSearch's search() + method + - added ns() (namespace) field to Url.pm + - re-worked paging to use the new Request object + + [THINGS THAT MAY BREAK YOUR CODE] + - using URI::Template means some methods are now proxied to that class + - removed agent argument in new() in OpenSearch.pm + - handling of POST requests in prepare_query() in Url.pm now returns data + suitable for passing to HTTP::Request + - un-link Response.pm and the parent WWW::OpenSearch object -- a Response + is now in the context of whatever WWW::OpenSearch::Url was used + +0.09 2006-12-07 + - fix link fetching from atom feeds + +0.08 2006-09-13 + - fix optional attributes for Image + - added strict to Url object + +0.07 2006-09-11 + - inflate query and image fields to objects for OSD 1.1 + - pod updates + +0.06_02 2006-07-20 + - added tests + - updated available description info + - try to handle POST urls better + - update XML::Atom calls to latest release API + - added option to override the useragent from new() + - fix undef warning + - turn utf8 flag off for queries + +0.06_01 2006-05-18 + - Complete re-write to handle OpenSearch 1.1/Atom + - Now uses XML::Feed to abstract RSS and Atom + - Improved OpenSearch Description/Url handling + - Encapsulate returns in a Response object + +0.05 2006-01-09 + - Added partial support of OpenSearch 1.1. There's no API change and old + elements just work as before, with 1.1 OpenSearch document as well. See + http://opensearch.a9.com/docs/upgrading10.jsp (Thanks to Masaaki Hirose) + +0.04 2005-07-29 + - Drop off XML::Simple for efficiency. LibXMLify everything. Now you need + XML::RSS::LibXML + +0.03 2005-07-24 + - Hacked current_page so you can specify page number correctly (Thanks to + Naoya Ito) + +0.02 2005-03-26 + - Added accessors for attributes + - Fixed POD + +0.01 2005-03-17 + - original version diff --git a/META.yml b/META.yml index 9561a36..a4d69c7 100644 --- a/META.yml +++ b/META.yml @@ -3,12 +3,13 @@ abstract: 'Search A9 OpenSearch compatible engines' author: - 'Brian Cassidy ' build_requires: - ExtUtils::MakeMaker: 6.42 + ExtUtils::MakeMaker: 6.59 Test::More: 0 configure_requires: - ExtUtils::MakeMaker: 6.42 + ExtUtils::MakeMaker: 6.59 distribution_type: module -generated_by: 'Module::Install version 0.97' +dynamic_config: 1 +generated_by: 'Module::Install version 1.06' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -30,4 +31,4 @@ requires: resources: license: http://dev.perl.org/licenses/ repository: http://github.com/bricas/www-opensearch -version: 0.16 +version: 0.17 diff --git a/Makefile.PL b/Makefile.PL index a9a0da5..7492476 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,4 +1,4 @@ -use inc::Module::Install 0.97; +use inc::Module::Install 1.00; if ( -e 'MANIFEST.SKIP' ) { system( 'pod2text lib/WWW/OpenSearch.pm > README' ); diff --git a/README b/README index 79a7579..ad58d7d 100644 --- a/README +++ b/README @@ -66,7 +66,7 @@ AUTHOR Tatsuhiko Miyagawa COPYRIGHT AND LICENSE - Copyright 2005-2010 by Tatsuhiko Miyagawa and Brian Cassidy + Copyright 2005-2013 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. diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm index 5871e1e..4ecf46b 100644 --- a/inc/Module/Install.pm +++ b/inc/Module/Install.pm @@ -22,7 +22,6 @@ use strict 'vars'; use Cwd (); use File::Find (); use File::Path (); -use FindBin; use vars qw{$VERSION $MAIN}; BEGIN { @@ -32,7 +31,7 @@ BEGIN { # This is not enforced yet, but will be some time in the next few # releases once we can make sure it won't clash with custom # Module::Install extensions. - $VERSION = '0.97'; + $VERSION = '1.06'; # Storage for the pseudo-singleton $MAIN = undef; @@ -231,7 +230,12 @@ sub preload { sub new { my ($class, %args) = @_; - FindBin->again; + delete $INC{'FindBin.pm'}; + { + # to suppress the redefine warning + local $SIG{__WARN__} = sub {}; + require FindBin; + } # ignore the prefix on extension modules built from top level. my $base_path = Cwd::abs_path($FindBin::Bin); @@ -447,7 +451,7 @@ sub _version ($) { } sub _cmp ($$) { - _version($_[0]) <=> _version($_[1]); + _version($_[1]) <=> _version($_[2]); } # Cloned from Params::Util::_CLASS @@ -463,4 +467,4 @@ sub _CLASS ($) { 1; -# Copyright 2008 - 2010 Adam Kennedy. +# Copyright 2008 - 2012 Adam Kennedy. diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm index 754fb90..802844a 100644 --- a/inc/Module/Install/Base.pm +++ b/inc/Module/Install/Base.pm @@ -4,7 +4,7 @@ package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { - $VERSION = '0.97'; + $VERSION = '1.06'; } # Suspend handler for "redefined" warnings diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm index 5757a67..22167b8 100644 --- a/inc/Module/Install/Can.pm +++ b/inc/Module/Install/Can.pm @@ -3,13 +3,12 @@ package Module::Install::Can; use strict; use Config (); -use File::Spec (); use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.97'; + $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } @@ -29,7 +28,7 @@ sub can_use { eval { require $mod; $pkg->VERSION($ver || 0); 1 }; } -# check if we can run some command +# Check if we can run some command sub can_run { my ($self, $cmd) = @_; @@ -38,14 +37,88 @@ sub can_run { for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { next if $dir eq ''; - my $abs = File::Spec->catfile($dir, $_[1]); + require File::Spec; + my $abs = File::Spec->catfile($dir, $cmd); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } return; } -# can we locate a (the) C compiler +# Can our C compiler environment build XS files +sub can_xs { + my $self = shift; + + # Ensure we have the CBuilder module + $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 ); + + # Do we have the configure_requires checker? + local $@; + eval "require ExtUtils::CBuilder;"; + if ( $@ ) { + # They don't obey configure_requires, so it is + # someone old and delicate. Try to avoid hurting + # them by falling back to an older simpler test. + return $self->can_cc(); + } + + # Do we have a working C compiler + my $builder = ExtUtils::CBuilder->new( + quiet => 1, + ); + unless ( $builder->have_compiler ) { + # No working C compiler + return 0; + } + + # Write a C file representative of what XS becomes + require File::Temp; + my ( $FH, $tmpfile ) = File::Temp::tempfile( + "compilexs-XXXXX", + SUFFIX => '.c', + ); + binmode $FH; + print $FH <<'END_C'; +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +int main(int argc, char **argv) { + return 0; +} + +int boot_sanexs() { + return 1; +} + +END_C + close $FH; + + # Can the C compiler access the same headers XS does + my @libs = (); + my $object = undef; + eval { + local $^W = 0; + $object = $builder->compile( + source => $tmpfile, + ); + @libs = $builder->link( + objects => $object, + module_name => 'sanexs', + ); + }; + my $result = $@ ? 0 : 1; + + # Clean up all the build files + foreach ( $tmpfile, $object, @libs ) { + next unless defined $_; + 1 while unlink; + } + + return $result; +} + +# Can we locate a (the) C compiler sub can_cc { my $self = shift; my @chunks = split(/ /, $Config::Config{cc}) or return; @@ -78,4 +151,4 @@ if ( $^O eq 'cygwin' ) { __END__ -#line 156 +#line 236 diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm index 4f77e2e..bee0c4f 100644 --- a/inc/Module/Install/Fetch.pm +++ b/inc/Module/Install/Fetch.pm @@ -6,7 +6,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.97'; + $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm index 20955cd..7052f36 100644 --- a/inc/Module/Install/Makefile.pm +++ b/inc/Module/Install/Makefile.pm @@ -4,10 +4,11 @@ package Module::Install::Makefile; use strict 'vars'; use ExtUtils::MakeMaker (); use Module::Install::Base (); +use Fcntl qw/:flock :seek/; use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.97'; + $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } @@ -214,18 +215,22 @@ sub write { require ExtUtils::MakeMaker; if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) { - # MakeMaker can complain about module versions that include - # an underscore, even though its own version may contain one! - # Hence the funny regexp to get rid of it. See RT #35800 - # for details. - my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/; - $self->build_requires( 'ExtUtils::MakeMaker' => $v ); - $self->configure_requires( 'ExtUtils::MakeMaker' => $v ); + # This previous attempted to inherit the version of + # ExtUtils::MakeMaker in use by the module author, but this + # was found to be untenable as some authors build releases + # using future dev versions of EU:MM that nobody else has. + # Instead, #toolchain suggests we use 6.59 which is the most + # stable version on CPAN at time of writing and is, to quote + # ribasushi, "not terminally fucked, > and tested enough". + # TODO: We will now need to maintain this over time to push + # the version up as new versions are released. + $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 ); + $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 ); } else { # Allow legacy-compatibility with 5.005 by depending on the # most recent EU:MM that supported 5.005. - $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 ); - $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 ); + $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 ); + $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 ); } # Generate the MakeMaker params @@ -240,7 +245,6 @@ in a module, and provide its file path via 'version_from' (or 'all_from' if you prefer) in Makefile.PL. EOT - $DB::single = 1; if ( $self->tests ) { my @tests = split ' ', $self->tests; my %seen; @@ -364,9 +368,9 @@ sub fix_up_makefile { . ($self->postamble || ''); local *MAKEFILE; - open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; + open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; + eval { flock MAKEFILE, LOCK_EX }; my $makefile = do { local $/; }; - close MAKEFILE or die $!; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; @@ -386,7 +390,8 @@ sub fix_up_makefile { # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; - open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; + seek MAKEFILE, 0, SEEK_SET; + truncate MAKEFILE, 0; print MAKEFILE "$preamble$makefile$postamble" or die $!; close MAKEFILE or die $!; @@ -410,4 +415,4 @@ sub postamble { __END__ -#line 539 +#line 544 diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm index bebb73f..58430f3 100644 --- a/inc/Module/Install/Metadata.pm +++ b/inc/Module/Install/Metadata.pm @@ -6,7 +6,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.97'; + $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } @@ -151,15 +151,21 @@ sub install_as_site { $_[0]->installdirs('site') } sub install_as_vendor { $_[0]->installdirs('vendor') } sub dynamic_config { - my $self = shift; - unless ( @_ ) { - warn "You MUST provide an explicit true/false value to dynamic_config\n"; - return $self; + my $self = shift; + my $value = @_ ? shift : 1; + if ( $self->{values}->{dynamic_config} ) { + # Once dynamic we never change to static, for safety + return 0; } - $self->{values}->{dynamic_config} = $_[0] ? 1 : 0; + $self->{values}->{dynamic_config} = $value ? 1 : 0; return 1; } +# Convenience command +sub static_config { + shift->dynamic_config(0); +} + sub perl_version { my $self = shift; return $self->{values}->{perl_version} unless @_; @@ -170,7 +176,7 @@ sub perl_version { # Normalize the version $version = $self->_perl_version($version); - # We don't support the reall old versions + # We don't support the really old versions unless ( $version >= 5.005 ) { die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n"; } @@ -515,6 +521,7 @@ sub __extract_license { 'GNU Free Documentation license' => 'unrestricted', 1, 'GNU Affero General Public License' => 'open_source', 1, '(?:Free)?BSD license' => 'bsd', 1, + 'Artistic license 2\.0' => 'artistic_2', 1, 'Artistic license' => 'artistic', 1, 'Apache (?:Software )?license' => 'apache', 1, 'GPL' => 'gpl', 1, @@ -550,9 +557,9 @@ sub license_from { sub _extract_bugtracker { my @links = $_[0] =~ m#L<( - \Qhttp://rt.cpan.org/\E[^>]+| - \Qhttp://github.com/\E[\w_]+/[\w_]+/issues| - \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list + https?\Q://rt.cpan.org/\E[^>]+| + https?\Q://github.com/\E[\w_]+/[\w_]+/issues| + https?\Q://code.google.com/p/\E[\w_\-]+/issues/list )>#gx; my %links; @links{@links}=(); @@ -581,7 +588,7 @@ sub bugtracker_from { sub requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); - my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; + my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; @@ -616,8 +623,15 @@ sub _perl_version { return $v; } - - +sub add_metadata { + my $self = shift; + my %hash = @_; + for my $key (keys %hash) { + warn "add_metadata: $key is not prefixed with 'x_'.\n" . + "Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/; + $self->{values}->{$key} = $hash{$key}; + } +} ###################################################################### diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm index bbfda8d..eeaa3fe 100644 --- a/inc/Module/Install/Win32.pm +++ b/inc/Module/Install/Win32.pm @@ -6,7 +6,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.97'; + $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm index e6afa42..85d8018 100644 --- a/inc/Module/Install/WriteAll.pm +++ b/inc/Module/Install/WriteAll.pm @@ -6,7 +6,7 @@ use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.97';; + $VERSION = '1.06'; @ISA = qw{Module::Install::Base}; $ISCORE = 1; } diff --git a/lib/WWW/OpenSearch.pm b/lib/WWW/OpenSearch.pm index f0abfb2..4906dbe 100644 --- a/lib/WWW/OpenSearch.pm +++ b/lib/WWW/OpenSearch.pm @@ -14,7 +14,7 @@ use Encode (); __PACKAGE__->mk_accessors( qw( description_url agent description ) ); -our $VERSION = '0.16'; +our $VERSION = '0.17'; =head1 NAME @@ -103,7 +103,7 @@ Tatsuhiko Miyagawa Emiyagawa@bulknews.netE =head1 COPYRIGHT AND LICENSE -Copyright 2005-2010 by Tatsuhiko Miyagawa and Brian Cassidy +Copyright 2005-2013 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. diff --git a/lib/WWW/OpenSearch/Agent.pm b/lib/WWW/OpenSearch/Agent.pm index 00fcf0d..c63093c 100644 --- a/lib/WWW/OpenSearch/Agent.pm +++ b/lib/WWW/OpenSearch/Agent.pm @@ -38,7 +38,7 @@ An alias for request() =head1 COPYRIGHT AND LICENSE -Copyright 2005-2010 by Tatsuhiko Miyagawa and Brian Cassidy +Copyright 2005-2013 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. diff --git a/lib/WWW/OpenSearch/Description.pm b/lib/WWW/OpenSearch/Description.pm index 4f74353..7c18d70 100644 --- a/lib/WWW/OpenSearch/Description.pm +++ b/lib/WWW/OpenSearch/Description.pm @@ -133,7 +133,7 @@ whose type is equal to $type. =head1 COPYRIGHT AND LICENSE -Copyright 2005-2010 by Tatsuhiko Miyagawa and Brian Cassidy +Copyright 2005-2013 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. diff --git a/lib/WWW/OpenSearch/Image.pm b/lib/WWW/OpenSearch/Image.pm index 7eb3930..05fd6fc 100644 --- a/lib/WWW/OpenSearch/Image.pm +++ b/lib/WWW/OpenSearch/Image.pm @@ -45,7 +45,7 @@ WWW::OpenSearch::Image - Object to represent an image =head1 COPYRIGHT AND LICENSE -Copyright 2005-2010 by Tatsuhiko Miyagawa and Brian Cassidy +Copyright 2005-2013 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. diff --git a/lib/WWW/OpenSearch/Query.pm b/lib/WWW/OpenSearch/Query.pm index 94c98e3..eabdd7c 100644 --- a/lib/WWW/OpenSearch/Query.pm +++ b/lib/WWW/OpenSearch/Query.pm @@ -41,7 +41,7 @@ WWW::OpenSearch::Query - Object to represent a sample query =head1 COPYRIGHT AND LICENSE -Copyright 2005-2010 by Tatsuhiko Miyagawa and Brian Cassidy +Copyright 2005-2013 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. diff --git a/lib/WWW/OpenSearch/Request.pm b/lib/WWW/OpenSearch/Request.pm index 21110e1..d32feb4 100644 --- a/lib/WWW/OpenSearch/Request.pm +++ b/lib/WWW/OpenSearch/Request.pm @@ -45,7 +45,7 @@ WWW::OpenSearch::Request - Encapsulate an opensearch request =head1 COPYRIGHT AND LICENSE -Copyright 2005-2010 by Tatsuhiko Miyagawa and Brian Cassidy +Copyright 2005-2013 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. diff --git a/lib/WWW/OpenSearch/Response.pm b/lib/WWW/OpenSearch/Response.pm index c0bea22..97bf8c7 100644 --- a/lib/WWW/OpenSearch/Response.pm +++ b/lib/WWW/OpenSearch/Response.pm @@ -94,7 +94,7 @@ is equal to $type. =head1 COPYRIGHT AND LICENSE -Copyright 2005-2010 by Tatsuhiko Miyagawa and Brian Cassidy +Copyright 2005-2013 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. diff --git a/lib/WWW/OpenSearch/Url.pm b/lib/WWW/OpenSearch/Url.pm index d3a9bc5..e562870 100644 --- a/lib/WWW/OpenSearch/Url.pm +++ b/lib/WWW/OpenSearch/Url.pm @@ -53,7 +53,7 @@ WWW::OpenSearch::Url - Object to represent a target URL =head1 COPYRIGHT AND LICENSE -Copyright 2005-2010 by Tatsuhiko Miyagawa and Brian Cassidy +Copyright 2005-2013 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. diff --git a/t/13-request.t b/t/13-request.t index 41c56b1..26f9c3e 100644 --- a/t/13-request.t +++ b/t/13-request.t @@ -32,7 +32,7 @@ use_ok( 'WWW::OpenSearch::Request' ); isa_ok( $req, 'WWW::OpenSearch::Request' ); is( lc $req->method, 'post', 'method' ); is( $req->uri, 'https://intranet/search?format=html', 'uri' ); - is( $req->content, 'l=*&c=&s=iPod&o=1', 'content' ); + is( _sort_result( $req->content ), 'c=&l=*&o=1&s=iPod', 'content' ); } { @@ -43,3 +43,10 @@ use_ok( 'WWW::OpenSearch::Request' ); is( $req->uri, 'http://example.com/?q=iPod&pw=1&format=atom', 'uri' ); } } + +sub _sort_result { + my $s = shift; + return join( '&', + sort { substr( $a, 0, 1 ) cmp substr( $b, 0, 1 ) } + split( /\&/, $s ) ); +}