#!/usr/bin/perl ########################################################################## # yaala 0.7.3 2004-11-10 # #---=============--------------------------------------------------------# # Language: Perl # # Purpose: Generating statistics # # Input: Logfiles # # Output: One or more HTML-files (depending on the output module) # # Version: 0.7.3 (stable) # # License: GPL # # Homepage: http://yaala.org/ # # Authors: Florian octo Forster # # Contributions are listed in AUTHORS # ########################################################################## BEGIN { if ($0 =~ m#^(.*)[/\\]#) { chdir ($1); } unshift (@::INC, 'lib'); # 0x010: lib/Data/Core.pm # 0x020: lib/Data/Setup.pm # 0x040: lib/Data/Convert.pm # 0x080: lib/Data/Core.pm (dump any data stored!) # 0x100: lib/Report/GDGraph.pm # 0x200: lib/Data/Persistent.pm $::DEBUG = 0x0000; } use strict; use warnings; use vars qw( $DEBUG $EXTRA $NAME $VERSION $HOMEPAGE ); use Carp; use Yaala::Config qw#get_config parse_argv read_config#; $NAME = 'yaala'; $VERSION = '0.7.3'; $HOMEPAGE = 'http://yaala.org/'; if ($DEBUG) { select STDOUT; $| = 1; } $EXTRA = {}; print STDERR $/, __FILE__, ': $Id: yaala,v 1.17 2004/11/10 10:07:43 octo Exp $' if ($DEBUG); parse_argv (@ARGV); read_config (get_config ('config') ? get_config ('config') : 'config'); unless (get_config ('input')) { usage (); exit (1); } # report and data initialization needs parser module my $logtype = get_config ('logtype'); my $report = get_config ('report' ); $logtype ||= 'Common'; $report ||= 'Combined'; $logtype = ucfirst (lc ($logtype)); $report = ucfirst (lc ($report )); require "Yaala/Parser/$logtype.pm"; require "Yaala/Report/$report.pm"; import Yaala::Parser qw#parse extra#; import Yaala::Report qw#generate#; print STDERR $/, __FILE__, ": Accumulating data.." if ($DEBUG); my $num_read_files = 0; for (get_config ('input')) { #no strict 'refs'; if (open (LOGFILE, '< ' . $_)) { print STDERR $/, __FILE__, qq#: Reading "$_"# if ($DEBUG); $num_read_files++; parse ($_) while (); close LOGFILE; } else { print STDERR $/, __FILE__, qq#: Error opening "$_": $!#; } } if (!$num_read_files) { print STDERR $/, __FILE__, ": Could not read any files. Exiting.\n"; exit (1); } extra (); print STDERR $/, __FILE__, ': Generating pages..' if ($DEBUG); generate (); print STDERR $/, __FILE__, ": Exiting.." if ($DEBUG); exit (0); ################################################## # end of main program # #---=====================------------------------# # surprised?? well, it's pretty short, cause all # # the _real_ work is done in the the modules. # # If you write a modul by your own: PLEASE send # # me a copy so that i can include it in the # # package. # # And how about 12 modules at a time ? -- qmax # # Awesome :) -- octo # ################################################## sub usage { print STDOUT < ] file1 .. fileN Options: --config Specify alternate config file --directory yaala will write all generated files to this directory (and overwrite existing ones without prompting!) --report Selects the report type to use --logtype Specifies the type of logfiles to parse --select Select statements. See README.selections You can prepend two dashes to every keyword in the config file and configure yaala from the command line. EOF return (1); } END { print STDERR $/ if ($DEBUG); }