Logfile.pm 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. package Pisg::Parser::Logfile;
  2. # Copyright and license, as well as documentation(POD) for this module is
  3. # found at the end of the file.
  4. use strict;
  5. $^W = 1;
  6. sub new
  7. {
  8. my $type = shift;
  9. my %args = @_;
  10. my $self = {
  11. cfg => $args{cfg},
  12. parser => undef
  13. };
  14. # Import common functions in Pisg::Common
  15. require Pisg::Common;
  16. Pisg::Common->import();
  17. bless($self, $type);
  18. # Pick our parser.
  19. $self->{parser} = $self->_choose_format($self->{cfg}->{format});
  20. return $self;
  21. }
  22. # The function to choose which module to use.
  23. sub _choose_format
  24. {
  25. my $self = shift;
  26. my $format = shift;
  27. $self->{parser} = undef;
  28. eval <<_END;
  29. use lib '$self->{cfg}->{modules_dir}';
  30. use Pisg::Parser::Format::$format;
  31. \$self->{parser} = new Pisg::Parser::Format::$format(
  32. cfg => \$self->{cfg},
  33. );
  34. _END
  35. if ($@) {
  36. print STDERR "Could not load parser for '$format': $@\n";
  37. return undef;
  38. }
  39. return $self->{parser};
  40. }
  41. sub analyze
  42. {
  43. my $self = shift;
  44. my (%stats, %lines);
  45. if (defined $self->{parser}) {
  46. my $starttime = time();
  47. # Just initialize these to 0
  48. $stats{days} = 0;
  49. $stats{parsedlines} = 0;
  50. $stats{totallines} = 0;
  51. if ($self->{cfg}->{logdir}) {
  52. # Run through all files in dir
  53. $self->_parse_dir(\%stats, \%lines);
  54. } else {
  55. # Run through the whole logfile
  56. my %state = (
  57. linecount => 0,
  58. lastnick => '',
  59. monocount => 0,
  60. lastnormal => '',
  61. oldtime => 24
  62. );
  63. $self->_parse_file(\%stats, \%lines, $self->{cfg}->{logfile}, \%state);
  64. }
  65. $self->_pick_random_lines(\%stats, \%lines);
  66. _uniquify_nicks(\%stats);
  67. my ($sec,$min,$hour) = gmtime(time() - $starttime);
  68. my $processtime = sprintf('%02d hours, %02d minutes and %02d seconds', $hour, $min, $sec);
  69. $stats{processtime}{hours} = sprintf('%02d', $hour);
  70. $stats{processtime}{mins} = sprintf('%02d', $min);
  71. $stats{processtime}{secs} = sprintf('%02d', $sec);
  72. print "Channel analyzed succesfully in $processtime on ",
  73. scalar localtime(time()), "\n"
  74. unless ($self->{cfg}->{silent});
  75. return \%stats;
  76. } else {
  77. print STDERR "Skipping channel '$self->{cfg}->{channel}' due to lack of parser.\n";
  78. return undef
  79. }
  80. # Shouldn't get here.
  81. return undef;
  82. }
  83. sub _parse_dir
  84. {
  85. my $self = shift;
  86. my ($stats, $lines) = @_;
  87. # Add trailing slash when it's not there..
  88. $self->{cfg}->{logdir} =~ s/([^\/])$/$1\//;
  89. unless ($self->{cfg}->{silent}) {
  90. unless ($self->{cfg}->{nfiles} > 0) {
  91. print "Going into $self->{cfg}->{logdir} and parsing all files there...\n\n"
  92. } else {
  93. print "Going into $self->{cfg}->{logdir} and parsing the last $self->{cfg}->{nfiles} file(s) there...\n\n"
  94. }
  95. }
  96. my @filesarray;
  97. opendir(LOGDIR, $self->{cfg}->{logdir}) or
  98. die("Can't opendir $self->{cfg}->{logdir}: $!");
  99. @filesarray = grep {
  100. /^[^\.]/ && /^$self->{cfg}->{logprefix}/ && -f "$self->{cfg}->{logdir}/$_"
  101. } readdir(LOGDIR) or
  102. die("No files in \"$self->{cfg}->{logdir}\" matched prefix \"$self->{cfg}->{logprefix}\"");
  103. closedir(LOGDIR);
  104. my %state = (
  105. lastnick => '',
  106. monocount => 0,
  107. oldtime => 24
  108. );
  109. if ($self->{cfg}->{logsuffix} ne '') {
  110. my @temparray;
  111. my %months = (
  112. 'jan' => '0',
  113. 'feb' => '1',
  114. 'mar' => '2',
  115. 'apr' => '3',
  116. 'may' => '4',
  117. 'jun' => '5',
  118. 'jul' => '6',
  119. 'aug' => '7',
  120. 'sep' => '8',
  121. 'oct' => '9',
  122. 'nov' => '10',
  123. 'dec' => '11',
  124. );
  125. my ($mreg, $dreg, $yreg) = split(/\|\|/, $self->{cfg}->{logsuffix});
  126. my (@month, @day, @year);
  127. for my $file (@filesarray) {
  128. LOOPSTART:
  129. if ($file =~ /$mreg/) {
  130. my $month = $1;
  131. $month = lc $month;
  132. $month = $months{$month}
  133. if (defined $months{$month});
  134. push @month, $month;
  135. } else {
  136. splice(@filesarray,$#month + 1, 1);
  137. if ($file = $filesarray[$#month + 1]) {
  138. goto LOOPSTART;
  139. } else {
  140. last;
  141. }
  142. }
  143. if ($file =~ /$dreg/) {
  144. push @day, $1;
  145. } else {
  146. splice(@filesarray,$#day + 1, 1);
  147. splice(@month,$#day + 1);
  148. if ($file = $filesarray[$#day + 1]) {
  149. goto LOOPSTART;
  150. } else {
  151. last;
  152. }
  153. }
  154. if ($file =~ /$yreg/) {
  155. push @year, $1;
  156. } else {
  157. splice(@filesarray,$#year + 1, 1);
  158. splice(@month,$#year + 1);
  159. splice(@day,$#year + 1);
  160. if ($file = $filesarray[$#year + 1]) {
  161. goto LOOPSTART;
  162. } else {
  163. last;
  164. }
  165. }
  166. }
  167. my @newarray = @filesarray[ sort {
  168. $year[$a] <=> $year[$b]
  169. ||
  170. $month[$a] <=> $month[$b]
  171. ||
  172. $day[$a] <=> $day[$b]
  173. } 0..$#filesarray ];
  174. @filesarray = @newarray;
  175. } else {
  176. @filesarray = sort {lc($a) cmp lc($b)} @filesarray;
  177. }
  178. if($self->{cfg}->{nfiles} > 0) {
  179. my $shift = @filesarray - $self->{cfg}->{nfiles};
  180. splice(@filesarray, 0, $shift);
  181. }
  182. foreach my $file (@filesarray) {
  183. $file = $self->{cfg}->{logdir} . $file;
  184. $self->_parse_file($stats, $lines, $file, \%state);
  185. }
  186. }
  187. # This parses the file...
  188. sub _parse_file
  189. {
  190. my $self = shift;
  191. my ($stats, $lines, $file, $state) = @_;
  192. print "Analyzing log($file) in '$self->{cfg}->{format}' format...\n"
  193. unless ($self->{cfg}->{silent});
  194. if ($file =~ /.bz2?$/ && -f $file) {
  195. open (LOGFILE, "bunzip2 -c $file |") or
  196. die("$0: Unable to open logfile($file): $!\n");
  197. } elsif ($file =~ /.gz$/ && -f $file) {
  198. open (LOGFILE, "gunzip -c $file |") or
  199. die("$0: Unable to open logfile($file): $!\n");
  200. } else {
  201. open (LOGFILE, $file) or
  202. die("$0: Unable to open logfile($file): $!\n");
  203. }
  204. my $lastnormal = '';
  205. while(my $line = <LOGFILE>) {
  206. $line = _strip_mirccodes($line);
  207. $line =~ s/\r+$//; # Strip DOS Formatting
  208. my $hashref;
  209. # Match normal lines.
  210. if ($hashref = $self->{parser}->normalline($line, $.)) {
  211. my $repeated = 0;
  212. if (defined $hashref->{repeated}) {
  213. $repeated = $hashref->{repeated};
  214. }
  215. my ($hour, $nick, $saying, $i);
  216. for ($i = 0; $i <= $repeated; $i++) {
  217. if ($i > 0) {
  218. $hashref = $self->{parser}->normalline($lastnormal, $.);
  219. #Increment number of lines for repeated lines
  220. }
  221. $hour = $self->_adjusttimeoffset($hashref->{hour});
  222. $nick = find_alias($hashref->{nick});
  223. checkname($hashref->{nick}, $nick, $stats) if ($self->{cfg}->{showmostnicks});
  224. $saying = $hashref->{saying};
  225. if ($hour < $state->{oldtime}) {
  226. $stats->{days}++;
  227. $stats->{day_times}{$stats->{days}}[0] = 0;
  228. $stats->{day_times}{$stats->{days}}[1] = 0;
  229. $stats->{day_times}{$stats->{days}}[2] = 0;
  230. $stats->{day_times}{$stats->{days}}[3] = 0;
  231. $stats->{day_lines}{$stats->{days}} = 0;
  232. }
  233. $state->{oldtime} = $hour;
  234. if (!is_ignored($nick)) {
  235. $stats->{parsedlines}++;
  236. # Timestamp collecting
  237. $stats->{times}{$hour}++;
  238. $stats->{day_times}{$stats->{days}}[int($hour/6)]++;
  239. $stats->{day_lines}{$stats->{days}}++;
  240. $stats->{lines}{$nick}++;
  241. $stats->{lastvisited}{$nick} = $stats->{days};
  242. $stats->{line_times}{$nick}[int($hour/6)]++;
  243. # Count up monologues
  244. if ($state->{lastnick} eq $nick) {
  245. $state->{monocount}++;
  246. if ($state->{monocount} == 5) {
  247. $stats->{monologues}{$nick}++;
  248. }
  249. } else {
  250. $state->{monocount} = 0;
  251. }
  252. $state->{lastnick} = $nick;
  253. my $len = length($saying);
  254. if ($len > $self->{cfg}->{minquote} && $len < $self->{cfg}->{maxquote}) {
  255. push @{ $lines->{sayings}{$nick} }, $saying;
  256. } elsif (!$lines->{sayings}{$nick}) {
  257. # Just fill the users first saying in if he hasn't
  258. # said anything yet, to get rid of empty quotes.
  259. push @{ $lines->{sayings}{$nick} }, substr($saying, 0, $self->{cfg}->{maxquote});
  260. }
  261. $stats->{lengths}{$nick} += $len;
  262. $stats->{questions}{$nick}++
  263. if (index($saying, '?') > -1);
  264. $stats->{shouts}{$nick}++
  265. if (index($saying, '!') > -1);
  266. if ($saying !~ /[a-z]/o && $saying =~ /[A-Z]/o) {
  267. # Ignore single smileys on a line. eg. '<user> :P'
  268. if ($saying !~ /^[8;:=][ ^-o]?[)pPD}\]>]$/o) {
  269. $stats->{allcaps}{$nick}++;
  270. push @{ $lines->{allcaplines}{$nick} }, $line;
  271. }
  272. }
  273. if (my @foul = $saying =~ /($self->{cfg}->{foulwords})/io) {
  274. $stats->{foul}{$nick} += scalar @foul;
  275. push @{ $lines->{foullines}{$nick} }, $line;
  276. }
  277. # Who smiles the most?
  278. # A regex matching al lot of smilies
  279. $stats->{smiles}{$nick}++
  280. if ($saying =~ /[8;:=][ ^-o]?[)pPD}\]>]/o);
  281. if ($saying =~ /[8;:=][ ^-]?[\(\[\\\/{]/o and
  282. $saying !~ /\w+:\/\//o) {
  283. $stats->{frowns}{$nick}++;
  284. }
  285. # Find URLs
  286. if (my @urls = match_urls($saying)) {
  287. foreach my $url (@urls) {
  288. if(!url_is_ignored($url)) {
  289. $url =~ s/&/&amp;/g;
  290. $stats->{urlcounts}{$url}++;
  291. $stats->{urlnicks}{$url} = $nick;
  292. }
  293. }
  294. }
  295. _parse_words($stats, $saying, $nick, $self->{cfg}->{ignoreword}, $hour);
  296. }
  297. }
  298. $lastnormal = $line;
  299. $repeated = 0;
  300. }
  301. # Match action lines.
  302. elsif ($hashref = $self->{parser}->actionline($line, $.)) {
  303. $stats->{parsedlines}++;
  304. my ($hour, $nick, $saying);
  305. $hour = $self->_adjusttimeoffset($hashref->{hour});
  306. $nick = find_alias($hashref->{nick});
  307. checkname($hashref->{nick}, $nick, $stats) if ($self->{cfg}->{showmostnicks});
  308. $saying = $hashref->{saying};
  309. if ($hour < $state->{oldtime}) {
  310. $stats->{days}++;
  311. $stats->{day_times}{$stats->{days}}[0] = 0;
  312. $stats->{day_times}{$stats->{days}}[1] = 0;
  313. $stats->{day_times}{$stats->{days}}[2] = 0;
  314. $stats->{day_times}{$stats->{days}}[3] = 0;
  315. $stats->{day_lines}{$stats->{days}} = 0;
  316. }
  317. $state->{oldtime} = $hour;
  318. if (!is_ignored($nick)) {
  319. # Timestamp collecting
  320. $stats->{times}{$hour}++;
  321. $stats->{day_times}{$stats->{days}}[int($hour/6)]++;
  322. $stats->{day_lines}{$stats->{days}}++;
  323. $stats->{actions}{$nick}++;
  324. push @{ $lines->{actionlines}{$nick} }, $line;
  325. $stats->{lines}{$nick}++;
  326. $stats->{lastvisited}{$nick} = $stats->{days};
  327. $stats->{line_times}{$nick}[int($hour/6)]++;
  328. if ($saying =~ /^($self->{cfg}->{violentwords}) (\S+)(.*)/o) {
  329. my $victim;
  330. unless ($victim = is_nick($2)) {
  331. foreach my $trynick (split(/\s+/, $3)) {
  332. last if ($victim = is_nick($trynick));
  333. }
  334. unless ($victim) {
  335. $victim = $2;
  336. }
  337. }
  338. if (!is_ignored($victim)) {
  339. $stats->{violence}{$nick}++;
  340. $stats->{attacked}{$victim}++;
  341. push @{ $lines->{violencelines}{$nick} }, $line;
  342. push @{ $lines->{attackedlines}{$victim} }, $line;
  343. }
  344. }
  345. $stats->{lengths}{$nick} += length($saying);
  346. _parse_words($stats, $saying, $nick, $self->{cfg}->{ignoreword}, $hour);
  347. }
  348. }
  349. # Match *** lines.
  350. elsif (($hashref = $self->{parser}->thirdline($line, $.)) and $hashref->{nick}) {
  351. $stats->{parsedlines}++;
  352. my ($hour, $min, $nick, $kicker, $newtopic, $newmode, $newjoin);
  353. my ($newnick);
  354. $hour = $self->_adjusttimeoffset($hashref->{hour});
  355. $min = $hashref->{min};
  356. $nick = find_alias($hashref->{nick});
  357. checkname($hashref->{nick}, $nick, $stats) if ($self->{cfg}->{showmostnicks});
  358. $kicker = find_alias($hashref->{kicker})
  359. if ($hashref->{kicker});
  360. $newtopic = $hashref->{newtopic};
  361. $newmode = $hashref->{newmode};
  362. $newjoin = $hashref->{newjoin};
  363. $newnick = $hashref->{newnick};
  364. if ($hour < $state->{oldtime}) {
  365. $stats->{days}++;
  366. $stats->{day_times}{$stats->{days}}[0]=0;
  367. $stats->{day_times}{$stats->{days}}[1]=0;
  368. $stats->{day_times}{$stats->{days}}[2]=0;
  369. $stats->{day_times}{$stats->{days}}[3]=0;
  370. $stats->{day_lines}{$stats->{days}}=0;
  371. }
  372. $state->{oldtime} = $hour;
  373. if (!is_ignored($nick)) {
  374. # Timestamp collecting
  375. $stats->{times}{$hour}++;
  376. $stats->{day_times}{$stats->{days}}[int($hour/6)]++;
  377. $stats->{day_lines}{$stats->{days}}++;
  378. $stats->{lastvisited}{$nick} = $stats->{days};
  379. if (defined($kicker)) {
  380. if (!is_ignored($kicker)) {
  381. $stats->{kicked}{$kicker}++;
  382. $stats->{gotkicked}{$nick}++;
  383. push @{ $lines->{kicklines}{$nick} }, $line;
  384. }
  385. } elsif (defined($newtopic) && $newtopic ne '') {
  386. _topic_change($stats, $newtopic, $nick, $hour, $min);
  387. } elsif (defined($newmode)) {
  388. _modechanges($stats, $newmode, $nick);
  389. } elsif (defined($newjoin)) {
  390. $stats->{joins}{$nick}++;
  391. } elsif (defined($newnick) and ($self->{cfg}->{nicktracking} == 1)) {
  392. # Resolve new nick to the correct alias (this will create a hard-alias if it is using a regex)
  393. $newnick = find_alias($newnick);
  394. add_alias($nick, $newnick);
  395. checkname($nick, $newnick, $stats) if ($self->{cfg}->{showmostnicks});
  396. }
  397. }
  398. }
  399. }
  400. $stats->{totallines} = $.;
  401. close(LOGFILE);
  402. print "Finished analyzing log, $stats->{days} days total.\n"
  403. unless ($self->{cfg}->{silent});
  404. }
  405. sub _topic_change
  406. {
  407. my $stats = shift;
  408. my $newtopic = shift;
  409. my $nick = shift;
  410. my $hour = shift;
  411. my $min = shift;
  412. my $tcount = 0;
  413. if (defined $stats->{topics}) {
  414. $tcount = @{ $stats->{topics} };
  415. }
  416. $stats->{topics}[$tcount]{topic} = $newtopic;
  417. $stats->{topics}[$tcount]{nick} = $nick;
  418. $stats->{topics}[$tcount]{hour} = $hour;
  419. $stats->{topics}[$tcount]{min} = $min;
  420. }
  421. sub _modechanges
  422. {
  423. my $stats = shift;
  424. my $newmode = shift;
  425. my $nick = shift;
  426. my (@voice, @halfops, @ops, $plus);
  427. foreach (split(//, $newmode)) {
  428. if ($_ eq 'o') {
  429. $ops[$plus]++;
  430. } elsif ($_ eq 'h') {
  431. $halfops[$plus]++;
  432. } elsif ($_ eq 'v') {
  433. $voice[$plus]++;
  434. } elsif ($_ eq '+') {
  435. $plus = 0;
  436. } elsif ($_ eq '-') {
  437. $plus = 1;
  438. }
  439. }
  440. $stats->{gaveops}{$nick} += $ops[0] if $ops[0];
  441. $stats->{tookops}{$nick} += $ops[1] if $ops[1];
  442. $stats->{gavehalfops}{$nick} += $halfops[0] if $halfops[0];
  443. $stats->{tookhalfops}{$nick} += $halfops[1] if $halfops[1];
  444. $stats->{gavevoice}{$nick} += $voice[0] if $voice[0];
  445. $stats->{tookvoice}{$nick} += $voice[1] if $voice[1];
  446. }
  447. sub _parse_words
  448. {
  449. my ($stats, $saying, $nick, $ignoreword, $hour) = @_;
  450. # Cache time of day
  451. my $tod = int($hour/6);
  452. foreach my $word (split(/[\s,!?.:;)(\"]+/o, $saying)) {
  453. $stats->{words}{$nick}++;
  454. $stats->{word_times}{$nick}[$tod]++;
  455. # remove uninteresting words
  456. next if ($ignoreword->{$word});
  457. # ignore contractions
  458. next if ($word =~ m/'.{1,2}$/o);
  459. # Also ignore stuff from URLs.
  460. next if ($word =~ m/^https?$|^\/\//o);
  461. $stats->{wordcounts}{$word}++;
  462. $stats->{wordnicks}{$word} = $nick;
  463. }
  464. }
  465. sub _pick_random_lines
  466. {
  467. my ($self, $stats, $lines) = @_;
  468. foreach my $key (keys %{ $lines }) {
  469. foreach my $nick (keys %{ $lines->{$key} }) {
  470. $stats->{$key}{$nick} = $self->_random_line($stats, $lines, $key, $nick, 0);
  471. }
  472. }
  473. }
  474. sub _random_line
  475. {
  476. my ($self, $stats, $lines, $key, $nick, $count) = @_;
  477. my $random = ${ $lines->{$key}{$nick} }[rand@{ $lines->{$key}{$nick} }];
  478. if ($self->{cfg}->{noignoredquotes} && $random =~ /$self->{cfg}->{ignorewordsregex}/io) {
  479. return '' if ($count > 20);
  480. return $self->_random_line($stats, $lines, $key, $nick, ++$count);
  481. } else {
  482. return $random;
  483. }
  484. }
  485. sub _uniquify_nicks {
  486. my ($stats) = @_;
  487. foreach my $word (keys %{ $stats->{wordcounts} }) {
  488. if (my $realnick = is_nick($word)) {
  489. # The lc() is an attempt at being case insensitive.
  490. if (lc($realnick) ne lc($word)) {
  491. $stats->{wordcounts}{$realnick} += $stats->{wordcounts}{$word};
  492. $stats->{wordnicks}{$realnick} = $stats->{wordnicks}{$word};
  493. delete $stats->{wordcounts}{$word};
  494. delete $stats->{wordnicks}{$word};
  495. }
  496. }
  497. }
  498. }
  499. sub _strip_mirccodes
  500. {
  501. my $line = shift;
  502. # boldcode = chr(2) = oct 001
  503. # colorcode = chr(3) = oct 003
  504. # plaincode = chr(15) = oct 017
  505. # reversecode = chr(22) = oct 026
  506. # underlinecode = chr(31) = oct 037
  507. # Strip mIRC color codes
  508. $line =~ s/\003\d{1,2},\d{1,2}//go;
  509. $line =~ s/\003\d{0,2}//go;
  510. # Strip mIRC bold, plain, reverse and underline codes
  511. $line =~ s/[\002\017\026\037]//go;
  512. return $line;
  513. }
  514. sub checkname {
  515. # This function tracks nickchanges and puts them all in a hash->array,
  516. # so we can show all nicks that I user had later (only works properly
  517. # when nicktracking is enabled)
  518. my ($nick, $newnick, $stats) = @_;
  519. $stats->{nicks}{$newnick}{lc($nick)} = $nick;
  520. }
  521. sub _adjusttimeoffset
  522. {
  523. my ($self, $hour) = @_;
  524. if ($self->{cfg}{timeoffset} != 0) {
  525. # Adjust time
  526. $hour += $self->{cfg}{timeoffset};
  527. $hour = $hour % 24;
  528. }
  529. return sprintf('%02d', $hour);
  530. }
  531. 1;
  532. __END__
  533. =head1 NAME
  534. Pisg::Parser::Logfile - class to parse a normal logfile
  535. =head1 DESCRIPTION
  536. C<Pisg::Parser::Logfile> parses a logfile using the configuration variables set in the 'cfg' option passed to the constructor.
  537. =head1 SYNOPSIS
  538. use Pisg::Parser::Logfile;
  539. $analyzer = new Pisg::Parser::Logfile(
  540. cfg => $cfg,
  541. );
  542. =head1 CONSTRUCTOR
  543. =over 4
  544. =item new ( [ OPTIONS ] )
  545. This is the constructor for a new Pisg::Parser::Logfile object. C<OPTIONS> are passed in a hash like fashion using key and value pairs.
  546. Possible options are:
  547. B<cfg> - hashref containing configuration variables, created by the Pisg module.
  548. =back
  549. =head1 AUTHOR
  550. Morten Brix Pedersen <morten@wtf.dk>
  551. =head1 COPYRIGHT
  552. Copyright (C) 2001 Morten Brix Pedersen. All rights resereved.
  553. This program is free software; you can redistribute it and/or modify it
  554. under the terms of the GPL, license is included with the distribution of
  555. this file.
  556. =cut