This file is indexed.

/usr/share/perl5/XML/Doctype/AttDef.pm is in libxml-autowriter-perl 0.40-4.

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
package XML::Doctype::AttDef ;

=head1 NAME

XML::Doctype::AttDef - A class representing a definition in an <!ATTLIST> tag

=head1 SYNOPSIS

   $attr = $elt->attribute( $name ) ;
   $attr->name ;

=head1 DESCRIPTION

This module is used to represent <!ELEMENT> tags in an XML::Doctype object.
It contains <!ATTLIST> tags as well.

=head1 STATUS

This module is alpha code.  It's developed enough to support XML::ValidWriter,
but need a lot of work.  Some big things that are lacking are:

=cut

use strict ;
use vars qw( $VERSION %_default_dtds ) ;
use fields (
   'DEFAULT', # The default value if QUANT is '#FIXED' or '', undef otherwise
   'NAME',
   'OUT_DEFAULT', # Used to set a universal output default value
   'QUANT',   # '#REQUIRED', '#IMPLIED', '#FIXED', undef
   'TYPE',    # 'CDATA', 'ID', ...
) ;

use Carp ;

$VERSION = 0.1 ;

=head1 METHODS

=over

=item new

   $dtd = XML::Doctype::AttDef->new( $name, $type, $default ) ;

=cut

sub new {
   my XML::Doctype::AttDef $self = fields::new( shift );

   ( $self->{NAME}, $self->{TYPE} ) = @_[0,1] ;
   if ( $_[0] =! /^#/ ) {
      ( $self->{QUANT}, $self->{DEFAULT} ) = @_[2,3] ;
   }
   else {
      $self->{DEFAULT} = $_[2] ;
   }

   return $self ;
}


=item default

   ( $spec, $value ) = $attr->default ;
   $attr->default( '#REQUIRED' ) ;
   $attr->default( '#IMPLIED' ) ;
   $attr->default( '', 'foo' ) ;
   $attr->default( '#FIXED', 'foo' ) ;

Sets/gets the default value.  This is a 

=cut

sub default {
   my XML::Doctype::AttDef $self = shift ;

   if ( @_ ) {
      my ( $default ) = @_ ;
      my $quant = $self->quant ;
      if ( defined $default ) {
         if ( defined $quant && $quant =~ /^#(REQUIRED|IMPLIED)/ ) {
	    carp
	 "Attribute '", $self->name, "' $quant default set to '$default'" ;
	 }
      }
      else {
         if ( ! defined $quant ) {
	    carp "Attribute '", $self->name, "' default set to undef" ;
         }
         elsif ( $quant eq '#FIXED' ) {
	    carp "Attribute '", $self->name, "' #FIXED default set to undef" ;
	 }
      }
      $self->{DEFAULT} = $default ;
   }

   return $self->{DEFAULT} ;
}


=item quant

   $attdef->quant( $q ) ;
   $q = $attdef->quant ;

Sets/gets the attribute quantifier: '#REQUIRED', '#FIXED', '#IMPLIED', or ''.

=cut

sub quant {
   my XML::Doctype::AttDef $self = shift ;

   $self->{QUANT} = shift if @_ ;
   return $self->{QUANT} ;
}


=item name

   $attdef->name( $name ) ;
   $name = $attdef->name ;

Sets/gets this attribute name.  Don't change the name while an attribute
is in an element's attlist, since it will then be filed under the wrong
name.

=cut

sub name {
   my XML::Doctype::AttDef $self = shift ;

   $self->{NAME} = shift if @_ ;
   return $self->{NAME} ;
}


=item default_on_write

   $attdef->default_on_write( $value ) ;
   $value = $attdef->default_on_write ;

   $attdef->default_on_write( $attdef->default ) ;

Sets/gets the value which is automatically output for this attribute
if none is supplied to $writer->startTag.  This is typically used
to set a document-wide default for #REQUIRED attributes (and perhaps
plain attributes) so that the attribute is treated like a #FIXED tag
and emitted with a fixed value.

The default_on_write does not need to be the same as the default unless
the quantifier is #FIXED.

=back

=cut

sub default_on_write {
   my XML::Doctype::AttDef $self = shift ;

   $self->{OUT_DEFAULT} = shift if @_ ;
   return $self->{OUT_DEFAULT} ;
}


=head1 SUBCLASSING

This object uses the fields pragma, so you should use base and fields for
any subclasses.

=head1 AUTHOR

Barrie Slaymaker <barries@slaysys.com>

=head1 COPYRIGHT

This module is Copyright 2000, 2005 Barrie Slaymaker.  All rights reserved.

This module is licensed under your choice of the Artistic, BSD or
General Public License.

=cut

1 ;