/
URI.pod
1729 lines (1152 loc) · 48.9 KB
/
URI.pod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
=encoding euc-jp
=head1 NAME
=begin original
URI - Uniform Resource Identifiers (absolute and relative)
=end original
URI - (絶対や相対の)統一資源識別子(Uniform Resource Identifiers)
=head1 SYNOPSIS
$u1 = URI->new("http://www.perl.com");
$u2 = URI->new("foo", "http");
$u3 = $u2->abs($u1);
$u4 = $u3->clone;
$u5 = URI->new("HTTP://WWW.perl.com:80")->canonical;
$str = $u->as_string;
$str = "$u";
$scheme = $u->scheme;
$opaque = $u->opaque;
$path = $u->path;
$frag = $u->fragment;
$u->scheme("ftp");
$u->host("ftp.perl.com");
$u->path("cpan/");
=head1 DESCRIPTION
=begin original
This module implements the C<URI> class. Objects of this class
represent "Uniform Resource Identifier references" as specified in RFC
2396 (and updated by RFC 2732).
=end original
このモジュールは C<URI> クラスを実装します。
このクラスのオブジェクトは RFC 2396 で
指定されている (そして RFC 2732 更新された)
統一資源識別子参照 ("Uniform Resource Identifier references")を
表わしています。
=begin original
A Uniform Resource Identifier is a compact string of characters that
identifies an abstract or physical resource. A Uniform Resource
Identifier can be further classified as either a Uniform Resource Locator
(URL) or a Uniform Resource Name (URN). The distinction between URL
and URN does not matter to the C<URI> class interface. A
"URI-reference" is a URI that may have additional information attached
in the form of a fragment identifier.
=end original
統一資源識別子 (Uniform Resource Identifier) は抽象的あるいは物理的
リソースを識別するための文字のコンパクトな文字列です。
統一資源識別子はさらに統一資源位置指定子 (Uniform Resource Locator) (URL) と
統一資源名 (Uniform Resource Name) (URN) に分類することができます。
URL と URN の違いは C<URI> クラスインターフェースには関係ありません。
URI 参照 ("URI-reference") は、
フラグメントXS識別子 (fragment identifier) の形式で付けられる追加の情報を
持つことがある URI です。
=begin original
An absolute URI reference consists of three parts: a I<scheme>, a
I<scheme-specific part> and a I<fragment> identifier. A subset of URI
references share a common syntax for hierarchical namespaces. For
these, the scheme-specific part is further broken down into
I<authority>, I<path> and I<query> components. These URIs can also
take the form of relative URI references, where the scheme (and
usually also the authority) component is missing, but implied by the
context of the URI reference. The three forms of URI reference
syntax are summarized as follows:
=end original
絶対 URI リファレンスは三つの部分で構成されます: I<スキーム>(scheme)、
I<スキーム独自部分> (scheme specific part)、
そして I<フラグメント> 識別子です。
URI リファレンスのサブセットは階層的名前空間のための共通の文法を共有します。
これらのためスキーム独自部分は、さらに I<authority>, I<path>,
I<query> 要素に分けられます。
これらの URI は相対 URI リファレンスの形式を取ることもできます。
そこでは scheme (そして通常は authority も)要素がなく、しかし URI
リファレンスの文脈により暗黙のうちに決められています。
URI リファレンスの書式の三つの形式は、以下のようにまとめることができます:
<scheme>:<scheme-specific-part>#<fragment>
<scheme>://<authority><path>?<query>#<fragment>
<path>?<query>#<fragment>
=begin original
The components into which a URI reference can be divided depend on the
I<scheme>. The C<URI> class provides methods to get and set the
individual components. The methods available for a specific
C<URI> object depend on the scheme.
=end original
URI リファレンスの構成要素はスキームに依存して分割されます。
C<URI> クラスは個々の構成要素を取得し、設定するメソッドを提供します。
特定の C<URI> オブジェクトのために利用できるメソッドはスキームに依存します。
=head1 CONSTRUCTORS
(コンストラクタ)
=begin original
The following methods construct new C<URI> objects:
=end original
以下のメソッドが新しい C<URI> オブジェクトを組み立てます:
=over 4
=item $uri = URI->new( $str )
=item $uri = URI->new( $str, $scheme )
=begin original
Constructs a new URI object. The string
representation of a URI is given as argument, together with an optional
scheme specification. Common URI wrappers like "" and <>, as well as
leading and trailing white space, are automatically removed from
the $str argument before it is processed further.
=end original
新しい URI オブジェクトを組み立てます。
URI の文字列表現が引数として、オプションのスキーム指定とともに与えられます。
"" や <> のような共通の URI ラッパ、そして前や後ろにつく空白は、さらに
処理される前に自動的に $str 引数から削除されます。
=begin original
The constructor determines the scheme, maps this to an appropriate
URI subclass, constructs a new object of that class and returns it.
=end original
コンストラクタはスキームを判定し、これを適切な URI サブクラスにマップし、
そのクラスの新しいオブジェクトを組み立て、それを返します。
=begin original
The $scheme argument is only used when $str is a
relative URI. It can be either a simple string that
denotes the scheme, a string containing an absolute URI reference, or
an absolute C<URI> object. If no $scheme is specified for a relative
URI $str, then $str is simply treated as a generic URI (no scheme-specific
methods available).
=end original
$scheme 引数は $str が相対 URI のときだけ使われます。
それにはスキームを示す単純な文字列、絶対 URI リファレンスが入った文字列、
絶対 C<URI> オブジェクトが指定できます。
相対 URI に $scheme が指定されなければ、$str は単純に(何もスキーム独自の
メソッドが使えない)汎用の URI として扱われます。
=begin original
The set of characters available for building URI references is
restricted (see L<URI::Escape>). Characters outside this set are
automatically escaped by the URI constructor.
=end original
URI リファレンスを組み立てるために使える文字のセットは
制限されています(L<URI::Escape> を参照してください)。
このセットから外れる文字は URI コンストラクタにより自動的に
エスケープされます。
=item $uri = URI->new_abs( $str, $base_uri )
=begin original
Constructs a new absolute URI object. The $str argument can
denote a relative or absolute URI. If relative, then it is
absolutized using $base_uri as base. The $base_uri must be an absolute
URI.
=end original
新しい絶対 URI オブジェクトを組み立てます。
$str 引数は相対もしくは絶対 URI を示すことができます。
そしてそれは $base_uri をベースとして使うことによって、絶対化されます。
$base_uri は絶対 URI でなければなりません。
=item $uri = URI::file->new( $filename )
=item $uri = URI::file->new( $filename, $os )
=begin original
Constructs a new I<file> URI from a file name. See L<URI::file>.
=end original
ファイル名から新しい I<file> URI を組み立てます。
L<URI::file> を参照してください。
=item $uri = URI::file->new_abs( $filename )
=item $uri = URI::file->new_abs( $filename, $os )
=begin original
Constructs a new absolute I<file> URI from a file name. See
L<URI::file>.
=end original
ファイル名から新しい絶対 I<file> URI を組み立てます。
L<URI::file> を参照してください。
=item $uri = URI::file->cwd
=begin original
Returns the current working directory as a I<file> URI. See
L<URI::file>.
=end original
現在作業中のディレクトリを I<file> URI として返します。
L<URI::file> を参照してください。
=item $uri->clone
=begin original
Returns a copy of the $uri.
=end original
このメソッドは $uri のコピーを返します。
=back
=head1 COMMON METHODS
(共通メソッド)
=begin original
The methods described in this section are available for all C<URI>
objects.
=end original
このセクションで説明されるメソッドはすべての C<URI> オブジェクトで
利用可能です。
=begin original
Methods that give access to components of a URI always return the
old value of the component. The value returned is C<undef> if the
component was not present. There is generally a difference between a
component that is empty (represented as C<"">) and a component that is
missing (represented as C<undef>). If an accessor method is given an
argument, it updates the corresponding component in addition to
returning the old value of the component. Passing an undefined
argument removes the component (if possible). The description of
each accessor method indicates whether the component is passed as
an escaped or an unescaped string. A component that can be further
divided into sub-parts are usually passed escaped, as unescaping might
change its semantics.
=end original
L<URI> の構成要素へのアクセスを提供するメソッドは常にその構成要素の
古い値を返します。
その構成要素がなければ返される値は C<undef> になります。
一般的に構成要素が空であること(C<""> で表されます)と構成要素がないこと
(C<undef> で表されます)には違いがあります。
もしアクセサメソッドに引数が与えられれば、それは対応する構成要素を更新し、
その構成要素の古い値を返します。
未定義の引数を渡すと、(もし可能であれば)その構成要素を削除します。
それぞれのアクセサメソッドの説明がそのコンポーネントにエスケープされた
文字列として渡すのかあるいは、エスケープされない文字列として渡すのかを
示します。
さらに細かい部分に分割できる構成要素は、通常エスケープされて渡されます。
これはエスケープされていないとその意味が変わってしまうからです。
=begin original
The common methods available for all URI are:
=end original
すべての URI で利用可能な共通メソッドを以下に示します:
=over 4
=item $uri->scheme
=item $uri->scheme( $new_scheme )
=begin original
Sets and returns the scheme part of the $uri. If the $uri is
relative, then $uri->scheme returns C<undef>. If called with an
argument, it updates the scheme of $uri, possibly changing the
class of $uri, and returns the old scheme value. The method croaks
if the new scheme name is illegal; a scheme name must begin with a
letter and must consist of only US-ASCII letters, numbers, and a few
special marks: ".", "+", "-". This restriction effectively means
that the scheme must be passed unescaped. Passing an undefined
argument to the scheme method makes the URI relative (if possible).
=end original
$uri のスキーム部分を設定し、返します。
もし $uri が相対であれば、$uri->scheme は C<undef> を返します。
もし引数付きで呼ばれれば、$uri のスキームを更新し、おそらく $uri の
クラスを変更します。
そして古いスキームの値を返します。
新しいスキーム名が不正であれば croak します: スキーム名は文字で始まり、
US-ASCII、数字そしていくつかの特別な記号: "."、"+"、"-" だけで
構成されなければなりません。
この制限は実質的にスキームはエスケープなしに渡されるべきであることを
意味しています。
スキームに未定義の引数を渡すと(可能であれば) URI は相対になります。
=begin original
Letter case does not matter for scheme names. The string
returned by $uri->scheme is always lowercase. If you want the scheme
just as it was written in the URI in its original case,
you can use the $uri->_scheme method instead.
=end original
文字の大文字/小文字はスキーム名では問題ありません。
$uri->scheme で返される値は常に小文字です。
もし URI に書いた元の大文字/小文字の状態が欲しいのであれば、代わりに
$uri->_scheme メソッドを使うことができます。
=item $uri->opaque
=item $uri->opaque( $new_opaque )
=begin original
Sets and returns the scheme-specific part of the $uri
(everything between the scheme and the fragment)
as an escaped string.
=end original
$uri のスキーム独自部分(スキームからフラグメントまでのすべて)を、
エスケープされた文字列として、設定し、返します。
=item $uri->path
=item $uri->path( $new_path )
=begin original
Sets and returns the same value as $uri->opaque unless the URI
supports the generic syntax for hierarchical namespaces.
In that case the generic method is overridden to set and return
the part of the URI between the I<host name> and the I<fragment>.
=end original
URI が階層的な名前空間のための一般的な書式をサポートしていなければ、
このメソッドは $uri->opaque と同じ値を設定し、返します。
その場合、I<ホスト名> と I<フラグメント> の間にある URI の一部を設定し、
返すように汎用メソッドがオーバーライドされます。
=item $uri->fragment
=item $uri->fragment( $new_frag )
=begin original
Returns the fragment identifier of a URI reference
as an escaped string.
=end original
URI リファレンスのフラグメント識別子をエスケープされた文字列として
返します。
=item $uri->as_string
=begin original
Returns a URI object to a plain ASCII string. URI objects are
also converted to plain strings automatically by overloading. This
means that $uri objects can be used as plain strings in most Perl
constructs.
=end original
URI オブジェクトをプレーンな ASCII 文字列にして返します。
URI オブジェクトはオーバーロードによっても自動的にプレーンな文字列に
変換されます。
つまり $uri オブジェクトはほとんどの Perl 構造においてプレーンな
文字列として扱うことができるということです。
=item $uri->as_iri
=begin original
Returns a Unicode string representing the URI. Escaped UTF-8 sequences
representing non-ASCII characters are turned into their corresponding Unicode
code point.
=end original
URI を表現する Unicode 文字列を返します。
非 ASCII 文字を表現するエスケープされた UTF-8 並びは、
対応する Unicode 符号位置に変換されます。
=item $uri->canonical
=begin original
Returns a normalized version of the URI. The rules
for normalization are scheme-dependent. They usually involve
lowercasing the scheme and Internet host name components,
removing the explicit port specification if it matches the default port,
uppercasing all escape sequences, and unescaping octets that can be
better represented as plain characters.
=end original
URI の正規化されたものを返します。
正規化のルールはスキームによって違います。
通常はスキームとインターネットホスト名要素の小文字化、
デフォルトポートと同じになっている明確なポート指定の削除、すべての
エスケープシーケンスの大文字化、普通に表現することができる
エスケープされていオクテットの通常化です。
=begin original
For efficiency reasons, if the $uri is already in normalized form,
then a reference to it is returned instead of a copy.
=end original
効率の理由から、$uri がすでに正規化されている形式であれば、コピーの代わりに
それへのリファレンスが返されます。
=item $uri->eq( $other_uri )
=item URI::eq( $first_uri, $other_uri )
=begin original
Tests whether two URI references are equal. URI references
that normalize to the same string are considered equal. The method
can also be used as a plain function which can also test two string
arguments.
=end original
二つの URI リファレンスが同一であるかを調べます。
同じ文字列に正規化された URI リファレンスは同一であると考えます。
メソッドは二つの文字列引数テストすることもできる単なる関数として使うことも
出来ます。
=begin original
If you need to test whether two C<URI> object references denote the
same object, use the '==' operator.
=end original
二つの C<URI> オブジェクトリファレンスが同じオブジェクトを示しているかを
テストする必要があれば、'==' 演算子を使ってください。
=item $uri->abs( $base_uri )
=begin original
Returns an absolute URI reference. If $uri is already
absolute, then a reference to it is simply returned. If the $uri
is relative, then a new absolute URI is constructed by combining the
$uri and the $base_uri, and returned.
=end original
絶対 URI リファレンスを返します。
もし $uri がすでに絶対であれば、それへのリファレンスが単に返されます。
$uri が相対であれば、$uri と $base_uri をつなげることにより新しい
絶対 URI が組み立てられ、返されます。
=item $uri->rel( $base_uri )
=begin original
Returns a relative URI reference if it is possible to
make one that denotes the same resource relative to $base_uri.
If not, then $uri is simply returned.
=end original
同じリソースを表す $base_uri への相対を作ることが出来れば、
相対 URI リファレンスを返します。
そうでなければ、$uri が単に返されます。
=item $uri->secure
=begin original
Returns a TRUE value if the URI is considered to point to a resource on
a secure channel, such as an SSL or TLS encrypted one.
=end original
URI が、 SSL や TLS で暗号化されているような、安全なチャンネルの
資源を示していると考えられる場合に、真の値を返します。
=back
=head1 GENERIC METHODS
(汎用メソッド)
=begin original
The following methods are available to schemes that use the
common/generic syntax for hierarchical namespaces. The descriptions of
schemes below indicate which these are. Unknown schemes are
assumed to support the generic syntax, and therefore the following
methods:
=end original
以下のメソッドは、階層的名前空間のための共通/汎用の書式を使う
スキームに使うことが出来ます。
下記のスキームの説明はこれらであることを示します。
分からないスキームは汎用の書式をサポートしており、そのため
以下のメソッドをサポートしているものと考えられます。
=over 4
=item $uri->authority
=item $uri->authority( $new_authority )
=begin original
Sets and returns the escaped authority component
of the $uri.
=end original
$uri のエスケープされた authority(認証)構成要素を設定し、返します。
=item $uri->path
=item $uri->path( $new_path )
=begin original
Sets and returns the escaped path component of
the $uri (the part between the host name and the query or fragment).
The path can never be undefined, but it can be the empty string.
=end original
$uri のエスケープされた path 構成要素(ホスト名とクエリ(=query)または
フラグメントの間の部分)を設定し、返します。
path は決して未定義になりませんが、空文字列にすることは出来ます。
=item $uri->path_query
=item $uri->path_query( $new_path_query )
=begin original
Sets and returns the escaped path and query
components as a single entity. The path and the query are
separated by a "?" character, but the query can itself contain "?".
=end original
エスケープされた path と query 構成要素を1つのエンティティとして設定し、
取得します。
path と query は "?" 文字により分けられますが、query それ自身に
"?" を入れることが出来ます。
=item $uri->path_segments
=item $uri->path_segments( $segment, ... )
=begin original
Sets and returns the path. In a scalar context, it returns
the same value as $uri->path. In a list context, it returns the
unescaped path segments that make up the path. Path segments that
have parameters are returned as an anonymous array. The first element
is the unescaped path segment proper; subsequent elements are escaped
parameter strings. Such an anonymous array uses overloading so it can
be treated as a string too, but this string does not include the
parameters.
=end original
path を設定し、返します。
スカラコンテキストでは $uri->path と同じ値を返します。
リストコンテキストでは path を構成するエスケープされない path セグメントを
返します。
パラメータを持っている path セグメントは無名配列として返されます。
最初の要素はエスケープされない path セグメントプロパーです;
続く要素はエスケープされえたパラメータ文字列です。
そのような無名配列は文字列としても扱うことが出来るようオーバーロードを
使いますが、この文字列にはパラメータは含まれません。
=begin original
Note that absolute paths have the empty string as their first
I<path_segment>, i.e. the I<path> C</foo/bar> have 3
I<path_segments>; "", "foo" and "bar".
=end original
絶対パスは最初の I<path_segment> として空文字列を持つことに注意してください;
つまり、I<path> C</foo/bar> は三つの I<path_segments> つまり
"", "foo", "bar" になることに注意してください。
=item $uri->query
=item $uri->query( $new_query )
=begin original
Sets and returns the escaped query component of
the $uri.
=end original
$uri のエスケープさえれた query 構成要素を設定し、返します。
=item $uri->query_form
=item $uri->query_form( $key1 => $val1, $key2 => $val2, ... )
=item $uri->query_form( $key1 => $val1, $key2 => $val2, ..., $delim )
=item $uri->query_form( \@key_value_pairs )
=item $uri->query_form( \@key_value_pairs, $delim )
=item $uri->query_form( \%hash )
=item $uri->query_form( \%hash, $delim )
=begin original
Sets and returns query components that use the
I<application/x-www-form-urlencoded> format. Key/value pairs are
separated by "&", and the key is separated from the value by a "="
character.
=end original
I<application/x-www-form-urlencoded> 形式を使った query 構成要素を設定し、
返します。
キー/値の組は "&" で分けられ、そのキーは値から "=" 文字で分けられます。
=begin original
The form can be set either by passing separate key/value pairs, or via
an array or hash reference. Passing an empty array or an empty hash
removes the query component, whereas passing no arguments at all leaves
the component unchanged. The order of keys is undefined if a hash
reference is passed. The old value is always returned as a list of
separate key/value pairs. Assigning this list to a hash is unwise as
the keys returned might repeat.
=end original
フォームは、区切られたキー/値の組を渡すか、配列またはハッシュのリファレンス
経由で設定できます。
空配列や空ハッシュを渡すと、クエリ要素を削除する一方、
全く引数を渡さないと、要素は無変更で残されます。
ハッシュリファレンスが渡された場合、キーの順序は未定義です。
古い値が常に、区切られたキー/値の組のリストとして返されます。
キーは繰り返されるかもしれないので、
このリストをハッシュに代入することは賢明ではありません。
=begin original
The values passed when setting the form can be plain strings or
references to arrays of strings. Passing an array of values has the
same effect as passing the key repeatedly with one value at a time.
All the following statements have the same effect:
=end original
フォームを設定するときに渡される値は、プレーンな文字列か、
文字列の配列のリファレンスを使えます。
値の配列を渡すことは、一度に一つずつ値を指定するキーを繰り返すのと
同じ効果があります。
以下の文は全て同じ効果です:
$uri->query_form(foo => 1, foo => 2);
$uri->query_form(foo => [1, 2]);
$uri->query_form([ foo => 1, foo => 2 ]);
$uri->query_form([ foo => [1, 2] ]);
$uri->query_form({ foo => [1, 2] });
=begin original
The $delim parameter can be passed as ";" to force the key/value pairs
to be delimited by ";" instead of "&" in the query string. This
practice is often recommended for URLs embedded in HTML or XML
documents as this avoids the trouble of escaping the "&" character.
You might also set the $URI::DEFAULT_QUERY_FORM_DELIMITER variable to
";" for the same global effect.
=end original
$delim 引数は、クエリ文字列内で "&" の代わりに ";" で
キー/値の組を区切ることを強制するために、";" を渡せます。
この慣習は、"&" 文字をエスケープする問題を避けられるので、
HTML や XML 文書中の URL としてしばしば推奨されます。
同じグローバルな効果を得るために
$URI::DEFAULT_QUERY_FORM_DELIMITER 変数に ";" を設定するのもよいでしょう。
=begin original
The C<URI::QueryParam> module can be loaded to add further methods to
manipulate the form of a URI. See L<URI::QueryParam> for details.
=end original
URI の形式を操作するためのさらなるメソッドを追加するために、
C<URI::QueryParam> モジュールを読み込めます。
詳しくは L<URI::QueryParam> を参照してください。
=item $uri->query_keywords
=item $uri->query_keywords( $keywords, ... )
=item $uri->query_keywords( \@keywords )
=begin original
Sets and returns query components that use the
keywords separated by "+" format.
=end original
"+" により分けられるキーワードのフォーマットを使っている query 構成要素を
設定し、返します。
=begin original
The keywords can be set either by passing separate keywords directly
or by passing a reference to an array of keywords. Passing an empty
array removes the query component, whereas passing no arguments at
all leaves the component unchanged. The old value is always returned
as a list of separate words.
=end original
キーワードは、区切られたキーワードを直接渡すか、
キーワードの配列のリファレンスを渡すことで設定できます。
空配列を渡すと、クエリ要素を削除する一方、
全く引数を渡さないと、要素は無変更で残されます。
古い値が常に、区切られたキーワードのリストとして返されます。
=back
=head1 SERVER METHODS
(サーバメソッド)
=begin original
For schemes where the I<authority> component denotes an Internet host,
the following methods are available in addition to the generic
methods.
=end original
I<authority> 構成要素がインターネットホストを示すスキームは汎用メソッドに
加えて以下のメソッドを利用することが出来ます。
=over 4
=item $uri->userinfo
=item $uri->userinfo( $new_userinfo )
=begin original
Sets and returns the escaped userinfo part of the
authority component.
=end original
エスケープされた authority 構成要素の userinfo 部分を設定し、返します。
=begin original
For some schemes this is a user name and a password separated by
a colon. This practice is not recommended. Embedding passwords in
clear text (such as URI) has proven to be a security risk in almost
every case where it has been used.
=end original
いくつかのスキームにとっては、コロンで区切られたこれはユーザ名と
パスワードになります。
この実装は推奨されません。
(URI のように) 平文に埋め込むことは、使うすべての場合において
セキュリティのリスクとなることが証明されています。
=item $uri->host
=item $uri->host( $new_host )
=begin original
Sets and returns the unescaped hostname.
=end original
エスケープされないホスト名を設定し、返します。
=begin original
If the $new_host string ends with a colon and a number, then this
number also sets the port.
=end original
$new_host 文字列がコロンと数字で終わっていれば、この番号はポートを
設定します。
=begin original
For IPv6 addresses the brackets around the raw address is removed in the return
value from $uri->host. When setting the host attribute to an IPv6 address you
can use a raw address or one enclosed in brackets. The address needs to be
enclosed in brackets if you want to pass in a new port value as well.
=end original
IPv6 アドレスのために、$uri->host の返り値では生アドレスの周りの
大かっこは削除されます。
host 属性に IPv6 アドレスを設定するとき、
生のアドレスと一つの大かっこで囲まれたものを使えます。
新しいポート値も渡したいときは、アドレスは大かっこで囲まれる必要があります。
=item $uri->ihost
=begin original
Returns the host in Unicode form. Any IDNA A-labels are turned into U-labels.
=end original
Unicode 形式でホストを帰します。
IDNA A ラベルは U ラベルに変えられます。
=item $uri->port
=item $uri->port( $new_port )
=begin original
Sets and returns the port. The port is a simple integer
that should be greater than 0.
=end original
ポートを設定し、返します。
ポートは 0 より大きくなければならない単純な整数です。
=begin original
If a port is not specified explicitly in the URI, then the URI scheme's default port
is returned. If you don't want the default port
substituted, then you can use the $uri->_port method instead.
=end original
URI で明確にポートが指定されなければ、URI スキームのデフォルトのポートが
返されます。
デフォルトのポートへの置換をして欲しくないのであれば、$uri->_port メソッドを
代りに使うことが出来ます。
=item $uri->host_port
=item $uri->host_port( $new_host_port )
=begin original
Sets and returns the host and port as a single
unit. The returned value includes a port, even if it matches the
default port. The host part and the port part are separated by a
colon: ":".
=end original
ホストとポートを一つの単位として設定し、返します。
デフォルトのポートにマッチしていても、返される値にはポートも含まれます。
ホスト部分とポート部分はコロン ":" で区切られます。
=begin original
For IPv6 addresses the bracketing is preserved; thus
URI->new("http://[::1]/")->host_port returns "[::1]:80". Contrast this with
$uri->host which will remove the brackets.
=end original
IPv6 アドレスのために、大かっこは保存されます; 従って、
URI->new("http://[::1]/")->host_port は "[::1]:80" を返します。
これは、大かっこを取り除く $uri->host と異なります。
=item $uri->default_port
=begin original
Returns the default port of the URI scheme to which $uri
belongs. For I<http> this is the number 80, for I<ftp> this
is the number 21, etc. The default port for a scheme can not be
changed.
=end original
$uri が所属する URI スキームのデフォルトポートを返します。
I<http> では番号 80 になり、
I<ftp> では番号 21 になります。
スキームのためのデフォルトポートは変更できません。
=back
=head1 SCHEME-SPECIFIC SUPPORT
(スキーム特有サポート)
=begin original
Scheme-specific support is provided for the following URI schemes. For C<URI>
objects that do not belong to one of these, you can only use the common and
generic methods.
=end original
以下の URI スキームはスキーム固有のサポートが提供されています。
これらのうちの一つに所属していない C<URI> オブジェクトでは、共通と
汎用メソッドしか使えません。
=over 4
=item B<data>:
=begin original
The I<data> URI scheme is specified in RFC 2397. It allows inclusion
of small data items as "immediate" data, as if it had been included
externally.
=end original
I<data> URI スキームは RFC2397 で定義されています。
これはまるで外部に含まれているかのように、小さなデータ要素を
"immediate" データとして含むことを許しています。
=begin original
C<URI> objects belonging to the data scheme support the common methods
and two new methods to access their scheme-specific components:
$uri->media_type and $uri->data. See L<URI::data> for details.
=end original
data スキームに属する C<URI> オブジェクトは共通メソッドと、スキーム特有の
構成要素にアクセスするための2つの新しいメソッド; $uri->media_type と
$uri->data をサポートします。
詳細は L<URI::data> を参照してください。
=item B<file>:
=begin original
An old specification of the I<file> URI scheme is found in RFC 1738.