This file is indexed.

/usr/share/perl5/Curses/Widgets/Label.pm is in libcurses-widgets-perl 1.997-7.

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
# Curses::Widgets::Label.pm -- Label Widgets
#
# (c) 2001, Arthur Corliss <corliss@digitalmages.com>
#
# $Id: Label.pm,v 1.102 2002/11/03 23:36:21 corliss Exp corliss $
#
#    This program 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
#    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; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#####################################################################

=head1 NAME

Curses::Widgets::Label - Label Widgets

=head1 MODULE VERSION

$Id: Label.pm,v 1.102 2002/11/03 23:36:21 corliss Exp corliss $

=head1 SYNOPSIS

  use Curses::Widgets::Label;

  $lbl = Curses::Widgets::Label->new({
    COLUMNS      => 10,
    LINES       => 1,
    VALUE       => 'Name:',
    FOREGROUND  => undef,
    BACKGROUND  => 'black',
    X           => 1,
    Y           => 1,
    ALIGNMENT   => 'R',
    });

  $tf->draw($mwh);

  See the Curses::Widgets pod for other methods.

=head1 REQUIREMENTS

=over

=item Curses

=item Curses::Widgets

=back

=head1 DESCRIPTION

Curses::Widgets::Label provides simplified OO access to Curses-based
single or multi-line labels.

=cut

#####################################################################
#
# Environment definitions
#
#####################################################################

package Curses::Widgets::Label;

use strict;
use vars qw($VERSION @ISA);
use Carp;
use Curses;
use Curses::Widgets;

($VERSION) = (q$Revision: 1.102 $ =~ /(\d+(?:\.(\d+))+)/);
@ISA = qw(Curses::Widgets);

#####################################################################
#
# Module code follows
#
#####################################################################

=head1 METHODS

=head2 new (inherited from Curses::Widgets)

  $lbl = Curses::Widgets::Label->new({
    COLUMNS      => 10,
    LINES       => 1,
    VALUE       => 'Name:',
    FOREGROUND  => undef,
    BACKGROUND  => 'black',
    X           => 1,
    Y           => 1,
    ALIGNMENT   => 'R',
    });

The new method instantiates a new Label object.  The only mandatory
key/value pairs in the configuration hash are B<X> and B<Y>.  All others
have the following defaults:

  Key         Default   Description
  ============================================================
  COLUMNS           10   Number of columns displayed
  LINES             1   Number of lines displayed
  VALUE            ''   Label text
  FOREGROUND    undef   Default foreground colour
  BACKGROUND    undef   Default background colour
  ALIGNMENT         L   'R'ight, 'L'eft, or 'C'entered

If the label is a multi-line label it will filter the current VALUE through
the Curses::Widgets::textwrap function to break it along whitespace and
newlines.

=cut

sub _conf {
  # Validates and initialises the new Label object.
  #
  # Usage:  $self->_conf(%conf);

  my $self = shift;
  my %conf = ( 
    COLUMNS     => 10,
    LINES       => 1,
    VALUE       => '',
    ALIGNMENT   => 'L',
    BORDER      => 0,
    @_ 
    );
  my @required = qw(X Y);
  my $err = 0;

  # Check for required arguments
  foreach (@required) { $err = 1 unless exists $conf{$_} };

  $conf{ALIGNMENT} = uc($conf{ALIGNMENT});

  # Make sure no errors are returned by the parent method
  $err = 1 unless $self->SUPER::_conf(%conf);

  return $err == 0 ? 1 : 0;
}

=head2 draw

  $tf->draw($mwh);

The draw method renders the text field in its current state.  This
requires a valid handle to a curses window in which it will render
itself.

=cut

sub _content {
  my $self = shift;
  my $dwh = shift;
  my $conf = $self->{CONF};
  my ($lines, $cols, $value) = 
    @$conf{qw(LINES COLUMNS VALUE)};
  my (@lines, $offset);

  # Get the lines
  @lines = textwrap($value, $cols);

  # Write the widget value
  foreach (0..$lines) {
    next unless defined $lines[$_];
    $offset = $$conf{ALIGNMENT} eq 'C' ?
      int(($$conf{COLUMNS} - length($lines[$_])) / 2) : 
      ($$conf{ALIGNMENT} eq 'R' ? 
      $$conf{COLUMNS} - length($lines[$_]) : 0);
    $offset = 0 if $offset < 0;
    $dwh->addstr(0 + $_, 0 + $offset, $lines[$_]) if $_ <= $#lines;
  }
}

# The following are overridden to make sure no one tries anything fancy with
# this widget.  ;-)

sub input_key {
  return;
}

sub execute {
 return;
}

1;

=head1 HISTORY

=over

=item 2002/10/18 -- First implementation

=back

=head1 AUTHOR/COPYRIGHT

(c) 2001 Arthur Corliss (corliss@digitalmages.com) 

=cut