=encoding euc-jp =head1 NAME =begin original WWW::RobotRules - database of robots.txt-derived permissions =end original WWW::RobotsRules - robots.txtファイルの解析 =head1 SYNOPSIS use WWW::RobotRules; my $rules = WWW::RobotRules->new('MOMspider/1.0'); use LWP::Simple qw(get); { my $url = "http://some.place/robots.txt"; my $robots_txt = get $url; $rules->parse($url, $robots_txt) if defined $robots_txt; } { my $url = "http://some.other.place/robots.txt"; my $robots_txt = get $url; $rules->parse($url, $robots_txt) if defined $robots_txt; } # Now we can check if a URL is valid for those servers # whose "robots.txt" files we've gotten and parsed: if($rules->allowed($url)) { $c = get $url; ... } =head1 DESCRIPTION =begin original This module parses F files as specified in "A Standard for Robot Exclusion", at Webmasters can use the F file to forbid conforming robots from accessing parts of their web site. =end original このモジュールは の "A Standard for Robot Exclusion" で定義されている F を解析します。 Webマスターは F を使って、対応しているロボットに対して、 自分たちの Web サイトの一部分へのアクセスを禁止することができます。 =begin original The parsed files are kept in a WWW::RobotRules object, and this object provides methods to check if access to a given URL is prohibited. The same WWW::RobotRules object can be used for one or more parsed F files on any number of hosts. =end original 解析されるファイルは WWW::RobotRules に格納され、与えられた URL への アクセスが許されていれば、このオブジェクトはチェックのためのメソッドを 提供します。 同じ WWW::RobotRules オブジェクトは、任意の数のホストの複数の F ファイルを解析することができます。 =begin original The following methods are provided: =end original 以下のメソッドが提供されます: =over 4 =item $rules = WWW::RobotRules->new($robot_name) =begin original This is the constructor for WWW::RobotRules objects. The first argument given to new() is the name of the robot. =end original WWW::RobotRules オブジェクトのためのコンストラクタ。 new() に与えられる最初の引数はそのロボットの名前です。 =item $rules->parse($robot_txt_url, $content, $fresh_until) =begin original The parse() method takes as arguments the URL that was used to retrieve the F file, and the contents of the file. =end original parse() メソッドは引数として F ファイルとその内容を 取り出すために使われる URL を取ります。 =item $rules->allowed($uri) =begin original Returns TRUE if this robot is allowed to retrieve this URL. =end original ロボットがその URL を取り出すことが許されていれば、真を返します。 =item $rules->agent([$name]) =begin original Get/set the agent name. NOTE: Changing the agent name will clear the robots.txt rules and expire times out of the cache. =end original エージェント名を取得/設定します。 注意:エージェント名を変えると、robots.txt ルールとキャッシュの 期限切れがクリアされます。 =back =head1 ROBOTS.TXT =begin original The format and semantics of the "/robots.txt" file are as follows (this is an edited abstract of ): =end original "/robots.txt" ファイルの形式と意味は以下の通りです (これは の概要を編集しています): =begin original The file consists of one or more records separated by one or more blank lines. Each record contains lines of the form =end original ファイルは一つまたは複数レコードにより構成され、一つまたは複数の 空行により分割されます。各レコードは以下のような形式の行が入ります: : =begin original The field name is case insensitive. Text after the '#' character on a line is ignored during parsing. This is used for comments. The following can be used: =end original フィールド名は大文字小文字を区別します。 '#' という文字の後のテキストは解析のとき無視されます。 これはコメントに使われます。以下のを使うことが出来ます: =over 3 =item User-Agent =begin original The value of this field is the name of the robot the record is describing access policy for. If more than one I field is present the record describes an identical access policy for more than one robot. At least one field needs to be present per record. If the value is '*', the record describes the default access policy for any robot that has not not matched any of the other records. =end original このフィールドの値はロボットの名前です。 レコードがこのアクセス・ポリシーを記述します。 複数のUser-Agent フィールドがあれば、そのレコードは同じアクセス・ポリシーを 複数のロボットについて記述してます。 レコードにつき少なくとも1つのフィールドが存在することが必要です。 もし値が '*' であれば、そのレコードは、他のレコードにマッチしなかった すべてのロボットついてのデフォルトのアクセス・ポリシーについて 記述しています。 =begin original The I fields must occur before the I fields. If a record contains a I field after a I field, that constitutes a malformed record. This parser will assume that a blank line should have been placed before that I field, and will break the record into two. All the fields before the I field will constitute a record, and the I field will be the first field in a new record. =end original I フィールドは I フィールドの前になければなりません。 I フィールドの後に I フィールドがあると、 不正なレコードとなります。 このパーサは I フィールドの前に空行があることを仮定していて、 これによりレコードを分割します。 I フィールドの後の全てのフィールドはレコードを構成し、 I フィールドは新しいレコードの最初のフィールドです。 =item Disallow =begin original The value of this field specifies a partial URL that is not to be visited. This can be a full path, or a partial path; any URL that starts with this value will not be retrieved =end original このフィールドの値は訪れてはいけない部分的な URL を指定します。 フルパスでもパスの一部でも指定することが出来ます; この値から始まる すべての URL は取り出されません。 =back =head1 ROBOTS.TXT EXAMPLES (robots.txt の例) =begin original The following example "/robots.txt" file specifies that no robots should visit any URL starting with "/cyberworld/map/" or "/tmp/": =end original 以下の "/robots.txt" ファイルの例は、"/cyberworld/map" または "/tmp/"から 始まる URL にロボットは訪れてはいけないということを指定しています: User-agent: * Disallow: /cyberworld/map/ # This is an infinite virtual URL space Disallow: /tmp/ # these will soon disappear =begin original This example "/robots.txt" file specifies that no robots should visit any URL starting with "/cyberworld/map/", except the robot called "cybermapper": =end original この "/robots.txt" ファイルは "cybermapper" というロボットを除く、 すべてのロボットは "/cyberworld/map" から始まる URL に 訪れてはいけないということを指定します: User-agent: * Disallow: /cyberworld/map/ # This is an infinite virtual URL space # Cybermapper knows where to go. User-agent: cybermapper Disallow: =begin original This example indicates that no robots should visit this site further: =end original この例はロボットはこのサイトにはこれより先に訪れてはいけないということを 示します: # go away User-agent: * Disallow: / =begin original This is an example of a malformed robots.txt file. =end original これは不正な robots.txt ファイルの例です。 # robots.txt for ancientcastle.example.com # I've locked myself away. User-agent: * Disallow: / # The castle is your home now, so you can go anywhere you like. User-agent: Belle Disallow: /west-wing/ # except the west wing! # It's good to be the Prince... User-agent: Beast Disallow: =begin original This file is missing the required blank lines between records. However, the intention is clear. =end original このファイルは、レコードの間に要求されている空行がありません。 しかし、意図は明確です。 =head1 SEE ALSO L, L =begin meta Translated: Hippo2000 (5.48) Updated: Kentaro SHIRAKATA (5.813) =end meta