diff -Nru libiri-perl-0.006/Changes.ttl libiri-perl-0.007/Changes.ttl --- libiri-perl-0.006/Changes.ttl 2016-07-19 14:28:22.000000000 +0000 +++ libiri-perl-0.007/Changes.ttl 2017-04-03 04:42:01.000000000 +0000 @@ -15,6 +15,21 @@ . + + dcterms:isVersionOf my:project ; + dcterms:replaces ; + + doap:Version [ + doap:revision "0.007" ; + doap:created "2017-04-03" ; + ] ; + asc:changes [ + asc:addition "Add query_form accessor and set_query_param constructor (#4)." ; + asc:update "Updated Makefile.PL for perl 5.26." ; + ] ; + . + + dcterms:isVersionOf my:project ; dcterms:replaces ; diff -Nru libiri-perl-0.006/debian/changelog libiri-perl-0.007/debian/changelog --- libiri-perl-0.006/debian/changelog 2017-01-22 22:46:42.000000000 +0000 +++ libiri-perl-0.007/debian/changelog 2017-07-28 09:31:06.000000000 +0000 @@ -1,3 +1,13 @@ +libiri-perl (0.007-1) unstable; urgency=medium + + * Team upload. + * Import upstream version 0.007 + * Update copyright file + * debian/control: Remove versioned dep libtype-tiny-perl + * Bump Standards-Version to 4.0.0 (no changes) + + -- Angel Abad Fri, 28 Jul 2017 11:31:06 +0200 + libiri-perl (0.006-3) unstable; urgency=medium * Change Homepage (d/control) and Source (d/copyright) header to diff -Nru libiri-perl-0.006/debian/control libiri-perl-0.007/debian/control --- libiri-perl-0.006/debian/control 2017-01-22 22:37:54.000000000 +0000 +++ libiri-perl-0.007/debian/control 2017-07-28 09:30:22.000000000 +0000 @@ -1,31 +1,30 @@ Source: libiri-perl -Section: perl -Priority: optional Maintainer: Debian Perl Group Uploaders: Axel Beckert , - Jonas Smedegaard + Jonas Smedegaard +Section: perl +Testsuite: autopkgtest-pkg-perl +Priority: optional Build-Depends: debhelper (>= 9) Build-Depends-Indep: libmoo-perl, libmoox-handlesvia-perl, libtry-tiny-perl, - libtype-tiny-perl (>= 0.008), + libtype-tiny-perl, liburi-perl, perl (>= 5.15.2) -Standards-Version: 3.9.8 +Standards-Version: 4.0.0 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libiri-perl.git Vcs-Git: https://anonscm.debian.org/git/pkg-perl/packages/libiri-perl.git Homepage: https://metacpan.org/pod/IRI -Testsuite: autopkgtest-pkg-perl Package: libiri-perl Architecture: all Depends: libmoo-perl, libmoox-handlesvia-perl, - libtype-tiny-perl (>= 0.008), + libtype-tiny-perl, libtry-tiny-perl, - perl (>= 5.14.0), - ${misc:Depends}, - ${perl:Depends} + ${perl:Depends}, + ${misc:Depends} Description: Handle Internationalized Resource Identifiers in Perl The IRI module is a Perl implementation of Internationalized Resource Identifiers (IRIs) as defined by RFC 3987. diff -Nru libiri-perl-0.006/debian/copyright libiri-perl-0.007/debian/copyright --- libiri-perl-0.006/debian/copyright 2017-01-22 22:44:09.000000000 +0000 +++ libiri-perl-0.007/debian/copyright 2017-07-28 09:26:56.000000000 +0000 @@ -23,8 +23,8 @@ advantage that it requires no installation for end-users. Files: debian/* -Copyright: 2014, Axel Beckert - 2016, Angel Abad +Copyright: 2014-2017, Axel Beckert + 2016-2017, Angel Abad 2016, Jonas Smedegaard License: Artistic or GPL-1+ @@ -32,8 +32,8 @@ This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, which comes with Perl. . - On Debian systems, the complete text of the Artistic License 1.0 - (Perl) can be found in `/usr/share/common-licenses/Artistic'. + On Debian systems, the complete text of the Artistic License can be + found in `/usr/share/common-licenses/Artistic'. License: GPL-1+ This program is free software; you can redistribute it and/or modify diff -Nru libiri-perl-0.006/lib/IRI.pm libiri-perl-0.007/lib/IRI.pm --- libiri-perl-0.006/lib/IRI.pm 2016-07-19 14:28:18.000000000 +0000 +++ libiri-perl-0.007/lib/IRI.pm 2017-04-03 04:38:44.000000000 +0000 @@ -6,7 +6,7 @@ =head1 VERSION -This document describes IRI version 0.006 +This document describes IRI version 0.007 =head1 SYNOPSIS @@ -79,7 +79,7 @@ package IRI { use v5.14; use warnings; - our $VERSION = '0.006'; + our $VERSION = '0.007'; use Moo; use MooX::HandlesVia; use Types::Standard qw(Str InstanceOf HashRef Bool); @@ -105,7 +105,6 @@ }); has 'value' => (is => 'ro', isa => Str, default => ''); has 'components' => (is => 'ro', writer => '_set_components'); - has 'as_string' => (is => 'ro', isa => Str, lazy => 1, builder => '_as_string'); has 'abs' => (is => 'ro', lazy => 1, builder => '_abs'); has 'resolved_components' => ( is => 'ro', @@ -392,7 +391,7 @@ return $value; } - sub _as_string { + sub as_string { my $self = shift; if ($self->has_base) { return $self->abs; @@ -413,7 +412,7 @@ # has authority $iri .= "//"; if (my $u = $components->{user}) { - $iri .= "${u}@"; + $iri .= sprintf('%s@', $u); } if (defined(my $h = $components->{host})) { $iri .= $h // ''; @@ -428,15 +427,67 @@ } if (defined(my $q = $components->{query})) { - $iri .= "?$q"; + $iri .= '?' . $q; } if (defined(my $f = $components->{fragment})) { - $iri .= "#$f"; + $iri .= '#' . $f; } return $iri; } + + sub _encode { + my $str = shift; + $str =~ s~([%])~'%' . sprintf('%02x', ord($1))~ge; # gen-delims + $str =~ s~([/:?#@]|\[|\])~'%' . sprintf('%02x', ord($1))~ge; # gen-delims + $str =~ s~([$!&'()*+,;=])~'%' . sprintf('%02x', ord($1))~ge; # sub-delims + return $str; + } + + sub _unencode { + my $str = shift; + if (defined($str)) { + $str =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; + } + return $str; + } + +=item C<< query_form >> + +Returns a HASH of key-value mappings for the unencoded, parsed query form data. + +=cut + + sub query_form { + my $self = shift; + my $q = $self->query // return; + my @pairs = split(/&/, $q); + return map { _unencode($_) } map { split(/=/, $_) } @pairs; + } + +=item C<< set_query_param ( $key => $value ) >> + +sets the respective query form value and returns a new L object. + +=cut + + sub set_query_param { + my $self = shift; + my $q = $self->query // return; + my %map = map { _unencode($_) } map { split(/=/, $_) } split(/&/, $q); + while (my ($k, $v) = splice(@_, 0, 2)) { + $map{$k} = $v; + } + + my %c = %{ $self->components }; + my @pairs = map { join('=', (_encode($_), _encode($map{$_}))) } keys %map; + warn Dumper(\@pairs); + $c{query} = join('&', @pairs); + + my $v = $self->_string_from_components(\%c); + return $self->new( value => $v ); + } } 1; diff -Nru libiri-perl-0.006/Makefile.PL libiri-perl-0.007/Makefile.PL --- libiri-perl-0.006/Makefile.PL 2016-02-18 15:19:06.000000000 +0000 +++ libiri-perl-0.007/Makefile.PL 2017-04-02 01:36:31.000000000 +0000 @@ -1,6 +1,7 @@ use strict; use warnings; +use lib '.'; use inc::Module::Install; name 'IRI'; diff -Nru libiri-perl-0.006/MANIFEST libiri-perl-0.007/MANIFEST --- libiri-perl-0.006/MANIFEST 2016-07-19 14:31:36.000000000 +0000 +++ libiri-perl-0.007/MANIFEST 2014-07-28 19:35:40.000000000 +0000 @@ -21,4 +21,3 @@ xt/pod-coverage.t xt/pod.t README -SIGNATURE Public-key signature (added by MakeMaker) diff -Nru libiri-perl-0.006/SIGNATURE libiri-perl-0.007/SIGNATURE --- libiri-perl-0.006/SIGNATURE 2016-07-19 14:31:39.000000000 +0000 +++ libiri-perl-0.007/SIGNATURE 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -This file contains message digests of all files listed in MANIFEST, -signed via the Module::Signature module, version 0.79. - -To verify the content in this distribution, first make sure you have -Module::Signature installed, then type: - - % cpansign -v - -It will check each file's integrity, as well as the signature's -validity. If "==> Signature verified OK! <==" is not displayed, -the distribution may already have been compromised, and you should -not run its Makefile.PL or Build.PL. - ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -SHA1 268ffd5cdfd14a76ed73680c25620b87acb2c446 Changes -SHA1 417f62dd053142b767076cc910b5e5e5502b8973 Changes.ttl -SHA1 a87d4f34e2cae47dffb30f433995c2bb47fd1fed Changes.xml -SHA1 88a9956a698251e7037d96cf9091eb61793d5ab7 MANIFEST -SHA1 cc5ed3b42e3b8c0a533cab02faae47d927450ced META.yml -SHA1 95d160030f82e1c3313a717eeb3b7646b86cf11f Makefile.PL -SHA1 1b080a25d9a14cf6498ee9ee1b713a352161bb9b README -SHA1 bce3c51bb369419603298064b78e14077b93af66 inc/Module/Install.pm -SHA1 d001b4b9a48395a8c4134b234a0e1789138427c5 inc/Module/Install/AuthorTests.pm -SHA1 fe220f215f645500ce8f14ff5e19d9a28692af56 inc/Module/Install/Base.pm -SHA1 b56ed8e42c600e08007d152cf0b1438a7c3b7f6e inc/Module/Install/Can.pm -SHA1 470809a1dbe03e197e74dde79c6af40b5f7f9b26 inc/Module/Install/DOAPChangeSets.pm -SHA1 99c531a17a67ce5250df2ae151cc48c80d914cde inc/Module/Install/Fetch.pm -SHA1 76efdca3603159e0ae0e18f19fe72a0211a69529 inc/Module/Install/Makefile.pm -SHA1 2e33e87882d60db3913da6284dd5295e5315e18a inc/Module/Install/Metadata.pm -SHA1 c830b819e61bda5eca077c6291293bba61b3b9f2 inc/Module/Install/Win32.pm -SHA1 cb52b9d6f88d512d448a6f35ed0af0d1201a134b inc/Module/Install/WriteAll.pm -SHA1 8b85818cb2bce86f3dd6d062b9997c3682c988b1 lib/IRI.pm -SHA1 8239904ffc3b6705243167ccb7ed4da00d5d2543 t/00-simple.t -SHA1 eec47266aeb7f5467481218e934c40cbd87d1188 t/bugs.t -SHA1 49bf69502718d2931ede3fa80220628841d3ab2d t/coercion.t -SHA1 c179a0e5169b56dd5d6c8eae04cba68383158224 xt/pod-coverage.t -SHA1 6387af7a5fde0747be5bc9ad2ec15ca9759bd95a xt/pod.t ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1 -Comment: GPGTools - http://gpgtools.org - -iEYEARECAAYFAleOOcgACgkQhPK6VMqoyC2OVgCgqXIIJkQrJrPmUpFzx+Vi4ynO -CjIAn1j6rzdNLE1gXucXwWay0ax0Hb3u -=hht9 ------END PGP SIGNATURE-----