Logfile::EPrints::Filter - base class for filters


Logfile-EPrints documentation Contained in the Logfile-EPrints distribution.

Index


Code Index:

NAME

Top

Logfile::EPrints::Filter - base class for filters

SYNOPSIS

Top

A minimal filter that removes all abstract requests:

	package Logfile::EPrints::Filter::Custom;

	our @ISA = qw( Logfile::EPrints::Filter );

	sub abstract {}

	1;


Logfile-EPrints documentation Contained in the Logfile-EPrints distribution.

package Logfile::EPrints::Filter;

use strict;

use vars qw( $AUTOLOAD );

sub new
{
	my( $class, %self ) = @_;
	bless \%self, $class;
}

sub AUTOLOAD
{
	return if $AUTOLOAD =~ /[A-Z]$/;
	$AUTOLOAD =~ s/^.*:://;
	$_[0]->{handler}->$AUTOLOAD( $_[1] );
}

package Logfile::EPrints::Filter::Debug;

use strict;

use vars qw( $AUTOLOAD );

our @ISA = qw( Logfile::EPrints::Filter );

sub AUTOLOAD
{
	return if $AUTOLOAD =~ /[A-Z]$/;
	$AUTOLOAD =~ s/^.*:://;
	my( $self, $hit ) = @_;
	$self->{requests}->{$AUTOLOAD}++;
	for( sort keys(%{$self->{requests}}) ) {
		print STDERR "+" if $_ eq $AUTOLOAD;
		print STDERR "$_ [".$self->{requests}->{$_}."] ";
	}
	print STDERR "\r";
	$self->{handler}->$AUTOLOAD( $hit );
}

1;