This file is indexed.

/usr/lib/x86_64-linux-gnu/perl5/5.22/Embperl/Form/DataSource.pm is in libembperl-perl 2.5.0-6.

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
###################################################################################
#
#   Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh  www.ecos.de
#   Embperl - Copyright (c) 2008-2014 Gerald Richter
#
#   You may distribute under the terms of either the GNU General Public
#   License or the Artistic License, as specified in the Perl README file.
#
#   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
#   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
#   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
#   $Id$
#
###################################################################################

package Embperl::Form::DataSource ;

use strict ;

# ---------------------------------------------------------------------------
#
#   new - create a new datasource object
#


sub new

    {
    my ($class, $args) = @_ ;

    my $self = {datsrc => $args -> {datasrc}} ;
    bless $self, $class ;

    $self -> init ($args) ;

    return $self ;
    }

# ---------------------------------------------------------------------------
#
#   init - init the new datasource object
#

sub init

    {
    my ($self) = @_ ;

    return $self ;
    }

# ---------------------------------------------------------------------------
#
#   values_no_cache - returns true to inhibit cacheing of values during one request
#

sub values_no_cache { 0 }

# ---------------------------------------------------------------------------
#
#   constrain_attrs - returns attrs that might change the form layout
#                     if there value changes
#

sub constrain_attrs

    {
    my ($self, $req) = @_ ;

    return () if (!$self -> {constrain}) ;
    return ($self -> {constrain}) ;
    }

# ---------------------------------------------------------------------------
#
#   sorttype - returns information how to sort this datasource values for displaying
#

sub sorttype { undef }

# ---------------------------------------------------------------------------
#
#   get_values - returns the values and options
#

sub get_values

    {
    my ($self, $req) = @_ ;

    die "Please overwrite get_values in " . ref $self ;
    }

# ---------------------------------------------------------------------------
#
#   get_option_from_value - returns the option for a given value
#
#   in  $value  value
#   ret         option
#

sub get_option_from_value

    {
    my ($self, $value, $req, $ctrl) = @_ ;
    
    
    my ($values, $options) = $self -> get_values ($req, $ctrl) ;

    my $i = 0 ;
    foreach (@$values)
        {
        if ($_ eq $value)
            {
            return $options -> [$i] ;
            }
        $i++ ;
        }

    return ;
    }


# ---------------------------------------------------------------------------
#
#   get_id_from_value - returns id for a given value
#

sub get_id_from_value

    {
    my ($self, $value) = @_ ;

    return $value ;
    }

# ---------------------------------------------------------------------------
#
#   get_datasource_controls - returns additional controls provided by the
#   datasource object e.g. a browse button
#

sub get_datasource_controls

    {
    my ($self, $req, $ctrl) = @_ ;

    return ;
    }


1 ;

__END__

=pod

=head1 NAME

Embperl::Form::DataSource - Base class for data source objects
which provides the data for ControlMutlValue objects.


=head1 SYNOPSIS

Do not use directly, instead derive a class

=head1 DESCRIPTION

This class is not used directly, it is used as a base class for
all data source objects.
It provides a set of methods
that could be overwritten to customize the behaviour of your controls.

=head1 METHODS

=head2 get_values

returns the values and options. Must be overwritten.

=head3 get_id_from_value

returns an id for a given value. This allow to have an id form an value/option
pair which is not excat the same as the value. This is used in json requests
for example for selectdyn control.

=head3 get_datasource_controls 

returns additional controls provided by the
datasource object e.g. a browse button

=head1 AUTHOR

G. Richter (richter at embperl dot org)

=head1 SEE ALSO

perl(1), Embperl, Embperl::Form, Embperl::From::ControlMultValue