perlfaq-5.0150042 > 5.10.1 との差分

perlfaq9 5.10.1 と 5.0150042 の差分

11
22=encoding euc-jp
33
44=head1 NAME
55
66=begin original
77
8perlfaq9 - Networking
8perlfaq9 - Web, Email and Networking
99
1010=end original
1111
12perlfaq9 - ネットワーク
12perlfaq9 - Web、メール、ネットワーク
1313
1414=head1 DESCRIPTION
1515
1616=begin original
1717
18This section deals with questions related to networking, the internet,
18This section deals with questions related to running web sites,
19and a few on the web.
19sending and receiving email as well as general networking.
2020
2121=end original
2222
23このセクションでは、ネットワーク、インターネット、web に関する
23このセクションでは、web サイトの実行、メールの送受信、および一般的な
24質問を扱っています。
24ネットワークに関する質問を扱っています。
2525
26=head2 What is the correct form of response from a CGI script?
26=head2 Should I use a web framework?
2727
28(CGI リプトからの返答の正しい形は?)
28(web フレームワーを使うべき?)
2929
3030=begin original
3131
32(Alan Flavell <flavell+www@a5.ph.gla.ac.uk> answers...)
32Yes. If you are building a web site with any level of interactivity
33(forms / users / databases), you
34will want to use a framework to make handling requests
35and responses easier.
3336
3437=end original
3538
36(Alan Flavell <flavell+www@a5.ph.gla.ac.uk> が答えます...)
39はい。
40何らかのレベルの相互作用(フォーム、ユーザー、データベース)を持つ web サイトを
41構築しているなら、リクエストとレスポンスをより簡単に扱えるような
42フレームワークを使いたいでしょう。
3743
3844=begin original
3945
40The Common Gateway Interface (CGI) specifies a software interface between
46If there is no interactivity then you may still want
41a program ("CGI script") and a web server (HTTPD). It is not specific
47to look at using something like L<Template Toolkit|https://metacpan.org/module/Template>
42to Perl, and has its own FAQs and tutorials, and usenet group,
48or L<Plack::Middleware::TemplateToolkit>
43comp.infosystems.www.authoring.cgi
49so maintenance of your HTML files (and other assets) is easier.
4450
4551=end original
4652
47The Common Gateway Interface (CGI) はプログラム("CGI スクリプト")と
53相互作用がなくても、HTML ファイル(およびその他の資産)の管理をより
48web サーバ (HTTPD) の間のソフトウェアインターフェースを定めていま
54簡単にるために
49これは Perl 固有のものではないので、独自の FAQと独自のチュートリアル、
55L<Template Toolkit|https://metacpan.org/module/Template>
50そして独自の usenet group である comp.infosystems.www.authoring.cgi
56L<Plack::Middleware::TemplateToolkit> のようなものを使いたいかもしれません。
51あります。
5257
53=begin original
58=head2 Which web framework should I use?
59X<framework> X<CGI.pm> X<CGI> X<Catalyst> X<Dancer>
55The CGI specification is outlined in an informational RFC:
56http://www.ietf.org/rfc/rfc3875
57
58=end original
59
60CGI 仕様は RFC に概要が述べられています:
61http://www.ietf.org/rfc/rfc3875
62
63=begin original
64
65Other relevant documentation listed in: http://www.perl.org/CGI_MetaFAQ.html
66
67=end original
68
69その他の関連する文書のリストは http://www.perl.org/CGI_MetaFAQ.html に
70あります。
71
72=begin original
73
74These Perl FAQs very selectively cover some CGI issues. However, Perl
75programmers are strongly advised to use the CGI.pm module, to take care
76of the details for them.
77
78=end original
79
80これらの Perl FAQ はいくつかの CGI の問題についてとても抜粋して
81カバーしています。
82しかし、これらの詳細に用心するために、Perl プログラマは CGI モジュールを
83使うことを強く忠告されます。
84
85=begin original
86
87The similarity between CGI response headers (defined in the CGI
88specification) and HTTP response headers (defined in the HTTP
89specification, RFC2616) is intentional, but can sometimes be confusing.
90
91=end original
92
93(CGI 仕様に定義されている) CGI レスポンスヘッダと、(RFC2616 の HTTP 仕様で
94定義されている) HTTP レスポンスヘッダの類似性は意図的なものですが、
95時々混乱を引き起こします。
96
97=begin original
98
99The CGI specification defines two kinds of script: the "Parsed Header"
100script, and the "Non Parsed Header" (NPH) script. Check your server
101documentation to see what it supports. "Parsed Header" scripts are
102simpler in various respects. The CGI specification allows any of the
103usual newline representations in the CGI response (it's the server's
104job to create an accurate HTTP response based on it). So "\n" written in
105text mode is technically correct, and recommended. NPH scripts are more
106tricky: they must put out a complete and accurate set of HTTP
107transaction response headers; the HTTP specification calls for records
108to be terminated with carriage-return and line-feed, i.e ASCII \015\012
109written in binary mode.
110
111=end original
112
113CGI 仕様は 2 種類のスクリプトを定義しています:
114"Parsed Header" スクリプトと、"Non Parsed Header" (NPH) スクリプト。
115何をサポートしているかについてはサーバーのドキュメントをチェックして
116ください。
117"Parsed Header" スクリプトは色々な側面においてより単純です。
118CGI 仕様は CGI レスポンスとして一般的な改行表現のどれを使ってもよいことに
119なっています(そこから正確な HTTP レスポンスを作成するのはサーバの仕事です)。
120従って "\n" をテキストモードで書くのは技術的に正しく、推奨されています。
121NPH スクリプトではより微妙です: ここでは完全に正確な HTTP トランザクション
122レスポンスヘッダを出力しなければなりません; HTTP 仕様はレコードが復帰と
123改行(つまりバイナリモードで ASCII コードの \015\012 が書かれる)で
124終端されていることを要求します。
12560
126=begin original
61(どの web フレームワークを使うべき?)
127
128Using CGI.pm gives excellent platform independence, including EBCDIC
129systems. CGI.pm selects an appropriate newline representation
130($CGI::CRLF) and sets binmode as appropriate.
131
132=end original
133
134CGI.pm を使うことで、EBCDIC システムを含むすばらしいプラットフォーム
135独立性が得られます。
136CGI.pm は適切な改行表現を選択し($CGI::CRLF)、binmode を適切にセットします。
137
138=head2 My CGI script runs from the command line but not the browser. (500 Server Error)
139
140(私の CGI スクリプトはコマンドラインでは動くのだけど、ブラウザ上では動きません (500 Server Error になります))
14162
14263=begin original
14364
144Several things could be wrong. You can go through the "Troubleshooting
65There is no simple answer to this question. Perl frameworks can run everything
145Perl CGI scripts" guide at
66from basic file servers and small scale intranets to massive multinational
67multilingual websites that are the core to international businesses.
14668
14769=end original
14870
149可能性いくつかありま
71この質問への単純な答えはありません
150以下にある "Troubleshooting Perl CGI scripts" ガドを読みましょう:
72Perl のフレームワークには、基本的なファルサーバとスケールの小さい
73イントラネット用から国際ビジネスのコアとなる巨大国際多言語 web サイトまで
152 http://www.perl.org/troubleshooting_CGI.html
74あらゆるものがあります。
15375
15476=begin original
15577
156If, after that, you can demonstrate that you've read the FAQs and that
78Below is a list of a few frameworks with comments which might help you in
157your problem isn't something simple that can be easily answered, you'll
79making a decision, depending on your specific requirements. Start by reading
158probably receive a courteous and useful reply to your question if you
80the docs, then ask questions on the relevant mailing list or IRC channel.
159post it on comp.infosystems.www.authoring.cgi (if it's something to do
160with HTTP or the CGI protocols). Questions that appear to be Perl
161questions but are really CGI ones that are posted to comp.lang.perl.misc
162are not so well received.
16381
16482=end original
16583
166その後FAQ を読んで、あなた問題が簡単答られものはないと
84以下は特定要求合わせて決定を行う助けとなるであろうコメント付きの
167ったなら、(HTTP や CGI プロトコルに関するもなら)
85いくつかのフレームワーク一覧です。
168comp.infosystems.www.authoring.cgi にポストすば有用なプライが
86文書を読むことから始めて、そから関連するメーングリストや IRC
169得られるでょう
87チャンネルに質問てください
170Perl に関する質問のように見えていても、実は CGI に関するものだというものが
171comp.lang.perl.misc に投稿されることがありますが、回答はついていません。
172
173=begin original
174
175The useful FAQs, related documents, and troubleshooting guides are
176listed in the CGI Meta FAQ:
177
178=end original
179
180便利な FAQ、関連するドキュメント、トラブルシューティングガイドは
181CGI Meta FAQ に挙げられています:
182
183 http://www.perl.org/CGI_MetaFAQ.html
18488
185=head2 How can I get better error messages from a CGI program?
89=over 4
18690
187(CGI プログラムから、もっとまともなエラーメッセージを得るには?)
91=item L<Catalyst>
18892
18993=begin original
19094
191Use the CGI::Carp module. It replaces C<warn> and C<die>, plus the
95Strongly object-oriented and fully-featured with a long development history and
192normal Carp modules C<carp>, C<croak>, and C<confess> functions with
96a large community and addon ecosystem. It is excellent for large and complex
193more verbose and safer versions. It still sends them to the normal
97applications, where you have full control over the server.
194server error log.
19598
19699=end original
197100
198CGI::Carp モジール使いましょう。
101長い開発の歴史と大きなコミニティおよびアドオン生態系持ち、
199このモジュールは C<warn> と C<die> の置き換えを行い、さら通常の
102強力オブジェクト指向で完全な機能があります。
200Carp モジュルの C<carp>、C<croak>、C<confess> といった関数をより饒舌
103バに対する完全な制御がある場所の大きく複雑なアプリケーションには
201安全なものに置き換えます。
104素晴らしいものす。
202その出力は、サーバーの通常のエラーログに送られます。
203105
204 use CGI::Carp;
106=item L<Dancer>
205 warn "This is a complaint";
206 die "But this one is serious";
207107
208108=begin original
209109
210The following use of CGI::Carp also redirects errors to a file of your choice,
110Young and free of legacy weight, providing a lightweight and easy to learn API.
211placed in a BEGIN block to catch compile-time warnings as well:
111Has a growing addon ecosystem. It is best used for smaller projects and
112very easy to learn for beginners.
212113
213114=end original
214115
215以下の CGI::Carp の使用例では、エラーあなたの選択たファイルへ
116新しくレガシーな重みから解放されていて、軽量で学習しやすい API を提供ます。
216リダイレクトし、コパイル時の警告も同様に補足るため BEGIN ブロックに
117アドオ生態系は大きくなりつつありま
217いていま:
118より小さプロジェクトに最適で初心者が学習するのはとも簡単で
218119
219 BEGIN {
120=item L<Mojolicious>
220 use CGI::Carp qw(carpout);
221 open(LOG, ">>/var/local/cgi-logs/mycgi-log")
222 or die "Unable to append to mycgi-log: $!\n";
223 carpout(*LOG);
224 }
225121
226122=begin original
227123
228You can even arrange for fatal errors to go back to the client browser,
124Fairly young with a focus on HTML5 and real-time web technologies such as
229which is nice for your own debugging, but might confuse the end user.
125WebSockets.
230126
231127=end original
232128
233深刻なエラーをクライアントブラウザに戻すように変更することもできます。
129比較的若く、HTML5 と WebSockets のようなリアルタイム web 技術焦点を
234これはあなたがデバッグするには良でしょうが、エンドユーザーを
130当ててます。
235混乱させてしまうかもしれません。
236131
237 use CGI::Carp qw(fatalsToBrowser);
132=item L<Web::Simple>
238 die "Bad error here";
239133
240134=begin original
241135
242Even if the error happens before you get the HTTP header out, the module
136Currently experimental, strongly object-oriented, built for speed and intended
243will try to take care of this to avoid the dreaded server 500 errors.
137as a toolkit for building micro web apps, custom frameworks or for tieing
244Normal warnings still go out to the server error log (or wherever
138together existing Plack-compatible web applications with one central dispatcher.
245you've sent them with C<carpout>) with the application name and date
246stamp prepended.
247139
248140=end original
249141
250あなたが HTTP ヘッダーを受け取るよりも前エラーが起こったとし
142現在の所実験的で、強力オブジェクト指向で、速度重視で構築されおり
251モジュールはサーバーの 500 エラを避けるためにそのエラーを扱おうと
143ごく小さい web アプリやカスタムフレムワ構築した
252するでしょう。
144既存の Plack 互換の web アプリケーションを一つの中央ディスパッチャと
253通常の警告はサーバーのエラーログ(もくはあなたが C<carpout> で指定した場所)に
145結びつけることを意図ています。
254アプリケーションの名前と日付を伴って送られます。
255146
256=head2 How do I remove HTML from a string?
147=back
257
258(ある文字列から HTML を取り除くには?)
259148
260149=begin original
261150
262The most correct way (albeit not the fastest) is to use HTML::Parser
151All of these interact with or use L<Plack> which is worth understanding
263from CPAN. Another mostly correct
152the basics of when building a website in Perl (there is a lot of useful
264way is to use HTML::FormatText which not only removes HTML but also
153L<Plack::Middleware|https://metacpan.org/search?q=plack%3A%3Amiddleware>).
265attempts to do a little simple formatting of the resulting plain text.
266154
267155=end original
268156
269(最速でありませんが)最も正しい方法は、CPAN にある HTML::Parser を
157これら全ては L<Plack> を使うか相互作用しており、Perl で web サイト
270使ういうもので
158構築するきは基本を理解る価値があります (多くの有用な
271もう一つのまず正しい方法は、HTML::FormatText を使って HTML を
159L<Plack::Middleware|https://metacpan.org/search?q=plack%3A%3Amiddleware>
272除くだけでなく、結果のプレーンテキストを簡単に整形ることです
160)
273161
274=begin original
162=head2 What is Plack and PSGI?
275
276Many folks attempt a simple-minded regular expression approach, like
277C<< s/<.*?>//g >>, but that fails in many cases because the tags
278may continue over line breaks, they may contain quoted angle-brackets,
279or HTML comment may be present. Plus, folks forget to convert
280entities--like C<&lt;> for example.
281
282=end original
283163
284多くの人が、C<< s/<.*?>//g >> のような単純な(simple-minded)正規表現を
164(Plack PSGI って何?)
285使ったアプローチを行おうとするのですが、これは多くの場合
286失敗していまいます。
287なぜなら、タグは行をまたがって継続する可能性があり、
288クォートされたアングルブラケットを含む可能性があり、
289HTML のコメントがあるかもしれないからです。
290さらに、人々は C<&lt;> のようなエンティティを変換することを忘れてしまうのです。
291165
292166=begin original
293167
294Here's one "simple-minded" approach, that works for most files:
168L<PSGI> is the Perl Web Server Gateway Interface Specification, it is
169a standard that many Perl web frameworks use, you should not need to
170understand it to build a web site, the part you might want to use is L<Plack>.
295171
296172=end original
297173
298以下の例「単純な」アプローチ、ほとんどのファイルに対して
174L<PSGI> Perl Web Server Gateway Interface Specification す; これ多くの
299まくいきま:
175Perl web フレームワークが使標準で、web サイトを構築るためにこれを
176理解する必要はないはずです; 使いたい部分は L<Plack> でしょう。
301 #!/usr/bin/perl -p0777
302 s/<(?:[^>'"]*|(['"]).*?\1)*>//gs
303177
304178=begin original
305179
306If you want a more complete solution, see the 3-stage striphtml
180L<Plack> is a set of tools for using the PSGI stack. It contains
307program in
181L<middleware|https://metacpan.org/search?q=plack%3A%3Amiddleware>
308http://www.cpan.org/authors/Tom_Christiansen/scripts/striphtml.gz
182components, a reference server and utilities for Web application frameworks.
309.
183Plack is like Ruby's Rack or Python's Paste for WSGI.
310184
311185=end original
312186
313もし、より完璧な解決策ているなら、
187L<Plack> は PSGI スタック使うためのツールの集合です。
314http://www.cpan.org/authors/Tom_Christiansen/scripts/striphtml.gz
188これには Web アプリケーションフレームワークのための
315にある 3-stage striphtml プログラムを参照してみてください。
189L<ミドルウェア|https://metacpan.org/search?q=plack%3A%3Amiddleware> 要素、
190リファレンスサーバ、ユーティリティを含みます。
191Plack は Ruby の Rack や Python の WSGI のための Paste に似ています。
316192
317193=begin original
318194
319Here are some tricky cases that you should think about when picking
195You could build a web site using L<Plack> and your own code,
320a solution:
196but for anything other than a very basic web site, using a web framework
197(that uses L<Plack>) is a better option.
321198
322199=end original
323200
324以下に挙げたのは、あなたが分でやろうしたと
201L<Plack> と独のコードを使って web サイトを構築するこもでますが、
325考慮すべきであろうリッキー例です:
202とても基本的な web サイ以外のものら、(L<Plack> を使った) web
203フレームワークを使うのがよりよい選択肢です。
327 <IMG SRC = "foo.gif" ALT = "A > B">
328
329 <IMG SRC = "foo.gif"
330 ALT = "A > B">
331
332 <!-- <A comment> -->
333204
334 <script>if (a<b && a>c)</script>
205=head2 How do I remove HTML from a string?
335
336 <# Just data #>
337206
338 <![INCLUDE CDATA [ >>>>>>>>>>>> ]]>
207(ある文字列から HTML を取り除くには?)
339208
340209=begin original
341210
342If HTML comments include other tags, those solutions would also break
211Use L<HTML::Strip>, or L<HTML::FormatText> which not only removes HTML
343on text like this:
212but also attempts to do a little simple formatting of the resulting
213plain text.
344214
345215=end original
346216
347以下のテキストのように HTML のコメントが他のタグ含んでいた場合には、
217L<HTML::Strip> を使うか、HTML を取り除くだけでなく結果プレーテキストを
348せっかくの対応策もダメにしてしまかもしれません:
218少し単純な形式にしとする L<HTML::FormatText> を使ってください。
349
350 <!-- This section commented out.
351 <B>You can't see me!</B>
352 -->
353219
354220=head2 How do I extract URLs?
355221
356222(URL の展開を行うには?)
357223
358224=begin original
359225
360You can easily extract all sorts of URLs from HTML with
226L<HTML::SimpleLinkExtor> will extract URLs from HTML, it handles anchors,
361C<HTML::SimpleLinkExtor> which handles anchors, images, objects,
227images, objects, frames, and many other tags that can contain a URL.
362frames, and many other tags that can contain a URL. If you need
228If you need anything more complex, you can create your own subclass of
363anything more complex, you can create your own subclass of
229L<HTML::LinkExtor> or L<HTML::Parser>. You might even use
364C<HTML::LinkExtor> or C<HTML::Parser>. You might even use
230L<HTML::SimpleLinkExtor> as an example for something specifically
365C<HTML::SimpleLinkExtor> as an example for something specifically
366231suited to your needs.
367232
368233=end original
369234
370アンカー、イメージ、オブジェクト、フレーム、およびその他の URL を含む
235L<HTML::SimpleLinkExtor> は HTML から URL を抽出します; これはアンカー、
371多くのタグを扱える C<HTML::SimpleLinkExtor> を使って、HTML からあらゆる
236イメージ、オブジェクト、フレームおよび URL を含んでいるその他の多くのタグを
372種類の URL を簡単に抽出できます。
237扱います。
373もしもっと複雑なものが必要なら、自分自身で C<HTML::LinkExtor> や
238より複雑なものが必要なら、 L<HTML::LinkExtor> や L<HTML::Parser> の
374C<HTML::Parser> のサブクラスを作ます。
239サブクラスを作ることができます。
375例えば、あたの用途に特に適用すなら、C<HTML::SimpleLinkExtor> を
240何か特別な用途に合わせための例として L<HTML::SimpleLinkExtor> を使うことも
376使うこともできます。
241できます。
377
378=begin original
379
380You can use URI::Find to extract URLs from an arbitrary text document.
381
382=end original
383
384任意のテキスト文書から URL を抽出するためには、URI::Find が使えます。
385242
386243=begin original
387244
388Less complete solutions involving regular expressions can save
245You can use L<URI::Find> to extract URLs from an arbitrary text document.
389you a lot of processing time if you know that the input is simple. One
390solution from Tom Christiansen runs 100 times faster than most
391module based approaches but only extracts URLs from anchors where the first
392attribute is HREF and there are no other attributes.
393246
394247=end original
395248
396もし入力が単純であることが分っているな、正規表現使っより不完全な
249任意のテキスト文書から URL 抽出するめには、L<URI::Find> が使えます。
397解法によって多くの処理時間を節約できます。
398Tom Christiansen による一つの解法は、モジュールを使った手法よりも 100 倍
399速いですが、最初の属性が HREF で、その他の属性がないアンカーの URL のみを
400抽出します。
401
402 #!/usr/bin/perl -n00
403 # qxurl - tchrist@perl.com
404 print "$2\n" while m{
405 < \s*
406 A \s+ HREF \s* = \s* (["']) (.*?) \1
407 \s* >
408 }gsix;
409
410=head2 How do I download a file from the user's machine? How do I open a file on another machine?
411
412(ユーザーのマシンからファイルをダウンロードするには? 別のマシンにあるファイルをオープンするには?)
413
414=begin original
415
416In this case, download means to use the file upload feature of HTML
417forms. You allow the web surfer to specify a file to send to your web
418server. To you it looks like a download, and to the user it looks
419like an upload. No matter what you call it, you do it with what's
420known as B<multipart/form-data> encoding. The CGI.pm module (which
421comes with Perl as part of the Standard Library) supports this in the
422start_multipart_form() method, which isn't the same as the startform()
423method.
424
425=end original
426
427この場合、ダウンロードというのは HTML フォームのファイルアップロード機能を
428使うということを意味します。
429Web サーファーに、Web サーバーに送るファイルを指定できるようにします。
430あなたにとってダウンロードに見えるものは、ユーザーにとってはアップロードに
431見えます。
432何と呼ぶかには関わらず、B<multipart/form-data>
433エンコーディングとして知られているものを使うことができるでしょう。
434CGI.pm モジュール(標準ライブラリになっています)はこれを start_multipart_form()
435という starform() メソッドとは異なるメソッドでサポートしています。
436
437=begin original
438
439See the section in the CGI.pm documentation on file uploads for code
440examples and details.
441
442=end original
443
444コードのサンプルと詳細については、CGI.pm の文書のファイルアップロードの
445章を参照してください。
446
447=head2 How do I make an HTML pop-up menu with Perl?
448
449(Perl で HTML のポップアップメニューを作るには?)
450
451=begin original
452
453(contributed by brian d foy)
454
455=end original
456
457(brian d foy によって寄贈されました)
458
459=begin original
460
461The CGI.pm module (which comes with Perl) has functions to create
462the HTML form widgets. See the CGI.pm documentation for more
463examples.
464
465=end original
466
467CGI.pm モジュール(標準配布です)には HTML フォームウィジェットを作るための
468関数があります。
469更なる例については CGI.pm の文書を参照してください。
470
471 use CGI qw/:standard/;
472 print header,
473 start_html('Favorite Animals'),
474
475 start_form,
476 "What's your favorite animal? ",
477 popup_menu(
478 -name => 'animal',
479 -values => [ qw( Llama Alpaca Camel Ram ) ]
480 ),
481 submit,
482
483 end_form,
484 end_html;
485250
486251=head2 How do I fetch an HTML file?
487252
488253(HTML ファイルをフェッチするには?)
489254
490255=begin original
491256
492257(contributed by brian d foy)
493258
494259=end original
495260
496261(brian d foy によって寄贈されました)
497262
498263=begin original
499264
500Use the libwww-perl distribution. The C<LWP::Simple> module can fetch web
265Use the libwww-perl distribution. The L<LWP::Simple> module can fetch web
501266resources and give their content back to you as a string:
502267
503268=end original
504269
505270libwww-perl ディストリビューションを使ってください。
506C<LWP::Simple> はウェブ上のリソースをフェッチして、その内容を文字列として
271L<LWP::Simple> はウェブ上のリソースをフェッチして、その内容を文字列として
507272返します:
508273
509 use LWP::Simple qw(get);
274 use LWP::Simple qw(get);
510275
511 my $html = get( "http://www.example.com/index.html" );
276 my $html = get( "http://www.example.com/index.html" );
512277
513278=begin original
514279
515280It can also store the resource directly in a file:
516281
517282=end original
518283
519284リソースを直接ファイルに保存することもできます:
520285
521 use LWP::Simple qw(getstore);
286 use LWP::Simple qw(getstore);
522287
523 getstore( "http://www.example.com/index.html", "foo.html" );
288 getstore( "http://www.example.com/index.html", "foo.html" );
524289
525290=begin original
526291
527292If you need to do something more complicated, you can use
528C<LWP::UserAgent> module to create your own user-agent (e.g. browser)
293L<LWP::UserAgent> module to create your own user-agent (e.g. browser)
529294to get the job done. If you want to simulate an interactive web
530browser, you can use the C<WWW::Mechanize> module.
295browser, you can use the L<WWW::Mechanize> module.
531296
532297=end original
533298
534299もっと複雑なことをする必要がある場合は、仕事を行うための独自の
535300ユーザーエージェント(例えばブラウザ)を作るために
536C<LWP::UserAgent> モジュールを使えます。
301L<LWP::UserAgent> モジュールを使えます。
537302対話的なウェブブラウザをシミュレートしたい場合は、
538C<WWW::Mechanize> モジュールが使えます。
303L<WWW::Mechanize> モジュールが使えます。
539304
540305=head2 How do I automate an HTML form submission?
541306
542307(HTML フォームの処理を自動化するには?)
543308
544309=begin original
545310
546311If you are doing something complex, such as moving through many pages
547and forms or a web site, you can use C<WWW::Mechanize>. See its
312and forms or a web site, you can use L<WWW::Mechanize>. See its
548313documentation for all the details.
549314
550315=end original
551316
552317もし、複数のページとフォームや web サイトを移動するような、複雑なことを
553しようとしているなら、C<WWW::Mechanize> が使えます。
318しようとしているなら、L<WWW::Mechanize> が使えます。
554319全ての詳細についてはこれのドキュメントを参照してください。
555320
556321=begin original
557322
558323If you're submitting values using the GET method, create a URL and encode
559324the form using the C<query_form> method:
560325
561326=end original
562327
563328GET メソッドを使って値を処理しているのであれば、URL を作って、
564329さらに C<query_form> メソッドを使ってフォームをエンコードします:
565330
566 use LWP::Simple;
331 use LWP::Simple;
567 use URI::URL;
332 use URI::URL;
568333
569 my $url = url('http://www.perl.com/cgi-bin/cpan_mod');
334 my $url = url('L<http://www.perl.com/cgi-bin/cpan_mod')>;
570 $url->query_form(module => 'DB_File', readme => 1);
335 $url->query_form(module => 'DB_File', readme => 1);
571 $content = get($url);
336 $content = get($url);
572337
573338=begin original
574339
575340If you're using the POST method, create your own user agent and encode
576341the content appropriately.
577342
578343=end original
579344
580345POST メソッドを使っているのであれば、自分用のエージェントを作成して
581346コンテンツを適切にエンコードしてやります。
582347
583 use HTTP::Request::Common qw(POST);
348 use HTTP::Request::Common qw(POST);
584 use LWP::UserAgent;
349 use LWP::UserAgent;
585350
586 $ua = LWP::UserAgent->new();
351 my $ua = LWP::UserAgent->new();
587 my $req = POST 'http://www.perl.com/cgi-bin/cpan_mod',
352 my $req = POST 'L<http://www.perl.com/cgi-bin/cpan_mod'>,
588 [ module => 'DB_File', readme => 1 ];
353 [ module => 'DB_File', readme => 1 ];
589 $content = $ua->request($req)->as_string;
354 my $content = $ua->request($req)->as_string;
590355
591356=head2 How do I decode or create those %-encodings on the web?
592X<URI> X<CGI.pm> X<CGI> X<URI::Escape> X<RFC 2396>
357X<URI> X<URI::Escape> X<RFC 2396>
593358
594359(web上で %-encodings をデコードしたり生成したりするには?)
595360
596361=begin original
597362
598(contributed by brian d foy)
363Most of the time you should not need to do this as
364your web framework, or if you are making a request,
600=end original
365the L<LWP> or other module would handle it for you.
601
602(brian d foy によって寄贈されました)
603
604=begin original
605
606Those C<%> encodings handle reserved characters in URIs, as described
607in RFC 2396, Section 2. This encoding replaces the reserved character
608with the hexadecimal representation of the character's number from
609the US-ASCII table. For instance, a colon, C<:>, becomes C<%3A>.
610
611=end original
612
613これらの C<%> 符号化は RFC 2396 の 2 章に記述されている、
614URI として予約されている文字を扱います。
615この符号化は予約文字を、その文字の番号の 16 進表現に
616US-ASCII テーブルを使って置き換えます。
617例えば、コロン (C<:>) は C<%3A> になります。
618
619=begin original
620
621In CGI scripts, you don't have to worry about decoding URIs if you are
622using C<CGI.pm>. You shouldn't have to process the URI yourself,
623either on the way in or the way out.
624366
625367=end original
626368
627CGI リプトは、C<CGI.pm> 使っているら URL のデコードにつ
369ほとんどの場合、web フレームワークでこれ行う必要はないはずです;
628する必要ません。
370リクエストを作ったときには、L<LWP> やその他のモジュールが代わにこれらを
629エンコードにしてもデコードにしても、URI を自分で処理する必要はなはずです。
371す。
630372
631373=begin original
632374
633If you have to encode a string yourself, remember that you should
375To encode a string yourself, use the L<URI::Escape> module. The C<uri_escape>
634never try to encode an already-composed URI. You need to escape the
376function returns the escaped string:
635components separately then put them together. To encode a string, you
636can use the the C<URI::Escape> module. The C<uri_escape> function
637returns the escaped string:
638377
639378=end original
640379
641もし文字列を自分でエンコードする必要があるなら
380自分で文字列をエンコードするにはL<URI::Escape> モジュールを使ってください。
642決してすでに構成された URI をエンコードするべきではないことを
643忘れないでください。
644要素を別々にエスケープして、それから全てを合わせます。
645文字列をエンコードするには、C<URI::Escape> モジュールが使えます。
646381C<uri_escape> 関数はエスケープされた文字列を返します:
647382
648 my $original = "Colon : Hash # Percent %";
383 my $original = "Colon : Hash # Percent %";
649384
650 my $escaped = uri_escape( $original )
385 my $escaped = uri_escape( $original );
651386
652 print "$string\n"; # 'Colon%20%3A%20Hash%20%23%20Percent%20%25%20'
387 print "$escaped\n"; # 'Colon%20%3A%20Hash%20%23%20Percent%20%25'
653388
654389=begin original
655390
656391To decode the string, use the C<uri_unescape> function:
657392
658393=end original
659394
660395文字列をデコードするには、C<uri_unescape> 関数を使います:
661396
662 my $unescaped = uri_unescape( $escaped );
397 my $unescaped = uri_unescape( $escaped );
663398
664 print $unescaped; # back to original
399 print $unescaped; # back to original
665400
666401=begin original
667402
668If you wanted to do it yourself, you simply need to replace the
403Remember not to encode a full URI, you need to escape each
669reserved characters with their encodings. A global substitution
404component separately and then join them together.
670is one way to do it:
671405
672406=end original
673407
674もしこれ自分でするなら、単に予約文字をエンコードた物置き換えます。
408URI 全体をエンコードするのではなく、そぞれの要素を別々エスケープして
675全体を一度変換するなら、以下のようにします:
409それから互い結合する必要があることを忘れいでください。
676
677 # encode
678 $string =~ s/([^^A-Za-z0-9\-_.!~*'()])/ sprintf "%%%0x", ord $1 /eg;
679
680 #decode
681 $string =~ s/%([A-Fa-f\d]{2})/chr hex $1/eg;
682410
683411=head2 How do I redirect to another page?
684412
685413(別のページにリダイレクトするには?)
686414
687415=begin original
688416
689Specify the complete URL of the destination (even if it is on the same
417Most Perl Web Frameworks will have a mechanism for doing this,
690server). This is one of the two different kinds of CGI "Location:"
418using the L<Catalyst> framework it would be:
691responses which are defined in the CGI specification for a Parsed Headers
692script. The other kind (an absolute URLpath) is resolved internally to
693the server without any HTTP redirection. The CGI specifications do not
694allow relative URLs in either case.
695
696=end original
697
698(たとえ同じサーバでも)宛て先の完全な URL を指定してください。
699これは Parsed Headers スクリプトとして CGI 仕様に定義された二つの異なった
700CGI "Location:" レスポンスのうちの一つです。
701その他の種類 (絶対 URL パス) は HTTP リダイレクトなしにサーバによって
702内部的に解決されます。
703CGI 仕様ではどちらの場合でも相対 URL は認められていません。
704
705=begin original
706
707Use of CGI.pm is strongly recommended. This example shows redirection
708with a complete URL. This redirection is handled by the web browser.
709419
710420=end original
711421
712CGI.pm を使う強くお勧めします
422ほとんどの Perl Web フレームワークは行う機構があります; L<Catalyst>
713この例では完全な URL へのリダイレクいます
423ームワークを使ってるなら以下のようになります:
714このリダイレクトは web ブラウザによって扱われます。
715424
716 use CGI qw/:standard/;
425 $c->res->redirect($url);
426 $c->detach();
718 my $url = 'http://www.cpan.org/';
719 print redirect($url);
720427
721428=begin original
722429
723This example shows a redirection with an absolute URLpath. This
430If you are using Plack (which most frameworks do), then
724redirection is handled by the local web server.
431L<Plack::Middleware::Rewrite> is worth looking at if you
432are migrating from Apache or have URL's you want to always
433redirect.
725434
726435=end original
727436
728例では絶対 URL パスへのリダイレクます。
437(ほとんどームワーが使っている) Plack 使ってて、
729のリダイレクトはローカルの web サーバによって行われます。
438Apache から移動や常にリダイレクトしたい URL があるなら、
439L<Plack::Middleware::Rewrite> は見る価値があるでしょう。
731 my $url = '/CPAN/index.html';
732 print redirect($url);
733
734=begin original
735
736But if coded directly, it could be as follows (the final "\n" is
737shown separately, for clarity), using either a complete URL or
738an absolute URLpath.
739
740=end original
741
742しかし、直接コーディングするなら、完全な URL か絶対 URLpath を使って、
743以下のようになります(最後の "\n" は明確化するために分けて表示しています)。
744
745 print "Location: $url\n"; # CGI response header
746 print "\n"; # end of headers
747440
748441=head2 How do I put a password on my web pages?
749442
750443(私の web ぺージでパスワードを入力するには?)
751444
752445=begin original
753446
754To enable authentication for your web server, you need to configure
447See if the web framework you are using has an
755your web server. The configuration is different for different sorts
448authentication system and if that fits your needs.
756of web servers--apache does it differently from iPlanet which does
757it differently from IIS. Check your web server documentation for
758the details for your particular server.
759449
760450=end original
761451
762利用すWeb 認証を有効にすにはWeb サーバーを設定すること
452使っていweb フレムワクが認証システム持っていそしてそれ
763必要です
453目的に合致しているかを調べてください
764web サーバの種類によって設定は異なります -- apache は iPlanet とは異なり、
765また IIS とも異なります。
766特定のサーバーに関する詳細については、そのサーバーのドキュメントを
767チェックしてください。
768
769=head2 How do I edit my .htpasswd and .htgroup files with Perl?
770
771(Perl を使って .htpasswd や .htgroup といったファイルを編集するには?)
772454
773455=begin original
774456
775The HTTPD::UserAdmin and HTTPD::GroupAdmin modules provide a
457Alternativly look at L<Plack::Middleware::Auth::Basic>,
776consistent OO interface to these files, regardless of how they're
458or one of the other L<Plack authentication|https://metacpan.org/search?q=plack+auth>
777stored. Databases may be text, dbm, Berkeley DB or any database with
459options.
778a DBI compatible driver. HTTPD::UserAdmin supports files used by the
779"Basic" and "Digest" authentication schemes. Here's an example:
780460
781461=end original
782462
783HTTPD::UserAdmin モジュールと HTTPD::GroupAdmin モジュール
463あるいは、L<Plack::Middleware::Auth::Basic> またその他の
784ファイルがどように格納されているかに関係なくこれらのファイルに対する
464L<Plack 認証|https://metacpan.org/search?q=plack+auth> オプション一つを
785首尾一貫したオブジェクト指向インターフェースを提供します
465見てください
786データベースはテキスト、dbm、Berkeley DB、あるいは DBI 互換ドライバのある
787どんなデータベースでもかまいません。
788HTTPD::UserAdmin は "Basic" および "Digest" 認証スキームで
789使われるファイルをサポートします。
790以下に例を挙げます:
791466
792 use HTTPD::UserAdmin ();
467=head2 How do I make sure users can't enter values into a form that causes my CGI script to do bad things?
793 HTTPD::UserAdmin
794 ->new(DB => "/foo/.htpasswd")
795 ->add($username => $password);
796
797=head2 How do I make sure users can't enter values into a form that cause my CGI script to do bad things?
798468
799469(私の CGI スクリプトに悪影響をもたらすようなものを、ユーザーがフォームに入力できないようにするには?)
800470
801471=begin original
802472
803See the security references listed in the CGI Meta FAQ
804
805=end original
806
807CGI Meta FAQ に挙げられているセキュリティに関する参考資料を参照してください。
808
809 http://www.perl.org/CGI_MetaFAQ.html
810
811=head2 How do I parse a mail header?
812
813(メールのヘッダーを解析するには?)
814
815=begin original
816
817For a quick-and-dirty solution, try this solution derived
818from L<perlfunc/split>:
819
820=end original
821
822拙速な解決策なら、L<perlfunc/split> から派生した
823以下のやり方を試してみてください。
824
825 $/ = '';
826 $header = <MSG>;
827 $header =~ s/\n\s+/ /g; # merge continuation lines
828 %head = ( UNIX_FROM_LINE, split /^([-\w]+):\s*/m, $header );
829
830=begin original
831
832That solution doesn't do well if, for example, you're trying to
833maintain all the Received lines. A more complete approach is to use
834the Mail::Header module from CPAN (part of the MailTools package).
835
836=end original
837
838このやり方は、たとえば受信した行すべてを保守しようとするときには
839うまくありません。
840より完璧なアプローチはCPANにあるMail::Header モジュールを
841使うというものです(このモジュールは MailTools パッケージの一部です)。
842
843=head2 How do I decode a CGI form?
844
845(CGI フォームをデコードするには?)
846
847=begin original
848
849473(contributed by brian d foy)
850474
851475=end original
852476
853477(brian d foy によって寄贈されました)
854478
855479=begin original
856480
857Use the CGI.pm module that comes with Perl. It's quick,
481You can't prevent people from sending your script bad data. Even if
858it's easy, and it actually does quite a bit of work to
482you add some client-side checks, people may disable them or bypass
859ensure things happen correctly. It handles GET, POST, and
483them completely. For instance, someone might use a module such as
860HEAD requests, multipart forms, multivalued fields, query
484L<LWP> to submit to your web site. If you want to prevent data that
861string and message body combinations, and many other things
485try to use SQL injection or other sorts of attacks (and you should
862you probably don't want to think about.
486want to), you have to not trust any data that enter your program.
863487
864488=end original
865489
866Perl 同梱されてる CGI.pm モジュ使いしょう
490人々がスクリプト送るのを防ぐことは出来せん
867これは早く、簡単、物事が正く行われることを確実するめの
491例えクライアント側チェックをしても、それ無効
868ちょっとした作業を行います。
492完全に回避したりできます。
869GET, POST, HEAD リクエスト、マルチパトフォーム、複数値フィード、
493例えば、L<LWP> のようなモジュールを使って web サイトに
870クエリ文字列とメッセージボディの組み合わ、およびその他の、
494投稿するかもしれまん。
871あなたが考えよとも思わないような多くの事柄扱えます。
495SQL インジェクションや同様の種類の攻撃を行うようなデータ防ぎたいのなら
496(そしておそらくそうしたいでしょう)、プログラムに入力される
497どんなデータも信用しないようにする必要があります。
872498
873499=begin original
874500
875It doesn't get much easier: the CGI module automatically
501The L<perlsec> documentation has general advice about data security.
876parses the input and makes each value available through the
502If you are using the L<DBI> module, use placeholder to fill in data.
877C<param()> function.
503If you are running external programs with C<system> or C<exec>, use
504the list forms. There are many other precautions that you should take,
505too many to list here, and most of them fall under the category of not
506using any data that you don't intend to use. Trust no one.
878507
879508=end original
880509
881これ以上簡単にはなりません: CGI モジュールは入力を自動的にパースして、
510L<perlsec> 文書にはデータセキュリティに関する一般的助言があります。
882それぞれの値を C<param()> 関数通し利用可能します。
511L<DBI> モジュール使っいるなら、データを埋めるのプレースホルダを
512使ってください。
884 use CGI qw(:standard);
513C<system> C<exec> で外部プログラムを実行しているなら、リスト形式を
514使ってください。
515その他、ここに書ききれないほどの注意するべき多くの事前注意があり、
516そのほとんどは、使おうとしていないデータは使わないという分野に当てはまります。
517誰も信用しないでください。
885518
886 my $total = param( 'price' ) + param( 'shipping' );
519=head2 How do I parse a mail header?
887520
888 my @items = param( 'item' ); # multiple values, same field name
521(メールのヘッダーを解析するには?)
889522
890523=begin original
891524
892If you want an object-oriented approach, CGI.pm can do that too.
525Use the L<Email::MIME> module. It's well-tested and supports all the
526craziness that you'll see in the real world (comment-folding whitespace,
527encodings, comments, etc.).
893528
894529=end original
895530
896オブェクト指向な手法が使いたいなら、CGI.pm はそのようにもできます
531L<Email::MIME> モュールを使ってください。
532これはよくテストされていて、現実世界で見ることになるあらゆる狂気
898 use CGI;
533(コメント畳み込み空白、エンコーディング、コメントなど)に対応しています。
899534
900 my $cgi = CGI->new();
535 use Email::MIME;
901536
902 my $total = $cgi->param( 'price' ) + $cgi->param( 'shipping' );
537 my $message = Email::MIME->new($rfc2822);
538 my $subject = $message->header('Subject');
904 my @items = $cgi->param( 'item' );
539 my $from = $message->header('From');
905540
906541=begin original
907542
908You might also try CGI::Minimal which is a lightweight version
543If you've already got some other kind of email object, consider passing
909of the same thing. Other CGI::* modules on CPAN might work better
544it to L<Email::Abstract> and then using its cast method to get an
910for you, too.
545L<Email::MIME> object:
911546
912547=end original
913548
914同じことをする軽量版の CGI::Minimal も試したいもしません。
549既に何らの他の種類のメールオブジェクトがあるなら、そ
915CPANあるの他の CGI::* ュールもあなたのためによく働くでしょう。
550L<Email::Abstract>渡して、れから L<Email::MIME> オブェクトを
551得るために cast メソッドを使うことを考慮してください:
917=begin original
918
919Many people try to write their own decoder (or copy one from
920another program) and then run into one of the many "gotchas"
921of the task. It's much easier and less hassle to use CGI.pm.
922
923=end original
924552
925多くの人々が自分用のデコーダを書こうとします (あるいは他のプログラムから
553 my $mail_message_object = read_message();
926コピーしようとします); そしてこの作業の多くの「コツ」の一つに出くわすことに
554 my $abstract = Email::Abstract->new($mail_message_object);
927なります。
555 my $email_mime_object = $abstract->cast('Email::MIME');
928CGI.pm を使うことはより簡単で、面倒事も少なくなります。
929556
930557=head2 How do I check a valid mail address?
931558
932559(メールアドレスが正しいかチェックするには?)
933560
934561=begin original
935562
936563(partly contributed by Aaron Sherman)
937564
938565=end original
939566
940567(一部は Aaron Sherman によって寄贈されました)
941568
942569=begin original
943570
944This isn't as simple a question as it sounds. There are two parts:
571This isn't as simple a question as it sounds. There are two parts:
945572
946573=end original
947574
948575これは見た目ほど単純な質問ではありません。
949576これは二つの部分からなります:
950577
951578=begin original
952579
953580a) How do I verify that an email address is correctly formatted?
954581
955582=end original
956583
957584a) メールアドレスが正しい形式かを検証するには?
958585
959586=begin original
960587
961588b) How do I verify that an email address targets a valid recipient?
962589
963590=end original
964591
965592b) メールアドレスが正当な受信者を対象としているかを検証するには?
966593
967594=begin original
968595
969596Without sending mail to the address and seeing whether there's a human
970597on the other end to answer you, you cannot fully answer part I<b>, but
971either the C<Email::Valid> or the C<RFC::RFC822::Address> module will do
598the L<Email::Valid> module will do both part I<a> and part I<b> as far
972both part I<a> and part I<b> as far as you can in real-time.
599as you can in real-time.
973600
974601=end original
975602
976603そのアドレスにメールを送ってそれが届いたかどうかを確認しなければ
977604完全にパート I<b> に答えられませんが、C<Email::Valid> か
978605C<RFC::RFC822::Address> のモジュールは、リアルタイムでできる限りの
979606ことに対してパート I<a> とパート I<b> の両方を行います。
980607
981608=begin original
982609
983If you want to just check part I<a> to see that the address is valid
984according to the mail header standard with a simple regular expression,
985you can have problems, because there are deliverable addresses that
986aren't RFC-2822 (the latest mail header standard) compliant, and
987addresses that aren't deliverable which, are compliant. However, the
988following will match valid RFC-2822 addresses that do not have comments,
989folding whitespace, or any other obsolete or non-essential elements.
990This I<just> matches the address itself:
991
992=end original
993
994もしあなたが単純な正規表現でアドレスがメールヘッダ標準に従っているかを
995見ることでパート I<a> をチェックしたいなら、問題を抱えることになります;
996なぜなら、RFC-2822 (最新のメールヘッダ標準) に準拠してないけれども
997配達可能なアドレスが存在し、標準に準拠しているけれども配達不能なアドレスも
998存在するからです。
999しかし以下のコードは、コメント、折り畳みの空白、あるいはその他の時代遅れに
1000なっていたり本質的でない要素を含んでいない、有効な RFC-2822 アドレスに
1001マッチングします。
1002これは I<単に> アドレス自身にマッチングします:
1003
1004 my $atom = qr{[a-zA-Z0-9_!#\$\%&'*+/=?\^`{}~|\-]+};
1005 my $dot_atom = qr{$atom(?:\.$atom)*};
1006 my $quoted = qr{"(?:\\[^\r\n]|[^\\"])*"};
1007 my $local = qr{(?:$dot_atom|$quoted)};
1008 my $quotedpair = qr{\\[\x00-\x09\x0B-\x0c\x0e-\x7e]};
1009 my $domain_lit = qr{\[(?:$quotedpair|[\x21-\x5a\x5e-\x7e])*\]};
1010 my $domain = qr{(?:$dot_atom|$domain_lit)};
1011 my $addr_spec = qr{$local\@$domain};
1012
1013=begin original
1014
1015Just match an address against C</^${addr_spec}$/> to see if it follows
1016the RFC2822 specification. However, because it is impossible to be
1017sure that such a correctly formed address is actually the correct way
1018to reach a particular person or even has a mailbox associated with it,
1019you must be very careful about how you use this.
1020
1021=end original
1022
1023もしアドレスが RFC 2822 仕様に準拠しているかどうかを見たいなら、単に
1024C</^${addr_spec}$/> とマッチングさせてください。
1025しかし、このような正しい形式のアドレスが実際に特定の個人に届く
1026正しい方法なのか、あるいはその個人に関連付けられたメールボックスに
1027届くのかさえも明確にすることは不可能なので、これをどう使うかについては
1028とても慎重になる必要があります。
1029
1030=begin original
1031
1032610Our best advice for verifying a person's mail address is to have them
1033611enter their address twice, just as you normally do to change a
1034612password. This usually weeds out typos. If both versions match, send
1035613mail to that address with a personal message. If you get the message
1036614back and they've followed your directions, you can be reasonably
1037615assured that it's real.
1038616
1039617=end original
1040618
1041619私たちができる最善のアドバイスは、個人のメールアドレスをチェックするのに
1042620パスワードを変更するときと同じようにユーザーにアドレスを
1043621二回入力させるというものです。
1044622これによって通常は打ち間違いを防ぐことができます。
1045623二回の入力がマッチしたなら、個人的な内容のメッセージをメールとして
1046624そのアドレスへ送ります。
1047625もしメッセージが返ってきて、それがあなたの指示に従っているなら、
1048626それが実際のものであると十分に仮定できます。
1049627
1050628=begin original
1051629
1052630A related strategy that's less open to forgery is to give them a PIN
1053(personal ID number). Record the address and PIN (best that it be a
631(personal ID number). Record the address and PIN (best that it be a
1054random one) for later processing. In the mail you send, ask them to
632random one) for later processing. In the mail you send, include a link to
1055include the PIN in their reply. But if it bounces, or the message is
633your site with the PIN included. If the mail bounces, you know it's not
1056included via a "vacation" script, it'll be there anyway. So it's
634valid. If they don't click on the link, either they forged the address or
1057best to ask them to mail back a slight alteration of the PIN, such as
635(assuming they got the message) following through wasn't important so you
1058with the characters reversed, one added or subtracted to each digit, etc.
636don't need to worry about it.
1059637
1060638=end original
1061639
1062より偽造のやりにくい別のやり方に、チェックに対象者に対して PIN
640より偽造のやりにくい別のやり方に、チェックに対象者に対して PIN (Personal ID
1063(Personal ID Number) を与えるというものがあります。
641Number) を与えるというものがあります。
1064642後の処理のためにアドレスと PIN (ランダムであることが望ましい)を
1065643記録しておくのです。
1066あなたがメールを送るときに、宛て先人に対して彼ら出すリプラ
644あなたがメールを送るときに、PIN が含まれたあなたトへのリンクを
1067PIN を含めるように依頼するのです
645含めてください
1068しかしそれそのまま返ってき、あるいは返ってきたメッセージ
646メールバウンスしなら不正であること分かります。
1069"vacation" スクリプトを通じてのものであってもそのまま PIN
647リンがクックされなければアドレスが偽造されたか、(メッセージ
1070含まれてしまいます。
648届いたとて) 最後で行うことが重要ではなかったのでそれにつ
1071ですから、最善なやり方はメールを送るとき返事には文字を逆順にするとか、
649にする必要はない言うことです。
1072各桁に対して足し算や引き算を行うなどして
1073PIN を変形したものを含めて返すように依頼するという方法です。
1074650
1075651=head2 How do I decode a MIME/BASE64 string?
1076652
1077653(MIME/BASE64 文字列のデコードを行うには?)
1078654
1079655=begin original
1080656
1081The MIME-Base64 package (available from CPAN) handles this as well as
657The L<MIME::Base64> package handles this as well as the MIME/QP encoding.
1082the MIME/QP encoding. Decoding BASE64 becomes as simple as:
658Decoding base 64 becomes as simple as:
1083659
1084660=end original
1085661
1086MIME-Base64 パッケージ(CPAN で入手可能です)はこの問題と、
662L<MIME::Base64> パッケージはこの問題と、
1087663MIME/QP エンコーディングを取り扱います。
1088664BASE64 のデコードは以下のように単純です:
1089665
1090 use MIME::Base64;
666 use MIME::Base64;
1091 $decoded = decode_base64($encoded);
667 my $decoded = decode_base64($encoded);
1092668
1093669=begin original
1094670
1095The MIME-Tools package (available from CPAN) supports extraction with
671The L<Email::MIME> module can decode base 64-encoded email message parts
1096decoding of BASE64 encoded attachments and content directly from email
672transparently so the developer doesn't need to worry about it.
1097messages.
1098673
1099674=end original
1100675
1101MIME-Tools パッケー (CPAN にあります) は BASE64 エンコードされた
676L<Email::MIME> ュールは BASE64 エンコードされたメールのメッセージ部分を
1102添付ファイルと本文をメルのメッセージから直接抽出できす。
677透過的にデコできるので、開発者はそれについて気にる必要はありません
1103678
1104=begin original
679=head2 How do I find the user's mail address?
1105680
1106If the string to decode is short (less than 84 bytes long)
681(あるユーザーのメールアドレスを知るには?)
1107a more direct approach is to use the unpack() function's "u"
1108format after minor transliterations:
1109
1110=end original
1111
1112もしデコードしたい文字列が短い(84 文字以下)の場合、より直接的なやり方は、
1113ちょっとした変換をした後で unpack() 関数の "u" フォーマットを
1114使うというものです:
1115
1116 tr#A-Za-z0-9+/##cd; # remove non-base64 chars
1117 tr#A-Za-z0-9+/# -_#; # convert to uuencoded format
1118 $len = pack("c", 32 + 0.75*length); # compute length byte
1119 print unpack("u", $len . $_); # uudecode and print
1120
1121=head2 How do I return the user's mail address?
1122
1123(ユーザーのメールアドレスを返すには?)
1124682
1125683=begin original
1126684
1127On systems that support getpwuid, the $< variable, and the
685Ask them for it. There are so many email providers available that it's
1128Sys::Hostname module (which is part of the standard perl distribution),
686unlikely the local system has any idea how to determine a user's email address.
1129you can probably try using something like this:
1130687
1131688=end original
1132689
1133getpwuid をサポートしているシステムであれば、$< という変数と
690その人に聞いくださ
1134Sys::Hostname モジュール(標準 perl 配布キットの一部す)を使って
691多くのメールプロバイダが利用可能なので、ローカルシステムがユーザーの
1135以下のようなことが試せでしょう
692メールアドレスを決定す方法はまずありません
1136
1137 use Sys::Hostname;
1138 $address = sprintf('%s@%s', scalar getpwuid($<), hostname);
1139693
1140694=begin original
1141695
1142Company policies on mail address can mean that this generates addresses
696The exception is for organization-specific email (e.g. foo@yourcompany.com)
1143that the company's mail system will not accept, so you should ask for
697where policy can be codified in your program. In that case, you could look at
1144users' mail addresses when this matters. Furthermore, not all systems
698$ENV{USER}, $ENV{LOGNAME}, and getpwuid($<) in scalar context, like so:
1145on which Perl runs are so forthcoming with this information as is Unix.
1146699
1147700=end original
1148701
1149会社のメールアドレスに関するポリシーが、これが生成するアドレスは
702例外は、組織に固有のメール (例えば foo@yourcompany.com) で、ポリシー
1150その会社のメールシステが受け付けないもの可能性があります。
703プログラにコード化場合です。
1151ですからユーザーに、そユーザーのメールアドレスを尋ねるべきでしょ
704この場合以下
1152それに加え、Perl が動作する全てのシステ
705$ENV{USER}, $ENV{LOGNAME} およびカラコンキスト and getpwuid($<) を
1153の情報が(UNIX 同じように)得られるわけはありせん。
706見ることす:
707
708 my $user_name = getpwuid($<)
1154709
1155710=begin original
1156711
1157The Mail::Util module from CPAN (part of the MailTools package) provides a
712But you still cannot make assumptions about whether this is correct, unless
1158mailaddress() function that tries to guess the mail address of the user.
713your policy says it is. You really are best off asking the user.
1159It makes a more intelligent guess than the code above, using information
1160given when the module was installed, but it could still be incorrect.
1161Again, the best way is often just to ask the user.
1162714
1163715=end original
1164716
1165CPAN にある Mail::Util モジュル (MailTools パッケージの一部です)は
717しかし、ポリシがそうなっていない限り、これが正しいかどうかに関して
1166メールアドレスがそのユーザーのものであるかどうかを確かめようとする
718仮定することはやはりできません。
1167mailaddress() いう関数を提供しています。
719本当に最良なのはユーザーに聞くこす。
1168これは上で例示したやり方よりも賢く、モジュールがインストールされたときの
1169情報を使いますが、それでも正しくない可能性があります。
1170くり返しますが、最善の方法はユーザーに尋ねること、というのがほとんどです。
1171720
1172=head2 How do I send mail?
721=head2 How do I send email?
1173722
1174723(メールを送るには?)
1175724
1176725=begin original
1177726
1178Use the C<sendmail> program directly:
727Use the L<Email::MIME> and L<Email::Sender::Simple> modules, like so:
1179728
1180729=end original
1181730
1182C<sendmail> プログラム直接使います:
731以下のように、L<Email::MIME> と L<Email::Sender::Simple> モジュール
732使ってください:
1183733
1184 open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
734 # first, create your message
1185 or die "Can't fork for sendmail: $!\n";
735 my $message = Email::MIME->create(
1186 print SENDMAIL <<"EOF";
736 header_str => [
1187 From: User Originating Mail <me\@host>
737 From => 'you@example.com',
1188 To: Final Destination <you\@otherhost>
738 To => 'friend@example.com',
1189 Subject: A relevant subject line
739 Subject => 'Happy birthday!',
740 ],
741 attributes => {
742 encoding => 'quoted-printable',
743 charset => 'utf-8',
744 },
745 body_str => "Happy birthday to you!\n",
746 );
1190747
1191 Body of the message goes here after the blank line
748 use Email::Sender::Simple qw(sendmail);
1192 in as many lines as you like.
749 sendmail($message);
1193 EOF
1194 close(SENDMAIL) or warn "sendmail didn't close nicely";
1195750
1196751=begin original
1197752
1198The B<-oi> option prevents sendmail from interpreting a line consisting
753By default, L<Email::Sender::Simple> will try `sendmail` first, if it exists
1199of a single dot as "end of message". The B<-t> option says to use the
754in your $PATH. This generally isn't the case. If there's a remote mail
1200headers to decide who to send the message to, and B<-odq> says to put
755server you use to send mail, consider investigating one of the Transport
1201the message into the queue. This last option means your message won't
756classes. At time of writing, the available transports include:
1202be immediately delivered, so leave it out if you want immediate
1203delivery.
1204757
1205758=end original
1206759
1207B<-oi> オプションは sendmail がドットだけの行“メッセージの終わり”と
760デフォルトでは、L<Email::Sender::Simple> は、$PATH にあれば `sendmail`
1208みなさないようするためのオプションです。
761最初試します。
1209B<-t>オプションメッセージを誰送るかを決めるかのために
762これ一般的間違いです。
1210ヘッダーを使うことを指示し、B<-odq> オプションッセジを
763送るのに使うリモートのメールサーバがある場合、
1211キューに入れることを指示ます
764Transport クラスの一つを調査することを考慮てください
1212最後のオプションの意味は、たのメッセージがすぐには配されいことを
765これを書いている時点では、利用可能層は以下のようものです:
1213意味します。
1214ですから、すぐに配送させたいのであればこのオプションを取り除いてください。
1215766
1216=begin original
767=over 4
1217
1218Alternate, less convenient approaches include calling mail (sometimes
1219called mailx) directly or simply opening up port 25 have having an
1220intimate conversation between just you and the remote SMTP daemon,
1221probably sendmail.
1222
1223=end original
1224768
1225あるいは、直接 mail (mailx と呼ばれることもあります)を呼びだしたり、
769=item L<Email::Sender::Transport::Sendmail>
1226単純に 25 番ポートを使ってリモートの SMTP デーモン(多分 sendmail でしょう)
1227との間で詳細な通信を行うといったあまり便利でない方法もあります。
1228770
1229771=begin original
1230772
1231Or you might be able use the CPAN module Mail::Mailer:
773This is the default. If you can use the L<mail(1)> or L<mailx(1)>
774program to send mail from the machine where your code runs, you should
775be able to use this.
1232776
1233777=end original
1234778
1235あるい CPAN にあるモジュー Mail::Mailer が使えるかもしれません:
779これデフォトです。
780コードを実行しているマシンからメールを送るのに L<mail(1)> や L<mailx(1)> が
781使えるなら、これが使えるはずです。
1236782
1237 use Mail::Mailer;
783=item L<Email::Sender::Transport::SMTP>
1238
1239 $mailer = Mail::Mailer->new();
1240 $mailer->open({ From => $from_address,
1241 To => $to_address,
1242 Subject => $subject,
1243 })
1244 or die "Can't open: $!\n";
1245 print $mailer $body;
1246 $mailer->close();
1247784
1248785=begin original
1249786
1250The Mail::Internet module uses Net::SMTP which is less Unix-centric than
787This transport contacts a remote SMTP server over TCP. It optionally
1251Mail::Mailer, but less reliable. Avoid raw SMTP commands. There
788uses SSL and can authenticate to the server via SASL.
1252are many reasons to use a mail transport agent like sendmail. These
1253include queuing, MX records, and security.
1254789
1255790=end original
1256791
1257Mail::Internetジュルは Mail::Mailer より UNIX 的ではない
792この転送層は TCP を使ってリモー SMTP サーバに接続します。
1258Net::SMTP を使っていますが信頼性も低いです。
793オプションとして SSL を使って、SASL 経由サーバに認証できます。
1259生の SMTP コマンドを無視します。
1260sendmail のような mail transport agent を使う理由はたくさんあります。
1261その中にはキューイングも含まれますし、MX レコードやセキュリティと
1262いったものが含まれます。
1263
1264=head2 How do I use MIME to make an attachment to a mail message?
1265794
1266(メールメッセージに添付するためにどうやって MIME を使えばいいですか?)
795=item L<Email::Sender::Transport::SMTP::TLS>
1267796
1268797=begin original
1269798
1270This answer is extracted directly from the MIME::Lite documentation.
799This is like the SMTP transport, but uses TLS security. You can
1271Create a multipart message (i.e., one with attachments).
800authenticate with this module as well, using any mechanisms your server
801supports after STARTTLS.
1272802
1273803=end original
1274804
1275の回答は MIME::Lite のドキュメントから直接持ってきたものです。
805SMTP 転送と似ていますが、TLS キュリティを使います。
1276マルチパートメッセー(つまり 添付つきメッセジ) 作ります。
806このモュールも、STARTTLS後サバが対応している任意の機構使って
807認証できます。
1278 use MIME::Lite;
1279
1280 ### Create a new multipart message:
1281 $msg = MIME::Lite->new(
1282 From =>'me@myhost.com',
1283 To =>'you@yourhost.com',
1284 Cc =>'some@other.com, some@more.com',
1285 Subject =>'A message with 2 parts...',
1286 Type =>'multipart/mixed'
1287 );
1288
1289 ### Add parts (each "attach" has same arguments as "new"):
1290 $msg->attach(Type =>'TEXT',
1291 Data =>"Here's the GIF file you wanted"
1292 );
1293 $msg->attach(Type =>'image/gif',
1294 Path =>'aaa000123.gif',
1295 Filename =>'logo.gif'
1296 );
1297808
1298 $text = $msg->as_string;
809=back
1299810
1300811=begin original
1301812
1302MIME::Lite also includes a method for sending these things.
813Telling L<Email::Sender::Simple> to use your transport is straightforward.
1303814
1304815=end original
1305816
1306MIME::Lite はまたこれらのものを送ためメソッドを含みま
817使用する転送層を L<Email::Sender::Simple> に教えるのは簡単で:
1307818
1308 $msg->send;
819 sendmail(
820 $message,
821 {
822 transport => $email_sender_transport_object,
823 }
824 );
825
826=head2 How do I use MIME to make an attachment to a mail message?
827
828(メールメッセージに添付するためにどうやって MIME を使えばいいですか?)
1309829
1310830=begin original
1311831
1312This defaults to using L<sendmail> but can be customized to use
832L<Email::MIME> directly supports multipart messages. L<Email::MIME>
1313SMTP via L<Net::SMTP>.
833objects themselves are parts and can be attached to other L<Email::MIME>
834objects. Consult the L<Email::MIME> documentation for more information,
835including all of the supported methods and examples of their use.
1314836
1315837=end original
1316838
1317これはデフォルトでは L<sendmail> を使いますが、
839L<Email::MIME> は直接マルチパートメッセージに対応しています
1318L<Net::SMTP> 経由SMTP を使うようカスタマイズできます。
840L<Email::MIME> 自身はパート、その他の L<Email::MIME> オブジェクト
841添付できます。
842対応している全てのメソッドとその使い方の例を含む、さらなる情報については
843L<Email::MIME> 文書を参照してください。
1319844
1320=head2 How do I read mail?
845=head2 How do I read email?
1321846
1322847(メールを読み出すには?)
1323848
1324849=begin original
1325850
1326While you could use the Mail::Folder module from CPAN (part of the
851Use the L<Email::Folder> module, like so:
1327MailFolder package) or the Mail::Internet module from CPAN (part
1328of the MailTools package), often a module is overkill. Here's a
1329mail sorter.
1330852
1331853=end original
1332854
1333CPAN ある Mail::Folder モジュール(MailFolder パッケージの一部です)や
855以下のよう、L<Email::Folder> モジュールを使ってください:
1334Mail::Internet モジュール(これも MailTools パッケージの一部です)が
1335使えますが、モジュールを使うのはやりすぎかもしれません。
1336以下にメールをソートする方法を示します。
1337856
1338 #!/usr/bin/perl
857 use Email::Folder;
1339858
1340 my(@msgs, @sub);
859 my $folder = Email::Folder->new('/path/to/email/folder');
1341 my $msgno = -1;
860 while(my $message = $folder->next_message) {
1342 $/ = ''; # paragraph reads
861 # next_message returns Email::Simple objects, but we want
1343 while (<>) {
862 # Email::MIME objects as they're more robust
1344 if (/^From /m) {
863 my $mime = Email::MIME->new($message->as_string);
1345 /^Subject:\s*(?:Re:\s*)*(.*)/mi;
864 }
1346 $sub[++$msgno] = lc($1) || '';
1347 }
1348 $msgs[$msgno] .= $_;
1349 }
1350 for my $i (sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msgs)) {
1351 print $msgs[$i];
1352 }
1353865
1354866=begin original
1355867
1356Or more succinctly,
868There are different classes in the L<Email::Folder> namespace for
869supporting various mailbox types. Note that these modules are generally
870rather limited and only support B<reading> rather than writing.
1357871
1358872=end original
1359873
1360いはもと簡潔に:
874様々なメールボックスの種類に対応すための異なたクラスが
875L<Email::Folder> 名前空間にあります。
1362 #!/usr/bin/perl -n00
876これらのモジュールは一般的に B<読み込み> にのみ対応していて書き込みには
1363 # bysub2 - awkish sort-by-subject
877対応していないことに注意してください。
1364 BEGIN { $msgno = -1 }
1365 $sub[++$msgno] = (/^Subject:\s*(?:Re:\s*)*(.*)/mi)[0] if /^From/m;
1366 $msg[$msgno] .= $_;
1367 END { print @msg[ sort { $sub[$a] cmp $sub[$b] || $a <=> $b } (0 .. $#msg) ] }
1368878
1369879=head2 How do I find out my hostname, domainname, or IP address?
1370880X<hostname, domainname, IP address, host, domain, hostfqdn, inet_ntoa,
1371881gethostbyname, Socket, Net::Domain, Sys::Hostname>
1372882
1373883(私のホスト名/ドメイン名/IP アドレスを見つけるには?)
1374884
1375885=begin original
1376886
1377887(contributed by brian d foy)
1378888
1379889=end original
1380890
1381891(brian d foy によって寄贈されました)
1382892
1383893=begin original
1384894
1385The Net::Domain module, which is part of the standard distribution starting
895The L<Net::Domain> module, which is part of the Standard Library starting
1386in perl5.7.3, can get you the fully qualified domain name (FQDN), the host
896in Perl 5.7.3, can get you the fully qualified domain name (FQDN), the host
1387897name, or the domain name.
1388898
1389899=end original
1390900
1391perl5.7.3 から標準配布されている Net::Domain モジュールを使うと、
901Perl 5.7.3 から標準ライブラリの一部であL<Net::Domain> モジュールを使うと、
1392902完全修飾ドメイン名 (FQDN)、ホスト名、ドメイン名が得られます。
1393903
1394 use Net::Domain qw(hostname hostfqdn hostdomain);
904 use Net::Domain qw(hostname hostfqdn hostdomain);
1395905
1396 my $host = hostfqdn();
906 my $host = hostfqdn();
1397907
1398908=begin original
1399909
1400The C<Sys::Hostname> module, included in the standard distribution since
910The L<Sys::Hostname> module, part of the Standard Library, can also get the
1401perl5.6, can also get the hostname.
911hostname:
1402912
1403913=end original
1404914
1405perl5.6 から標準配布されていC<Sys::Hostname> モジュールでも
915標準ライブラリの一部であL<Sys::Hostname> モジュールでもホスト名を
1406ホスト名を得られます。
916得られます。
1407917
1408 use Sys::Hostname;
918 use Sys::Hostname;
1409919
1410 $host = hostname();
920 $host = hostname();
1411921
1412922=begin original
1413923
1414To get the IP address, you can use the C<gethostbyname> built-in function
924The L<Sys::Hostname::Long> module takes a different approach and tries
1415to turn the name into a number. To turn that number into the dotted octet
925harder to return the fully qualified hostname:
1416form (a.b.c.d) that most people expect, use the C<inet_ntoa> function
1417from the <Socket> module, which also comes with perl.
1418926
1419927=end original
1420928
1421IP アドレスを得るには、名前から数値に変換するために C<gethostbyname>
929L<Sys::Hostname::Long> モジュールは異なる手法をとり、完全修飾ホスト名を
1422込み関数が使えます
930返すためにさらに多くのことを試みます:
1423数値を、ほとんどの人が想定しているピリオド付きの形 (a.b.c.d) に変換するには、
1424標準配布されている C<Socket> モジュールの C<inet_ntoa> 関数を使います。
1425
1426 use Socket;
1427931
1428 my $address = inet_ntoa(
932 use Sys::Hostname::Long 'hostname_long';
1429 scalar gethostbyname( $host || 'localhost' )
1430 );
1431933
1432=head2 How do I fetch a news article or the active newsgroups?
934 my $hostname = hostname_long();
1433
1434(ニュースの記事やアクティブなニュースグループを取得するには?)
1435935
1436936=begin original
1437937
1438Use the Net::NNTP or News::NNTPClient modules, both available from CPAN.
938To get the IP address, you can use the C<gethostbyname> built-in function
1439This can make tasks like fetching the newsgroup list as simple as
939to turn the name into a number. To turn that number into the dotted octet
940form (a.b.c.d) that most people expect, use the C<inet_ntoa> function
941from the L<Socket> module, which also comes with perl.
1440942
1441943=end original
1442944
1443Net::NNTP モジュールNews::NNTPClient モジュールのいずれかを使います。
945IP アドレスを得るには、名前ら数値に変換するために C<gethostbyname>
1444これらは両方ともCPANから入手可能です。
946組み込み関数が使えます。
1445これらは以下ように簡単にニュースグループのストを取得するような
947数値を、ほとんど人が想定しているピオド付きの形 (a.b.c.d) に変換するには、
1446作業ができます。
948標準配布されている L<Socket> モジュールの C<inet_ntoa> 関数を使います。
949
950 use Socket;
1447951
1448 perl -MNews::NNTPClient
952 my $address = inet_ntoa(
1449 -e 'print News::NNTPClient->new->list("newsgroups")'
953 scalar gethostbyname( $host || 'localhost' )
954 );
1450955
1451=head2 How do I fetch/put an FTP file?
956=head2 How do I fetch/put an (S)FTP file?
1452957
1453(FTP ファイルをダウンロード/アップロードするには?)
958((S)FTP ファイルをダウンロード/アップロードするには?)
1454959
1455960=begin original
1456961
1457LWP::Simple (available from CPAN) can fetch but not put. Net::FTP (also
962L<Net::FTP>, and L<Net::SFTP> allow you to interact with FTP and SFTP (Secure
1458available from CPAN) is more complex but can put as well as fetch.
963FTP) servers.
1459964
1460965=end original
1461966
1462LWP::Simple (CPAN入手可能)はダウンロドができますが
967L<Net::FTP> と L<Net::SFTP> FTP および SFTP (Secure FTP)バと
1463アップロードはできません
968相互作用できるようになり
1464Net::FTP(これも CPAN で入手可能)はこれよりも複雑ですが、
1465ダウンロードとアップロードの両方ができます。
1466969
1467970=head2 How can I do RPC in Perl?
1468971
1469972(Perl で RPC を行うには?)
1470973
1471974=begin original
1472975
1473(Contributed by brian d foy)
976Use one of the RPC modules( L<https://metacpan.org/search?q=RPC> ).
1474
1475=end original
1476
1477(brian d foy によって寄贈されました)
1478
1479=begin original
1480
1481Use one of the RPC modules you can find on CPAN (
1482http://search.cpan.org/search?query=RPC&mode=all ).
1483977
1484978=end original
1485979
1486CPAN ( http://search.cpan.org/search?query=RPC&mode=all ) で見付かる
980RFC モジュール ( L<https://metacpan.org/search?q=RPC> ) の一つを使いましょう。
1487RFC モジュールの一つを使いましょう。
1488
1489=head1 REVISION
1490
1491Revision: $Revision$
1492
1493Date: $Date$
1494
1495See L<perlfaq> for source control details and availability.
1496981
1497982=head1 AUTHOR AND COPYRIGHT
1498983
1499Copyright (c) 1997-2009 Tom Christiansen, Nathan Torkington, and
984Copyright (c) 1997-2010 Tom Christiansen, Nathan Torkington, and
1500985other authors as noted. All rights reserved.
1501986
1502987This documentation is free; you can redistribute it and/or modify it
1503988under the same terms as Perl itself.
1504989
1505990Irrespective of its distribution, all code examples in this file
1506are hereby placed into the public domain. You are permitted and
991are hereby placed into the public domain. You are permitted and
1507992encouraged to use this code in your own programs for fun
1508or for profit as you see fit. A simple comment in the code giving
993or for profit as you see fit. A simple comment in the code giving
1509994credit would be courteous but is not required.
1510995
1511996=begin meta
1512997
1513998Translate: 吉村 寿人 <JAE00534@niftyserve.or.jp>
1514Update: SHIRAKATA Kentaro <argrath@ub32.org> (5.6.1-)
999Update: SHIRAKATA Kentaro <argrath@ub32.org> (5.6.1-5.14.1, 5.00150039)
1000Status: completed
15151001
15161002=end meta