переделать скрипт Perl под запуск с Vps

  • Автор темы nocenzru
  • Дата начала
N

nocenzru

#1
есть скрипт перл

use strict;
use LWP::Simple;
open SITEMAPIND, ">c:\\Crawler\\sitemap.noind.txt";
close SITEMAPIND;
open SITEMAPNOIND, ">c:\\Crawler\\sitemap.noind.txt";
close SITEMAPNOIND;
open MYLOG, ">c:\\Crawler\\log.txt";
close MYLOG;

open SITEMAP, "<c:\\Crawler\\sitemap.txt";

my @url_list;
my $url;

while(<SITEMAP>) {
chomp;

#$_ =~ /href=\"(.*)\"/;
$url = $_;

# %2F = /
# %3F = ?
# %3D = =
# %26 = &

while($url =~ s/http:\/\///) {};
while($url =~ s/\//\%2F/) {};
while($url =~ s/\?/\%3F/) {};
while($url =~ s/=/\%3D/) {};
while($url =~ s/\&/\%26/) {};
while($url =~ s/ //) {};

push @url_list, $url;
}

while($url = pop @url_list) {
my $link;
my $url_slash;
my $url_slash_no_www;

my $url_no_www = $url;
$url_no_www =~ s/www\.//;

if($url =~ /\%2F$/) {
$url =~ /(.*)\%2F$/;
$url_slash = $1;
$url_slash_no_www = $url_slash;
$url_slash_no_www =~ s/www\.//;
$link = "http://www.yandex.ru/yandsearch?rpt=rad&text=url%3D%22$url%22+%7C+url%3D%22$url_slash%22+%7C+url%3D%22$url_no_www%22+%7C+url%3D%22$url_slash_no_www%22";
}
else {
$link = "http://www.yandex.ru/yandsearch?rpt=rad&text=url%3D%22$url%22+%7C+url%3D%22$url_no_www%22";

}

open MYLOG, ">>c:\\Crawler\\log.txt";
print MYLOG "$link\n";
close MYLOG;

my $content = get $link;

if($content =~ /Сохраненная копия/) {
while($url =~ s/\%2F/\//) {};
while($url =~ s/\%3F/\?/) {};
while($url =~ s/\%3D/\=/) {};
while($url =~ s/\%26/\&/) {};

open SITEMAPIND, ">>c:\\Crawler\\sitemap.ind.txt";
print SITEMAPIND "http://$url\n";
close SITEMAPIND;
print "\nIND: $url\n";
}
else {
while($url =~ s/\%2F/\//) {};
while($url =~ s/\%3F/\?/) {};
while($url =~ s/\%3D/\=/) {};
while($url =~ s/\%26/\&/) {};

open SITEMAPNOIND, ">>c:\\Crawler\\sitemap.noind.txt";
print SITEMAPNOIND "http://$url\n";
close SITEMAPNOIND;

print "\nNOIND: $url\n";
}
sleep 1;
}

нужно переделать его по запуск с VPS
начало мне хостер подсказал

#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);