/usr/share/perl5/CSS/DOM/Value.pm is in libcss-dom-perl 0.17-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 | package CSS::DOM::Value;
$VERSION = '0.17';
use warnings; no warnings qw 'utf8 parenthesis';;
use strict;
use Carp;
use CSS::DOM::Constants;
use CSS'DOM'Exception 'NO_MODIFICATION_ALLOWED_ERR';
use Exporter 5.57 'import';
use Scalar'Util < weaken reftype >;
use constant 1.03 our $_const = {
type => 0,
valu => 1,
ownr => 2,
prop => 3,
};
{ no strict; delete @{__PACKAGE__.'::'}{_const => keys %{our $_const}} }
*EXPORT_OK = $CSS::DOM::Constants::EXPORT_TAGS{value};
our %EXPORT_TAGS = ( all => \our @EXPORT_OK );
sub new {
my $self = bless[], shift;
my %args = @_;
my $type = $self->[type] = $args{type};
$type == CSS_CUSTOM
? !exists $args{value} && croak
'new CSS::DOM::Value(type => CSS_CUSTOM) requires a value'
: $type == CSS_INHERIT
|| croak "Type must be CSS_CUSTOM or CSS_INHERIT";
@$self[valu,ownr,prop] = @args{< value owner property >};
weaken $$self[ownr];
$self;
}
sub cssValueType { shift->[type] }
sub cssText {
my $self = shift;
my $old = $self->[type] == CSS_CUSTOM
? $self->[valu] : 'inherit'
if defined wantarray;
if(@_) {
die new CSS'DOM'Exception
NO_MODIFICATION_ALLOWED_ERR,
"Unowned value objects cannot be modified"
unless my $owner = $self->[ownr];
die new CSS'DOM'Exception
NO_MODIFICATION_ALLOWED_ERR,
"CSS::DOM::Value objects that do not know to which "
."property they belong cannot be modified"
unless my $prop = $self->[prop];
if(
my @arsg
= $owner->property_parser->match($prop, $_[0])
) {
_apply_args_to_self($self,$owner,$prop,@arsg);
}
if(my $mh = $owner->modification_handler) {
&$mh();
}
}
$old
}
sub _apply_args_to_self {
my($self,$owner,$prop,@arsg) = @_;
_load_if_necessary($arsg[1]);
my $new = $arsg[1]->new(
owner => $owner, property => $prop, @arsg[2...$#arsg]
);
reftype $self eq "HASH"
? %$self = %$new
: (@$self = @$new);
bless $self, ref $new unless ref $new eq ref $self;
}
sub _load_if_necessary {
$_[0]->can('new')
|| do {
(my $pack = $_[0]) =~ s e::e/egg;
require "$pack.pm";
};
}
!()__END__()!
=head1 NAME
CSS::DOM::Value - CSSValue class for CSS::DOM
=head1 VERSION
Version 0.17
=head1 SYNOPSIS
# ...
=head1 DESCRIPTION
This module implements objects that represent CSS property values. It
implements the DOM CSSValue interface.
This class is used only for custom values (neither primitive values nor
lists) and the special 'inherit' value.
=head1 METHODS
=head2 Object Methods
=over 4
=item cssText
Returns a string representation of the attribute. Pass an argument to set
it.
=item cssValueType
Returns one of the constants below.
=back
=head2 Constructor
You probably don't need to call this, but here it is anyway:
$val = new CSS::DOM::Value %arguments;
The hash-style C<%arguments> are as follows:
=over
=item type
C<CSS_INHERIT> or C<CSS_CUSTOM>
=item css
A string of CSS code. This is
only used when C<TYPE> is C<CSS_CUSTOM>.
=item owner
The style object that owns this value; if this is omitted, then the value
is read-only. The value object holds a weak reference to the owner.
=item property
The name of the CSS property to which this value belongs. C<cssText> uses
this to determine how to parse text passed to it.
=back
=head1 CONSTANTS
The following constants can be imported with C<use CSS::DOM::Value ':all'>.
They represent the type of CSS value.
=over
=item CSS_INHERIT (0)
=item CSS_PRIMITIVE_VALUE (1)
=item CSS_VALUE_LIST (2)
=item CSS_CUSTOM (3)
=back
=head1 SEE ALSO
L<CSS::DOM>
L<CSS::DOM::Value::Primitive>
L<CSS::DOM::Value::List>
L<CSS::DOM::Style>
|