line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URI::Based; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
38571
|
use 5.006; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
71
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
59
|
|
5
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
59
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1604
|
use URI::WithBase; |
|
2
|
|
|
|
|
17115
|
|
|
2
|
|
|
|
|
52
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
16
|
use base "URI::WithBase"; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
338
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
URI::Based - Define a base URI and then generate variations on it |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 1.03 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '1.03'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use URI::Based; |
26
|
|
|
|
|
|
|
my $uri = URI::Based->new( 'http://angel.net/~nic' ); |
27
|
|
|
|
|
|
|
say $uri->with( '/path/to/add', param1 => 'some value' ); |
28
|
|
|
|
|
|
|
say $uri->with( '/a/different/path', param2 => 'other value', param3 => 'yet another' ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# prints: |
31
|
|
|
|
|
|
|
# http://angel.net/~nic/path/to/add?param1=some+value |
32
|
|
|
|
|
|
|
# http://angel.net/~nic/a/different/path?param2=other+value¶m3=yet+another |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This class inherits all the methods of URI::WithBase and URI, and adds |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 new() |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Automatically sets the base and the the URI to the same initial value |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
2
|
1
|
39
|
sub new { $_[0]->SUPER::new($_[1],$_[1]) } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 with() |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Sets the URI to the base plus the path and query given, and returns the URI. The first |
49
|
|
|
|
|
|
|
argument is the path, the rest are parameter => value pairs, given in any format |
50
|
|
|
|
|
|
|
acceptable to URI::query_form(). |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
3
|
1
|
9672
|
sub with { my $u = shift; my $p = shift; $u->path($u->base->path . $p); $u->query_form( @_ ); $u; } |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
263
|
|
|
3
|
|
|
|
|
225
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SEE ALSO |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
L |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 AUTHOR |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Nic Wolff, |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 BUGS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Please report any bugs or feature requests through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SUPPORT |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
perldoc URI::Based |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
You can also look for information at: |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=over 4 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * This module on GitHub |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
L |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * GitHub request tracker (report bugs here) |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
L |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
L |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * Search CPAN |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
L |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=back |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Copyright 2012 Nic Wolff. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
101
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
102
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; # End of URI::Based |