This file is indexed.

/usr/share/perl5/Lire/DlfCategoriser.pm is in lire 2:2.1.1-2.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
package Lire::DlfCategoriser;

use strict;

use base qw/Lire::DlfAnalyser/;

use Carp;

=pod

=head1 NAME

Lire::DlfCategoriser - Base class for analysers which produce extended
DLF records.

=head1 SYNOPSIS

  use base qw/ Lire::DlfCategoriser /;

  sub categorise {
    my ( $self, $dlf ) = @_;

    # Adds the extended field to DLF.

    return;
  }


=head1 DESCRIPTION

This package defines a base class that can be use for
Lire::DlfAnalyser which writes to an ExtendedSchema. The categoriser
only have to implement the categorise() method instead of the
more generic analyse().

=head1 META INFORMATION METHODS

The Lire::DlfCategoriser should implement the same meta-information
methods than the Lire::DlfAnalyser (name(), src_schema(),
dst_schema(), title(), description()).

=head1 IMPLEMENTATION METHODS

The categoriser does its job using the initialise() and categorise()
methods.

=head2 analyse( $process, $config )

The Lire::DlfCategoriser implements the analyse() method. It will
run the query on the src_schema() using the correct filter and will
call categorise() on each DLF returned. The extended fiels will then
be written to dst_schema(). Errors should be reported by dying.

=cut

sub analyse {
    my ( $self, $process, $config ) = @_;

    my $dst_schema = Lire::DlfSchema::load_schema( $self->dst_schema() );
    croak "'" . $self->name() . "' analyser doesn't declare to write to an ExtendedSchema: '" . $self->dst_schema() . "'"
      unless $dst_schema->isa( 'Lire::ExtendedSchema' );

    eval { $self->initialise( $config ) };
    if ( $@ ) {
        $process->error( "Error during initialise: $@" );
        return;
    }
    my $schema = Lire::DlfSchema::load_schema( $self->src_schema() );
    my $query = $schema->dlf_query();
    $query->set_sort_spec( $schema->timestamp_field()->name() );

    my $filter = $process->source_filter();
    $query->set_filter_clause( $filter->sql_expr(), @{$filter->sql_params()} )
      if defined $filter;

    my $result = $query->execute( $process->dlf_store() );
    while ( defined( my $dlf = $result->next_row() ) ) {
        eval { $self->categorise( $dlf ) };
        if ( $@ ) {
            $process->error( $@ ) if $@;
        } else {
            $process->write_dlf( $dlf );
        }
    }

    eval { $self->finalise( $config ) };
    $process->error( "Error during initialise: $@" ) if ( $@ );

    return;
}

=pod

=head2 initialise( $config )

This method is called before the categorise() method is called.

The $config parameter contains configuration data that was specified
in the AnalysisJob for that analyser. To register configuration
specification for you DlfCategoriser, you just need to define a
configuration specification under the name
I<analyser_name>_properties. This should be either a RecordSpec or
ObjectSpec.

=cut

sub initialise {
    croak "initialise() not implemented by ", ref $_[0] || $_[0];
}

=pod

=head2 categorise( $dlf )

Called one for each DLf records that should be categorised. The
categoriser should add the extended fields directly to the $dlf hash
reference.

=cut

sub categorise {
    croak "categorise() not implemented by ", ref $_[0] || $_[0];
}

=pod

=head2 finalise( $config )

This method is called after all the DLF records were categorised. 

The $config parameter contains configuration data that was specified
in the AnalysisJob for that analyser. To register configuration
specification for you DlfCategoriser, you just need to define a
configuration specification under the name
I<analyser_name>_properties. This should be either a RecordSpec or
ObjectSpec.

The default implementation does nothing.

=cut

sub finalise { 
    # Empty method
}

# keep perl happy
1;

__END__

=pod

=head1 SEE ALSO

Lire::DlfAnalyserProcess(3pm), Lire::DlfStore(3pm),
Lire::PluginManager(3pm), Lire::DlfAnalyser(3pm)

=head1 AUTHOR

Francis J. Lacoste <flacoste@logreport.org>

=head1 VERSION

$Id: DlfCategoriser.pm,v 1.6 2006/07/23 13:16:28 vanbaal Exp $

=head1 COPYRIGHT

Copyright (C) 2004 Stichting LogReport Foundation LogReport@LogReport.org

This file is part of Lire.

Lire is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program (see COPYING); if not, check with
http://www.gnu.org/copyleft/gpl.html.

=cut