| 1 | package Logfile::EPrints::Filter; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Logfile::EPrints::Filter - base class for filters | ||||||||||
| 6 | |||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||
| 8 | |||||||||||
| 9 | A minimal filter that removes all abstract requests: | ||||||||||
| 10 | |||||||||||
| 11 | package Logfile::EPrints::Filter::Custom; | ||||||||||
| 12 | |||||||||||
| 13 | our @ISA = qw( Logfile::EPrints::Filter ); | ||||||||||
| 14 | |||||||||||
| 15 | sub abstract {} | ||||||||||
| 16 | |||||||||||
| 17 | 1; | ||||||||||
| 18 | |||||||||||
| 19 | =cut | ||||||||||
| 20 | |||||||||||
| 21 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 6 | ▶ | use vars qw( $AUTOLOAD ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | sub new | ||||||||||
| 26 | 1 | ▶ | { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 27 | 1 | my( $class, %self ) = @_; | |||||||||
| 28 | 1 | bless \%self, $class; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | sub AUTOLOAD | ||||||||||
| 32 | 0 | ▶ | { | ||||||||
|
Subroutine
AUTOLOAD: not called CC=2 SCAR=17.9
| |||||||||||
| 33 | 0 | ▶ | return if $AUTOLOAD =~ /[A-Z]$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | $AUTOLOAD =~ s/^.*:://; | |||||||||
| 35 | 0 | $_[0]->{handler}->$AUTOLOAD( $_[1] ); | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | package Logfile::EPrints::Filter::Debug; | ||||||||||
| 39 | |||||||||||
| 40 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 41 | |||||||||||
| 42 | 6 | ▶ | use vars qw( $AUTOLOAD ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 43 | |||||||||||
| 44 | 6 | our @ISA = qw( Logfile::EPrints::Filter ); | |||||||||
| 45 | |||||||||||
| 46 | sub AUTOLOAD | ||||||||||
| 47 | 0 | ▶ | { | ||||||||
|
Subroutine
AUTOLOAD: not called CC=4 SCAR=30.0
| |||||||||||
| 48 | 0 | ▶ | return if $AUTOLOAD =~ /[A-Z]$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | $AUTOLOAD =~ s/^.*:://; | |||||||||
| 50 | 0 | my( $self, $hit ) = @_; | |||||||||
| 51 | 0 | $self->{requests}->{$AUTOLOAD}++; | |||||||||
| 52 | 0 | for( sort keys(%{$self->{requests}}) ) { | |||||||||
| 53 | 0 | ▶ | print STDERR "+" if $_ eq $AUTOLOAD; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | print STDERR "$_ [".$self->{requests}->{$_}."] "; | |||||||||
| 55 | } | ||||||||||
| 56 | 0 | print STDERR "\r"; | |||||||||
| 57 | 0 | $self->{handler}->$AUTOLOAD( $hit ); | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 6 | 1; | |||||||||