"Fossies" - the Fresh Open Source Software Archive

Member "libwww-perl-6.43/xt/author/misc/dbmrobot" (26 Nov 2019, 586 Bytes) of package /linux/www/libwww-perl-6.43.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 use strict;
    3 use warnings;
    4 
    5 use LWP::RobotUA;
    6 use URI::URL;
    7 use WWW::RobotRules::AnyDBM_File;
    8 
    9 my $url = url(shift) || die "Usage: $0 <url>\n";
   10 my $botname = "Spider/0.1";
   11 
   12 my $rules = WWW::RobotRules::AnyDBM_File->new($botname, 'robotdb');
   13 my $ua = LWP::RobotUA->new($botname, 'gisle@aas.no', $rules);
   14 $ua->delay(0.1);
   15 
   16 my $req = HTTP::Request->new(GET => $url);
   17 
   18 my $res = $ua->request($req);
   19 print "Got ", $res->code, " ", $res->message, "(", $res->content_type, ")\n";
   20 
   21 my $netloc = $url->netloc;
   22 print "This was visit no ", $ua->no_visits($netloc), " to $netloc\n";