This file is indexed.

/usr/share/perl5/CSS/DOM/Rule.pm is in libcss-dom-perl 0.15-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
package CSS::DOM::Rule;

$VERSION = '0.15';

use warnings;
use strict;

use Carp 'croak';
use CSS::DOM::Constants;
use CSS::DOM::Exception qw/ SYNTAX_ERR INVALID_MODIFICATION_ERR /;
use Exporter 5.57 'import';
use Scalar::Util 'weaken';

*EXPORT_OK = $CSS::DOM::Constants::EXPORT_TAGS{rule};
our %EXPORT_TAGS = (all => \our @EXPORT_OK);

use constant 1.03 our $_const = {
# Don’t let these conflict with subclasses!
	prnt => 0,
	shet => 1,
	typs => 2, # token types   These two are not used by subclassed,
	tokn => 3, # tokens        so there’s no chance of a conflict.
};
{ no strict; delete @{__PACKAGE__.'::'}{_const => keys %{our $_const}} }

sub new {
	my $self = bless[],shift;
	my $parent = shift || return $self;
	if($parent->isa('CSS::DOM::Rule')) {
		weaken($$self[shet] = $parent->parentStyleSheet);
		weaken($$self[prnt] = $parent);
	}
	else {
		weaken($$self[shet] = $parent)
	}
	$self;
}

sub type { UNKNOWN_RULE }

# This is used by cssText, both this class’s and subclasses’:
sub _parse { # This method parses the code passed to it and checks to see
             # whether the retval is the same class as  $self,  throwing
             # errors as appropriate.  It returns the new rule resulting
             # from the parse. Each subclass is responsible for extorting
             # the rule data from the new rule.
	my $self = shift;
	require CSS::DOM::Parser;
	my $new_rule  =  CSS::DOM::Parser'parse_statement(shift)
		|| die CSS::DOM::Exception->new(SYNTAX_ERR, $@);

	ref $new_rule eq ref $self or die CSS::DOM::Exception->new(
		INVALID_MODIFICATION_ERR,
		"The rule cannot be converted to a different type."
	);
	$new_rule;
};

sub cssText {
	my $self = shift;
	my $old;
	if(defined wantarray) {
		$old = join '', @{$self->[tokn]},;
		$old .= ';' unless $self->[typs] =~ /[;}]\z/;
		$old .= "\n";
	}
	if (@_) {
		my $new_rule  =  $self->_parse(shift);
		@$self[typs,tokn] = @$new_rule[typs,tokn];
	}
	$old;
};


sub parentStyleSheet { shift->[shet]||() }
sub parentRule       { shift->[prnt]||() }

sub _set_parentStyleSheet { weaken(shift->[shet] = pop) }
sub _set_parentRule       { weaken(shift->[prnt] = pop) }

sub _set_tokens { @{+shift}[typs,tokn] = @_[1,2]; }
  
                              !()__END__()!

=head1 NAME

CSS::DOM::Rule - CSS rule class for CSS::DOM

=head1 VERSION

Version 0.15

=head1 SYNOPSIS

  use CSS::DOM::Rule ':all'; # import constants

  use CSS::DOM;
  $sheet = new CSS::DOM;
  $sheet->insertRule('bla blah blah {}');
  $rule = $sheet->cssRules->[0];
  
  $rule->type; # STYLE_RULE
  $rule->cssText; # 'bla blah blah {}' or similar
  $rule->cssText('p { margin: 0 }'); # replace it
  $rule->parentStyleSheet; # $sheet

=head1 DESCRIPTION

This module provides the CSS rule class for L<CSS::DOM>. It implements
the CSSRule and CSSUnknownRule DOM interfaces.

=head1 METHODS

=head2 Constructor

Only call the constructor on this class to create an 'unknown' rule. You have to
call the constructor on a particular subclass to get another type. Normally
you do not need to 
call this directly anyway. (See L<CSS::DOM>'s 
C<parse> and C<insertRule> methods.) But just in case you do want to call 
it, here it
is:

  new CSS::DOM::Rule $parent; # unknown rule
  
  require CSS::DOM::Rule::Style
  new CSS::DOM::Rule::Style $parent;
  # etc.

C<$parent> is the parent rule, if the rule is nested, or the parent style
sheet otherwise.

=head2 Object Methods

=over 4

=item type

Returns one of the constants below indicating the type of rule.

=item cssText

Returns this rule's CSS code. If you pass an argument, it will be parsed as
the new CSS code for this rule (replacing the existing data), and the old
value will be returned. This method will die if the replacement CSS code
creates a different type of rule.

=item parentStyleSheet

This returns the style sheet to which the rule belongs.

=item parentRule

This returns the rule's parent rule, if there is one, or an empty list
otherwise. There is only a parent rule if this one is nested, e.g., inside
a media rule.

=back

=head1 EXPORTS

The following constants that indicate the type of rule will be exported on
request (individually or with the ':all' tag):

  UNKNOWN_RULE
  STYLE_RULE    
  CHARSET_RULE  
  IMPORT_RULE   
  MEDIA_RULE    
  FONT_FACE_RULE
  PAGE_RULE

=head1 SEE ALSO

L<CSS::DOM>

L<CSS::DOM::Rule::Style>

L<CSS::DOM::Rule::Media>

L<CSS::DOM::Rule::Page>

L<CSS::DOM::Rule::Import>