Pisg.pm 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. package Pisg;
  2. # Documentation(POD) for this module is found at the end of the file.
  3. # Copyright (C) 2001-2002 <Morten Brix Pedersen> - morten@wtf.dk
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. use strict;
  19. $^W = 1;
  20. sub new
  21. {
  22. my $type = shift;
  23. my %args = @_;
  24. my $self = {
  25. override_cfg => $args{override_cfg},
  26. use_configfile => $args{use_configfile},
  27. search_path => $args{search_path},
  28. chans => {},
  29. users => {},
  30. cfg => {},
  31. bwd => {},
  32. tmps => {},
  33. };
  34. # Set the default configuration settings.
  35. get_default_config_settings($self);
  36. # Import common functions in Pisg::Common
  37. require Pisg::Common;
  38. Pisg::Common->import();
  39. bless($self, $type);
  40. return $self;
  41. }
  42. sub run
  43. {
  44. my $self = shift;
  45. print "pisg v$self->{cfg}->{version} - Perl IRC Statistics Generator\n\n"
  46. unless ($self->{cfg}->{silent});
  47. # Init the configuration file (aliases, ignores, channels, etc)
  48. my $r;
  49. if ($self->{use_configfile}) {
  50. if ((open(CONFIG, $self->{cfg}->{configfile})
  51. or open(CONFIG, $self->{search_path} . "/$self->{cfg}->{configfile}"))) {
  52. $r = $self->init_config(\*CONFIG)
  53. }
  54. }
  55. print "Using config file: $self->{cfg}->{configfile}\n\n"
  56. if ($r && !$self->{cfg}->{silent});
  57. $self->init_words() # Init words. (Foulwords, ignorewords, etc.)
  58. if ($self->{use_configfile});
  59. # Get translations from langfile
  60. $self->get_language_templates();
  61. # Parse any channels in <channel> statements
  62. $self->parse_channels();
  63. # Optionaly parse the channel we were given in override_cfg.
  64. $self->do_channel()
  65. if (!$self->{cfg}->{chan_done}{$self->{cfg}->{channel}});
  66. }
  67. sub get_default_config_settings
  68. {
  69. my $self = shift;
  70. # This is all the default settings of pisg. They can be overriden by the
  71. # pisg.cfg file, or by using the override_cfg argument to the new
  72. # constructor.
  73. $self->{cfg} = {
  74. channel => '',
  75. logtype => 'Logfile',
  76. logfile => '',
  77. format => 'mIRC',
  78. network => 'SomeIRCNet',
  79. outputfile => 'index.html',
  80. outputtag => '',
  81. maintainer => 'MAINTAINER',
  82. pagehead => 'none',
  83. pagefoot => 'none',
  84. configfile => 'pisg.cfg',
  85. imagepath => '',
  86. imageglobpath => '',
  87. defaultpic => '',
  88. logdir => '',
  89. nfiles => 0,
  90. lang => 'en',
  91. langfile => 'lang.txt',
  92. cssdir => 'layout/',
  93. colorscheme => 'default',
  94. logprefix => '',
  95. logsuffix => '',
  96. silent => 0,
  97. userpics => 'y',
  98. # Colors / Layout
  99. hicell => '#BABADD', # FIXME
  100. hicell2 => '#CCCCCC', # FIXME
  101. picwidth => '',
  102. picheight => '',
  103. pic_v_0 => 'blue-v.png',
  104. pic_v_6 => 'green-v.png',
  105. pic_v_12 => 'yellow-v.png',
  106. pic_v_18 => 'red-v.png',
  107. pic_h_0 => 'blue-h.png',
  108. pic_h_6 => 'green-h.png',
  109. pic_h_12 => 'yellow-h.png',
  110. pic_h_18 => 'red-h.png',
  111. piclocation => '.',
  112. # Stats settings
  113. showactivetimes => 1,
  114. showbignumbers => 1,
  115. showtopics => 1,
  116. showlinetime => 0,
  117. showwordtime => 0,
  118. showtime => 1,
  119. showwords => 0,
  120. showwpl => 0,
  121. showcpl => 0,
  122. showlastseen => 0,
  123. showlegend => 1,
  124. showkickline => 1,
  125. showactionline => 1,
  126. showfoulline => 0,
  127. showshoutline => 1,
  128. showviolentlines => 1,
  129. showrandquote => 1,
  130. showmuw => 1,
  131. showmrn => 1,
  132. showmru => 1,
  133. showops => 1,
  134. showvoices => 0,
  135. showhalfops => 0,
  136. showmostnicks => 0,
  137. showmostactivebyhour => 0,
  138. showmostactivebyhourgraph => 0,
  139. showonlytop => 0,
  140. # Less important things
  141. timeoffset => '+0',
  142. minquote => 25,
  143. maxquote => 65,
  144. quotewidth => 80,
  145. wordlength => 5,
  146. activenicks => 25,
  147. activenicks2 => 30,
  148. activenicksbyhour => 10,
  149. topichistory => 3,
  150. urlhistory => 5,
  151. nickhistory => 5,
  152. wordhistory => 10,
  153. mostnickshistory => 5,
  154. mostnicksverbose => 1,
  155. nicktracking => 0,
  156. charset => 'iso-8859-1',
  157. irciinick => 'maintainer',
  158. # sorting
  159. sortbywords => 0,
  160. # Misc settings
  161. foulwords => 'ass fuck bitch shit scheisse scheiße kacke arsch ficker ficken schlampe',
  162. violentwords => 'slaps beats smacks',
  163. ignorewords => '',
  164. noignoredquotes => 0,
  165. tablewidth => 614,
  166. regexpaliases => 0,
  167. botnicks => '', # Needed for DCpp format (non-irc)
  168. dailyactivity => 0,
  169. version => "0.50",
  170. };
  171. # Backwards compatibility with old option names:
  172. $self->{bwd} = {
  173. default_pic => 'DefaultPic',
  174. prefix => 'LogPrefix',
  175. show_activetimes => 'ShowActiveTimes',
  176. show_bignumbers => 'ShowBigNumbers',
  177. show_topics => 'ShowTopics',
  178. show_linetime => 'ShowLineTime',
  179. show_time => 'ShowTime',
  180. show_words => 'ShowWords',
  181. show_wpl => 'ShowWpl',
  182. show_cpl => 'ShowCpl',
  183. show_lastseen => 'ShowLastSeen',
  184. show_legend => 'ShowLegend',
  185. show_kickline => 'ShowKickLine',
  186. show_actionline => 'ShowActionLine',
  187. show_shoutline => 'ShowShoutLine',
  188. show_violentlines => 'ShowViolentLines',
  189. show_randquote => 'ShowRandQuote',
  190. show_muw => 'ShowMuw',
  191. show_mrn => 'ShowMrn',
  192. show_mru => 'ShowMru',
  193. show_voices => 'ShowVoices',
  194. show_mostnicks => 'ShowMostNicks',
  195. foul => 'FoulWords',
  196. violent => 'ViolentWords',
  197. regexp_aliases => 'RegexpAliases',
  198. pic_loc => 'PicLocation',
  199. pic_width => 'PicWidth',
  200. pic_height => 'PicHeight'
  201. };
  202. # This enables us to use the search_path in other modules
  203. $self->{cfg}->{search_path} = $self->{search_path};
  204. # Parse the optional overriden configuration variables
  205. foreach my $key (keys %{$self->{override_cfg}}) {
  206. if ($self->{override_cfg}->{$key}) {
  207. $self->{cfg}->{$key} = $self->{override_cfg}->{$key};
  208. }
  209. }
  210. }
  211. sub get_language_templates
  212. {
  213. my $self = shift;
  214. open(FILE, $self->{cfg}->{langfile}) or open (FILE, $self->{search_path} . "/$self->{cfg}->{langfile}") or die("$0: Unable to open language file($self->{cfg}->{langfile}): $!\n");
  215. while (my $line = <FILE>)
  216. {
  217. next if ($line =~ /^#/);
  218. if ($line =~ /<lang name=\"([^"]+)\">/i) {
  219. # Found start tag, setting the current language
  220. my $current_lang = lc($1);
  221. while (<FILE>) {
  222. last if ($_ =~ /<\/lang>/i);
  223. # Get 'template = "Text"' in language file:
  224. if ($_ =~ /(\w+)\s+=\s+"(.*)"\s*$/) {
  225. $self->{tmps}->{$current_lang}{$1} = $2;
  226. }
  227. }
  228. }
  229. }
  230. close(FILE);
  231. }
  232. sub init_words
  233. {
  234. my $self = shift;
  235. $self->{cfg}->{foulwords} =~ s/(^\s+|\s+$)//g;
  236. my @foulwords = split(/\s+/, $self->{cfg}->{foulwords});
  237. $self->{cfg}->{foulwords} = '\b' . join('|\b', @foulwords) . '|' . join('\b|', @foulwords) . '\b';
  238. $self->{cfg}->{ignorewords} =~ s/(^\s+|\s+$)//g;
  239. foreach (split(/\s+/, $self->{cfg}->{ignorewords})) {
  240. $self->{cfg}->{ignoreword}{$_} = 1;
  241. }
  242. if ($self->{cfg}->{noignoredquotes}) {
  243. my $igntmp = $self->{cfg}->{ignorewords};
  244. $igntmp =~ s/(\[|\]|\(|\)|\/|\\)/\\$1/g;
  245. my @ignorewords = split(/\s+/, $igntmp);
  246. $self->{cfg}->{ignorewordsregex} = '\b' . join('|\b', @ignorewords) . '|' . join('\b|', @ignorewords) . '\b';
  247. }
  248. $self->{cfg}->{violentwords} =~ s/(^\s+|\s+$)//g;
  249. $self->{cfg}->{violentwords} =~ s/\s+/|/g;
  250. }
  251. sub init_config
  252. {
  253. my $self = shift;
  254. my $fh = shift;
  255. while (my $line = <$fh>)
  256. {
  257. next if ($line =~ /^#/);
  258. chomp $line;
  259. if ($line =~ /<user.*>/) {
  260. my $nick;
  261. if ($line =~ /nick=(["'])(.+?)\1/) {
  262. $nick = $2;
  263. add_alias($nick, $nick);
  264. } else {
  265. print STDERR "Warning: $self->{cfg}->{configfile}, line $.: No nick specified\n";
  266. next;
  267. }
  268. if ($line =~ /alias=(["'])(.+?)\1/) {
  269. my @thisalias = split(/\s+/, lc($2));
  270. foreach (@thisalias) {
  271. if ($self->{cfg}->{regexpaliases} and /[\|\[\]\{\}\(\)\?\+\.\*\^\\]/) {
  272. add_aliaswild($nick, $_);
  273. } elsif (not $self->{cfg}->{regexpaliases} and s/\*/\.\*/g) {
  274. # quote it if it is a wildcard
  275. s/([\|\[\]\{\}\(\)\?\+\^\\])/\\$1/g;
  276. add_aliaswild($nick, $_);
  277. } else {
  278. add_alias($nick, $_);
  279. }
  280. }
  281. }
  282. if ($line =~ /pic=(["'])(.+?)\1/) {
  283. $self->{users}->{userpics}{$nick} = $2;
  284. }
  285. if ($line =~ /bigpic=(["'])(.+?)\1/) {
  286. $self->{users}->{biguserpics}{$nick} = $2;
  287. }
  288. if ($line =~ /link=(["'])(.+?)\1/) {
  289. $self->{users}->{userlinks}{$nick} = $2;
  290. }
  291. if ($line =~ /ignore=(["'])Y\1/i) {
  292. add_ignore($nick);
  293. }
  294. if ($line =~ /sex=(["'])([MmFf])\1/) {
  295. $self->{users}->{sex}{$nick} = lc($2);
  296. }
  297. } elsif ($line =~ /<link(.*)>/) {
  298. if ($line =~ /url=(["'])(.+?)\1/) {
  299. my $url = $2;
  300. if ($line =~ /ignore="Y"/i) {
  301. add_url_ignore($url);
  302. }
  303. } else {
  304. print STDERR "Warning: $self->{cfg}->{configfile}, line $.: No URL specified\n";
  305. }
  306. } elsif ($line =~ /<set(.*)>/) {
  307. my $settings = $1;
  308. if ($settings !~ /=["'](.*)["']/ || $settings =~ /(\w)>/ ) {
  309. print STDERR "Warning: $self->{cfg}->{configfile}, line $.: Missing or wrong quotes near $1\n";
  310. }
  311. while ($settings =~ s/[ \t]([^=]+?)=(["'])(.*?)\2//) {
  312. my $var = lc($1);
  313. $var =~ s/ //; # Remove whitespace
  314. if (!defined($self->{cfg}->{$var})) {
  315. if (defined($self->{bwd}->{$var})) {
  316. print "Using backwards compatibility option '$var'; you should change it to '$self->{bwd}->{$var}'\n";
  317. unless (($self->{cfg}->{lc($self->{bwd}->{$var})} eq $3) || $self->{override_cfg}->{lc($self->{bwd}->{$var})}) {
  318. $self->{cfg}->{$self->{bwd}->{$var}} = $3;
  319. }
  320. next;
  321. } else {
  322. print STDERR "Warning: $self->{cfg}->{configfile}, line $.: No such configuration option: '$var'\n";
  323. next;
  324. }
  325. }
  326. unless (($self->{cfg}->{$var} eq $3) || $self->{override_cfg}->{$var}) {
  327. $self->{cfg}->{$var} = $3;
  328. }
  329. }
  330. } elsif ($line =~ /<channel=(['"])(.+?)\1(.*)>/i) {
  331. my ($channel, $settings) = ($2, $3);
  332. $self->{chans}->{$channel}->{channel} = $channel;
  333. $self->{cfg}->{chan_done}{$self->{cfg}->{channel}} = 1; # don't parse channel in $self->{cfg}->{channel} if a channel statement is present
  334. while ($settings =~ s/\s([^=]+)=(["'])(.+?)\2//) {
  335. my $var = lc($1);
  336. if (defined($self->{bwd}->{$var})) {
  337. print "Using backwards compatibility option '$var'; you should change it to '$self->{bwd}->{$var}'\n";
  338. $self->{chans}->{$channel}{lc($self->{bwd}->{$var})} = $3;
  339. } else {
  340. $self->{chans}->{$channel}{$var} = $3;
  341. }
  342. }
  343. while (<$fh>) {
  344. last if ($_ =~ /<\/*channel>/i);
  345. if ($_ =~ /^\s*(\w+)\s*=\s*(["'])(.+?)\2/) {
  346. my $var = lc($1);
  347. unless ($self->{override_cfg}->{$var}) {
  348. if (defined($self->{bwd}->{$var})) {
  349. print "Using backwards compatibility option '$var'; you should change it to '$self->{bwd}->{$var}'\n";
  350. $self->{chans}->{$channel}{lc($self->{bwd}->{$var})} = $3;
  351. } else {
  352. $self->{chans}->{$channel}{$var} = $3;
  353. }
  354. }
  355. } elsif ($_ !~ /^$/) {
  356. print STDERR "Warning: $self->{cfg}->{configfile}, line $.: Unrecognized line\n";
  357. }
  358. }
  359. } elsif ($line =~ /<include\s*=\s*(["'])(.+?)\1\s*>/) {
  360. my $include_cfg = $2;
  361. my $backup_cfg = $self->{cfg}->{configfile};
  362. $self->{cfg}->{configfile} = $include_cfg;
  363. my $r;
  364. if ((open(INCLUDE, $self->{cfg}->{configfile})
  365. or open(INCLUDE, $self->{search_path} . "/$self->{cfg}->{configfile}"))) {
  366. $r = $self->init_config(\*INCLUDE);
  367. } else {
  368. print STDERR "Warning: $backup_cfg, line $.: $self->{cfg}->{configfile}: $!\n";
  369. }
  370. print "Included config file: $self->{cfg}->{configfile}\n\n"
  371. if ($r && !$self->{cfg}->{silent});
  372. $self->{cfg}->{configfile} = $backup_cfg;
  373. } elsif ($line =~ /<(\w+)?.*[^>]$/) {
  374. print STDERR "Warning: $self->{cfg}->{configfile}, line $.: Missing end on element <$1 (probably multi-line?)\n";
  375. } elsif ($line =~ /\S/) {
  376. $line =~ s/\n//;
  377. print STDERR "Warning: $self->{cfg}->{configfile}, line $.: Unrecognized line\n";
  378. }
  379. }
  380. close($fh);
  381. }
  382. sub init_pisg
  383. {
  384. my $self = shift;
  385. my $timestamp = time();
  386. $self->{cfg}->{start} = time();
  387. if ($self->{cfg}->{timeoffset} =~ /\+(\d+)/) {
  388. # We must plus some hours to the time
  389. $timestamp += 3600 * $1; # 3600 seconds per hour
  390. } elsif ($self->{cfg}->{timeoffset} =~ /-(\d+)/) {
  391. # We must remove some hours from the time
  392. $timestamp -= 3600 * $1; # 3600 seconds per hour
  393. }
  394. $self->{cfg}->{timestamp} = $timestamp;
  395. # Add trailing slash when it's not there..
  396. $self->{cfg}->{imagepath} =~ s/([^\/])$/$1\//;
  397. # Set ImageGlobPath default
  398. $self->{cfg}->{imageglobpath} ||= $self->{cfg}->{imagepath};
  399. $self->{cfg}->{imageglobpath} =~ s/([^\/])$/$1\//;
  400. # Set number of picture columns to show
  401. if ($self->{cfg}->{userpics} =~ /^n/i) {
  402. $self->{cfg}->{userpics} = 0;
  403. } elsif ($self->{cfg}->{userpics} =~ /^y/i) {
  404. $self->{cfg}->{userpics} = 1;
  405. } elsif ($self->{cfg}->{userpics} !~ /^\d+$/) {
  406. print STDERR "Warning: $self->{cfg}->{configfile}, line $.: Invalid UserPics setting\n";
  407. }
  408. print "Using language template: $self->{cfg}->{lang}\n\n" if ($self->{cfg}->{lang} ne 'EN' && !$self->{cfg}->{silent});
  409. print "Statistics for channel $self->{cfg}->{channel} \@ $self->{cfg}->{network} by $self->{cfg}->{maintainer}\n\n"
  410. unless ($self->{cfg}->{silent});
  411. }
  412. sub do_channel
  413. {
  414. my $self = shift;
  415. if (!$self->{cfg}->{channel}) {
  416. print STDERR "No channels defined.\n";
  417. } elsif ((!$self->{cfg}->{logfile}) && (!$self->{cfg}->{logdir})) {
  418. print STDERR "No logfile or logdir defined for " . $self->{cfg}->{channel} . "\n";
  419. } else {
  420. $self->init_pisg(); # Init some general things
  421. store_aliases(); # Save the aliases so we can restore them
  422. # later, we don't want to add the aliases
  423. # for this channel to the next channel
  424. # Pick our stats generator.
  425. my $analyzer;
  426. eval <<_END;
  427. use Pisg::Parser::$self->{cfg}->{logtype};
  428. \$analyzer = new Pisg::Parser::$self->{cfg}->{logtype}(
  429. cfg => \$self->{cfg}
  430. );
  431. _END
  432. if ($@) {
  433. print STDERR "Could not load stats analyzer for '$self->{cfg}->{logtype}': $@\n";
  434. return undef;
  435. }
  436. my $stats = $analyzer->analyze();
  437. $self->{cfg}->{analyzer} = $analyzer;
  438. # Initialize HTMLGenerator object
  439. my $generator;
  440. eval <<_END;
  441. use Pisg::HTMLGenerator;
  442. \$generator = new Pisg::HTMLGenerator(
  443. cfg => \$self->{cfg},
  444. stats => \$stats,
  445. users => \$self->{users},
  446. tmps => \$self->{tmps}
  447. );
  448. _END
  449. if ($@) {
  450. print STDERR "Could not load stats generator (Pisg::HTMLGenerator): $@\n";
  451. return undef;
  452. }
  453. # Create our HTML page if the logfile has any data.
  454. if (defined $stats and $stats->{parsedlines} > 0) {
  455. $generator->create_output();
  456. } elsif ($stats->{parsedlines} == 0) {
  457. print STDERR "No parseable lines found in logfile ($stats->{totallines} total lines). Skipping.\nYou might be using the wrong format.\n";
  458. }
  459. restore_aliases();
  460. $self->{cfg}->{chan_done}{$self->{cfg}->{channel}} = 1;
  461. }
  462. }
  463. sub parse_channels
  464. {
  465. my $self = shift;
  466. my %origcfg = %{ $self->{cfg} };
  467. # make a list of channels to do
  468. my @chanlist;
  469. if (scalar @ {$self->{cfg}->{cchannels} } > 0) {
  470. @chanlist = @{ $self->{cfg}->{cchannels} };
  471. } else {
  472. @chanlist = keys %{ $self->{chans} };
  473. }
  474. foreach my $channel (@chanlist) {
  475. if (!defined $self->{chans}->{$channel}) {
  476. print STDERR "Channel $channel not in config file, ignoring\n";
  477. next;
  478. }
  479. foreach (keys %{ $self->{chans}->{$channel} }) {
  480. $self->{cfg}->{$_} = $self->{chans}->{$channel}{$_};
  481. }
  482. $self->do_channel();
  483. $origcfg{chan_done} = $self->{cfg}->{chan_done};
  484. %{ $self->{cfg} } = %origcfg;
  485. }
  486. }
  487. 1;
  488. __END__
  489. =head1 NAME
  490. Pisg - Perl IRC Statistics Generator main module
  491. =head1 SYNOPSIS
  492. use Pisg;
  493. $pisg = new Pisg(
  494. use_configfile => '1',
  495. override_cfg => { network => 'MyNetwork', format => 'eggdrop' }
  496. );
  497. $pisg->run();
  498. =head1 DESCRIPTION
  499. C<Pisg> is a statistic generator for IRC logfiles or the like, delivering
  500. the results in a HTML page.
  501. =head1 CONSTRUCTOR
  502. =over 4
  503. =item new ( [ OPTIONS ] )
  504. This is the constructor for a new Pisg object. C<OPTIONS> are passed in a hash like fashion, using key and value pairs.
  505. Possible options are:
  506. B<use_configfile> - When set to 1, pisg will look up it's channels in it's
  507. configuration file, defined by the configuration option 'configfile'.
  508. B<override_cfg> - This defines whichever configuration variables you want to
  509. override from the configuration file. If you set use_configfile to 0, then
  510. you'll have to set at least channel and logfile here.
  511. B<search_path> - This defines an optional search path. It's used when you want to hardcode an alternative path where pisg should look after its language and config file.
  512. =back
  513. =head1 AUTHOR
  514. Morten Brix Pedersen <morten@wtf.dk>
  515. =head1 COPYRIGHT
  516. Copyright (C) 2001 Morten Brix Pedersen. All rights resereved.
  517. This program is free software; you can redistribute it and/or modify it
  518. under the terms of the GPL, license is included with the distribution of
  519. this file.
  520. =cut