#!/usr/bin/perl my $awstats_lib_root = './'; my @awstats_libs = ('search_engines.pm', 'robots.pm'); # my $awstats_lib_root = '/usr/share/awstats/lib/'; # my @awstats_libs = ('browsers.pm', 'browsers_phone.pm', 'mime.pm', 'referer_spam.pm', 'search_engines.pm', 'operating_systems.pm', 'robots.pm', 'worms.pm'); foreach $lib (@awstats_libs) {require $awstats_lib_root . $lib;} sub dumpList { my @list = @{$_[0]}; my $FIC = $_[1]; my $first = $_[2]; foreach $r (@list) { $r =~ s/\'/\\\'/g; if ($first == 0) { print $FIC ", "; } else { $first = 0; } print $FIC "'$r'"; } } sub dumpHash { my %hash = %{$_[0]}; my $FIC = $_[1]; my $first = $_[2]; while( my ($k,$v) = each(%hash) ) { $k =~ s/\'/\\\'/g; $v =~ s/\'/\\\'/g; if ($first == 0) { print $FIC ", "; } else { $first = 0; } print $FIC "'$k' : '$v'"; } } # Robots open($FIC,">", "awstats_data.py") or die $!; print $FIC "robots = ["; dumpList(\@RobotsSearchIDOrder_list1, $FIC, 1); dumpList(\@RobotsSearchIDOrder_list2, $FIC, 0); print $FIC "]\n\n"; print $FIC "search_engines = ["; dumpList(\@SearchEnginesSearchIDOrder_list1, $FIC, 1); print $FIC "]\n\n"; print $FIC "search_engines_2 = ["; dumpList(\@SearchEnginesSearchIDOrder_list2, $FIC, 1); print $FIC "]\n\n"; print $FIC "not_search_engines_keys = {"; dumpHash(\%NotSearchEnginesKeys, $FIC, 1); print $FIC "}\n\n"; print $FIC "search_engines_hashid = {"; dumpHash(\%SearchEnginesHashID, $FIC, 1); print $FIC "}\n\n"; print $FIC "search_engines_knwown_url = {"; dumpHash(\%SearchEnginesKnownUrl, $FIC, 1); print $FIC "}\n\n"; close($FIC);