This file is indexed.

/usr/share/perl5/SQL/Statement/Term.pm is in libsql-statement-perl 1.405-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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
package SQL::Statement::Term;

use strict;
use warnings;

our $VERSION = '1.405';

use Scalar::Util qw(weaken);
use Carp ();

=pod

=head1 NAME

SQL::Statement::Term - base class for all terms

=head1 SYNOPSIS

  # create a term with an SQL::Statement object as owner
  my $term = SQL::Statement::Term->new( $owner );
  # access the value of that term
  $term->value( $eval );

=head1 DESCRIPTION

SQL::Statement::Term is an abstract base class providing the interface
for all terms.

=head1 INHERITANCE

  SQL::Statement::Term

=head1 METHODS

=head2 new

Instantiates new term and stores a weak reference to the owner.

=head2 value

I<Abstract> method which will return the value of the term. Must be
overridden by derived classes.

=head2 DESTROY

Destroys the term and undefines the weak reference to the owner.

=cut

sub new
{
    my $class = $_[0];
    my $owner = $_[1];

    my $self = bless( { OWNER => $owner }, $class );
    weaken( $self->{OWNER} );

    return $self;
}

sub DESTROY
{
    my $self = $_[0];
    undef $self->{OWNER};
}

sub value($)
{
    Carp::confess(
              sprintf( q{pure virtual function '%s->value' called}, ref( $_[0] ) || __PACKAGE__ ) );
}

package SQL::Statement::ConstantTerm;

use vars qw(@ISA);
@ISA = qw(SQL::Statement::Term);

=pod

=head1 NAME

SQL::Statement::ConstantTerm - term for constant values

=head1 SYNOPSIS

  # create a term with an SQL::Statement object as owner
  my $term = SQL::Statement::ConstantTerm->new( $owner, 'foo' );
  # access the value of that term - returns 'foo'
  $term->value( $eval );

=head1 DESCRIPTION

SQL::Statement::ConstantTerm implements a term which will always return the
same constant value.

=head1 INHERITANCE

  SQL::Statement::ConstantTerm
  ISA SQL::Statement::Term

=head1 METHODS

=head2 new

Instantiates new term and stores the constant to deliver and a weak
reference to the owner.

=head2 value

Returns the specified constant.

=cut

sub new
{
    my ( $class, $owner, $value ) = @_;

    my $self = $class->SUPER::new($owner);
    $self->{VALUE} = $value;

    return $self;
}

sub value($$) { return $_[0]->{VALUE}; }

package SQL::Statement::ColumnValue;

use vars qw(@ISA);
@ISA = qw(SQL::Statement::Term);

use Carp qw(croak);
use Params::Util qw(_INSTANCE _ARRAY0 _SCALAR);
use Scalar::Util qw(looks_like_number);

=pod

=head1 NAME

SQL::Statement::ColumnValue - term for column values

=head1 SYNOPSIS

  # create a term with an SQL::Statement object as owner
  my $term = SQL::Statement::ColumnValue->new( $owner, 'id' );
  # access the value of that term - returns the value of the column 'id'
  # of the currently active row in $eval
  $term->value( $eval );

=head1 DESCRIPTION

SQL::Statement::ColumnValue implements a term which will return the specified
column of the active row.

=head1 INHERITANCE

  SQL::Statement::ColumnValue
  ISA SQL::Statement::Term

=head1 METHODS

=head2 new

Instantiates new term and stores the column name to deliver and a weak
reference to the owner.

=head2 value

Returns the specified column value.

=cut

sub new
{
    my ( $class, $owner, $value ) = @_;

    my $self = $class->SUPER::new($owner);
    $self->{VALUE} = $value;

    return $self;
}

sub value($)
{
    my ( $self, $eval ) = @_;
    unless ( defined( $self->{TMPVAL} ) )
    {
        my ( $tbl, $col ) = $self->{OWNER}->full_qualified_column_name( $self->{VALUE} );
        defined($tbl) or croak("Can't find table containing column named '$self->{VALUE}'");
        defined($col) or croak("Unknown column: '$self->{VALUE}'");
        $self->{TMPVAL}      = $tbl . $self->{OWNER}->{dlm} . $col;
        $self->{TABLE_NAME}  = $tbl;
        $self->{COLUMN_NAME} = $col;
    }

    # XXX - can TMPVAL being defined without TABLE_NAME?
    unless ( defined( $self->{TABLE_NAME} ) )
    {
        croak( "No table specified: '" . $self->{OWNER}->{original_string} . "'" );
    }

    # with TempEval: return $eval->column($self->{TABLE_NAME}, $self->{COLUMN_NAME});
    my $fp;
    defined( $fp = $self->{fastpath}->{ "${eval}." . $self->{TABLE_NAME} } )
      and return &$fp( $self->{COLUMN_NAME} );

    defined( $fp = $self->{fastpath}->{ "${eval}." . $self->{TMPVAL} } )
      and return &$fp( $self->{TMPVAL} );

    if ( defined( _INSTANCE( $eval, 'SQL::Eval' ) ) )
    {
        $self->{fastpath}->{ "${eval}." . $self->{TABLE_NAME} } =
          $eval->_gen_access_fastpath( $self->{TABLE_NAME} );
        return &{ $self->{fastpath}->{ "${eval}." . $self->{TABLE_NAME} } }( $self->{COLUMN_NAME} );
    }
    elsif ( defined( _INSTANCE( $eval, 'SQL::Eval::Table' ) ) )
    {
        $self->{fastpath}->{ "${eval}." . $self->{TMPVAL} } =
          $eval->_gen_access_fastpath( $self->{TMPVAL} );
        return &{ $self->{fastpath}->{ "${eval}." . $self->{TMPVAL} } }( $self->{TMPVAL} );
        # return $eval->column( $self->{TMPVAL} );
    }
    else
    {
        croak( "Unsupported table storage: '" . ref($eval) . "'" );
    }
}

=head1 AUTHOR AND COPYRIGHT

Copyright (c) 2009,2010 by Jens Rehsack: rehsackATcpan.org

All rights reserved.

You may distribute this module under the terms of either the GNU
General Public License or the Artistic License, as specified in
the Perl README file.

=cut

1;