/usr/share/perl5/CSS/Parse/Lite.pm is in libcss-perl 1.09-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 | package CSS::Parse::Lite;
$VERSION = 1.02;
use CSS::Parse;
@ISA = qw(CSS::Parse);
use strict;
use warnings;
use Carp;
use CSS::Style;
use CSS::Selector;
use CSS::Property;
# The main parser
sub parse_string {
my $self = shift;
my $string = shift;
$string =~ s/\r\n|\r|\n/ /g;
# Split into styles
foreach ( grep { /\S/ } split /(?<=\})/, $string ) {
unless ( /^\s*([^{]+?)\s*\{(.*)\}\s*$/ ) {
croak( "Invalid or unexpected style data '$_'" );
}
$self->add_style($1, $2);
}
}
# add a style to the style list
sub add_style {
my $self = shift;
my $style = shift;
my $contents = shift;
my $style_obj = new CSS::Style({
'adaptor' => $self->{parent}->{adaptor}
});
# parse the selectors
for(split(/\s*,\s*/, $style)){
my $selector_obj = new CSS::Selector({'name' => $_});
$style_obj->add_selector($selector_obj);
}
# parse the properties
foreach ( grep { /\S/ } split /\;/, $contents ) {
unless ( /^\s*([\w._-]+)\s*:\s*(.*?)\s*$/ ) {
croak( "Invalid or unexpected property '$_' in style '$style'" );
}
my $property_obj = new CSS::Property({
'property' => $1,
'value' => $2,
'adaptor' => $style_obj->{adaptor},
});
$style_obj->add_property($property_obj);
}
push @{$self->{parent}->{styles}}, $style_obj;
}
1;
__END__
=head1 NAME
CSS::Parse::Lite - A CSS::Parse module using regular expressions
=head1 SYNOPSIS
use CSS;
# Create a css stylesheet
my $CSS = CSS->new({'parser' => 'CSS::Parse::Lite'});
=head1 DESCRIPTION
This module is a parser for CSS.pm. Read the CSS.pm pod for more details
=head1 AUTHOR
Copyright (C) 2003-2004, Cal Henderson <cal@iamcal.com>
=head1 SEE ALSO
L<CSS>, http://www.w3.org/TR/REC-CSS1
=cut
|