Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

/var/sites/help-site.com/auto/tmp/CPAN/1264/SNMP-LogParser-1.0767/lib/SNMP/LogParserDriver/ExampleDriver.pm

/var/sites/help-site.com/auto/tmp/CPAN/1264/SNMP-LogParser-1.0767/lib/SNMP/LogParserDriver/ExampleDriver.pm


NAME

SNMP::LogParserDriver::ExampleDriver


SYNOPSIS

This is an example Driver class to check for strings in the log file of the form ``test string''. Every time that this string is found the variable ``counter'' is incremented.


DESCRIPTION

Here we show each of the functions

new

New is just a passthrough to the parent class


 sub new {

   my $class = shift;

   my $self  = $class->SUPER::new();

   bless ($self, $class);

   return $self;

 }

evalBegin

Here we initialize the ``counter'' variable. We declare it in the ``savespace'' hash so that it is persistent across run invocations of logparser


 sub evalBegin {

   my $self = shift;  

   $self->{savespace}{counter} = 0 if (!defined($self->{savespace}{counter}));

   $self->{savespace}{lines} = 0 if (!defined($self->{savespace}{counter}));

 }

evalIterate

Here we parse each line, incrementing the counter value if it matches the string (we also keep track of lines)


 sub evalIterate {

   my $self = shift;

   my ($line) = @_;

   $self->{savespace}{lines} ++;

   if ($line =~ /test string/g) {

      $self->{savespace}{counter} ++;

   }

 }

evalEnd

Here we tell the system that we want to output on the properties file all the variables in the save space...


 sub evalEnd {

   my $self = shift;

   $self->properties($self->savespace);

 }


OPTIONS


BUGS


TODO


SEE ALSO


AUTHOR

Nito@Qindel.es -- 7/9/2006

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy