| 1 | package CSS::Struct::Output; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 21 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 21 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 21 | ▶ | use Class::Utils qw(set_params); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 21 | ▶ | use Error::Pure qw(err); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 21 | ▶ | use List::MoreUtils qw(none); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 21 | our $VERSION = 0.03; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | # Constructor. | ||||||||||||||||||||||||||||||||||||||||||
| 13 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 39 | ▶ | my ($class, @params) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # Create object. | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 39 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | # Get default parameters. | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 39 | $self->_default_parameters; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | # Process params. | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 39 | set_params($self, @params); | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | # Check parameters to right values. | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 36 | $self->_check_params; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | # Reset. | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 26 | $self->reset; | |||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | # Object. | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 26 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | # Flush CSS structure in object. | ||||||||||||||||||||||||||||||||||||||||||
| 36 | sub flush { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 41 | ▶ | my ($self, $reset_flag) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flush: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 41 | my $ouf = $self->{'output_handler'}; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 41 | my $ret; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 41 | ▶ | if (ref $self->{'flush_code'} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 9 | $ret = join $self->{'output_sep'}, @{$self->{'flush_code'}}; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 32 | $ret = $self->{'flush_code'}; | |||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 41 | ▶ | if ($ouf) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 21 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 6 | ▶ | print {$ouf} $ret or err 'Cannot write to output handler.'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 4 | undef $ret; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | # Reset. | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 39 | ▶ | if ($reset_flag) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 2 | $self->reset; | |||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | # Return string. | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 39 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | # Put CSS structure code. | ||||||||||||||||||||||||||||||||||||||||||
| 61 | sub put { | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 50 | ▶ | my ($self, @data) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put: called CC=12 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | # For every data. | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 50 | foreach my $css_structure_ar (@data) { | |||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | # Bad data. | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 135 | ▶ | if (ref $css_structure_ar ne 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | err 'Bad data.'; | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | # Split to type and main CSS structure. | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 133 | my ($type, @css_struct) = @{$css_structure_ar}; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | # Attributes. | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 133 | ▶ | if ($type eq 'a') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | $self->_check_arguments(\@css_struct, 1, 2); | |||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | $self->_put_at_rules(@css_struct); | |||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | # Comment. | ||||||||||||||||||||||||||||||||||||||||||
| 81 | } elsif ($type eq 'c') { | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 20 | $self->_put_comment(@css_struct); | |||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | # Definition. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | } elsif ($type eq 'd') { | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 24 | $self->_check_arguments(\@css_struct, 1, 2); | |||||||||||||||||||||||||||||||||||||||||
| 87 | 24 | $self->_put_definition(@css_struct); | |||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | # End of selector. | ||||||||||||||||||||||||||||||||||||||||||
| 90 | } elsif ($type eq 'e') { | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 35 | $self->_check_arguments(\@css_struct, 0, 0); | |||||||||||||||||||||||||||||||||||||||||
| 92 | 35 | $self->_put_end_of_selector; | |||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | # Instruction. | ||||||||||||||||||||||||||||||||||||||||||
| 95 | } elsif ($type eq 'i') { | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 3 | $self->_check_arguments(\@css_struct, 1, 2); | |||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | $self->_put_instruction(@css_struct); | |||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | # Raw data. | ||||||||||||||||||||||||||||||||||||||||||
| 100 | } elsif ($type eq 'r') { | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | $self->_put_raw(@css_struct); | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | # Selector. | ||||||||||||||||||||||||||||||||||||||||||
| 104 | } elsif ($type eq 's') { | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 43 | $self->_check_arguments(\@css_struct, 1, 1); | |||||||||||||||||||||||||||||||||||||||||
| 106 | 39 | $self->_put_selector(@css_struct); | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | # Other. | ||||||||||||||||||||||||||||||||||||||||||
| 109 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 4 | ▶ | if (! $self->{'skip_bad_types'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 2 | err 'Bad type of data.', 'type', $type; | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | # Auto-flush. | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 41 | ▶ | if ($self->{'auto_flush'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | $self->flush; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | $self->_reset_flush_code; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 41 | return; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | # Resets internal variables. | ||||||||||||||||||||||||||||||||||||||||||
| 127 | sub reset { | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 46 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | # Tmp code. | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 46 | $self->{'tmp_code'} = []; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | # Flush code. | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 46 | $self->_reset_flush_code; | |||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | # Open selector flag. | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 46 | $self->{'open_selector'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 46 | return; | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | # Check arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 143 | sub _check_arguments { | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 107 | ▶ | my ($self, $css_structure_ar, $min_arg_num, $max_arg_num) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_arguments: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 107 | my $arg_num = scalar @{$css_structure_ar}; | |||||||||||||||||||||||||||||||||||||||||
| 146 | 107 | ▶ | if ($arg_num < $min_arg_num || $arg_num > $max_arg_num) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$arg_num < $min_arg_num or $arg_num > $max_arg_num
MC/DC100%2/2
$arg_num < $min_arg_num or $arg_num > $max_arg_num
$arg_num < $min_arg_num
$arg_num > $max_arg_num
Truth table100%3/3
A or B
A= $arg_num < $min_arg_numB= $arg_num > $max_arg_num
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | err 'Bad number of arguments.', | ||||||||||||||||||||||||||||||||||||||||||
| 148 | '\'CSS::Struct\' structure', | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 4 | join ', ', @{$css_structure_ar}; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 103 | return; | |||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | # Check to opened selector. | ||||||||||||||||||||||||||||||||||||||||||
| 155 | sub _check_opened_selector { | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 43 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_opened_selector: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 43 | ▶ | if (! $self->{'open_selector'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | err 'No opened selector.'; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 42 | return; | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | # Default parameters. | ||||||||||||||||||||||||||||||||||||||||||
| 164 | sub _default_parameters { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 39 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_default_parameters: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | # Auto flush flag. | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 39 | $self->{'auto_flush'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | # CSS comment delimeters. | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 39 | $self->{'comment_delimeters'} = [q{/*}, q{*/}]; | |||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | # Set output handler. | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 39 | $self->{'output_handler'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | # Output separator. | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 39 | $self->{'output_sep'} = "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | # Skip bad 'CSS::Struct' types. | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 39 | $self->{'skip_bad_types'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | # Skip comments. | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 39 | $self->{'skip_comments'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 39 | return; | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | # Check parameters to rigth values. | ||||||||||||||||||||||||||||||||||||||||||
| 189 | sub _check_params { | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 36 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_params: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | # Check to output handler. | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 36 | ▶ | if (defined $self->{'output_handler'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->{"output_handler"} and ref $self->{"output_handler"} ne "GLOB"
MC/DC100%2/2
defined $self->{"output_handler"} and ref $self->{"output_handler"} ne "GLOB"
defined $self->{"output_handler"}
ref $self->{"output_handler"} ne "GLOB"
Truth table100%3/3
A and B
A= defined $self->{"output_handler"}B= ref $self->{"output_handler"} ne "GLOB"
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | && ref $self->{'output_handler'} ne 'GLOB') { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 2 | err 'Output handler is bad file handler.'; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | # Check auto-flush only with output handler. | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 34 | ▶ | if ($self->{'auto_flush'} && ! defined $self->{'output_handler'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"auto_flush"} and not defined $self->{"output_handler"}
MC/DC100%2/2
$self->{"auto_flush"} and not defined $self->{"output_handler"}
$self->{"auto_flush"}
not defined $self->{"output_handler"}
Truth table100%3/3
A and not(B)
A= $self->{"auto_flush"}B= not defined $self->{"output_handler"}
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 2 | err 'Auto-flush can\'t use without output handler.'; | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | # Check to comment delimeters. | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 32 | ▶ | if (ref $self->{'comment_delimeters'} ne 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
ref $self->{"comment_delimeters"} ne "ARRAY" or &none(sub {
$_ eq $self->{"comment_delimeters"}[0];
}
, "/*", "<!--") or &none(sub {
$_ eq $self->{"comment_delimeters"}[1];
}
, "*/", "-->")
ref $self->{"comment_delimeters"} ne "ARRAY" or &none(sub {
$_ eq $self->{"comment_delimeters"}[0];
}
, "/*", "<!--")
MC/DC100%3/3
ref $self->{"comment_delimeters"} ne "ARRAY" or &none(sub {
$_ eq $self->{"comment_delimeters"}[0];
}
, "/*", "<!--") or &none(sub {
$_ eq $self->{"comment_delimeters"}[1];
}
, "*/", "-->")
ref $self->{"comment_delimeters"} ne "ARRAY"
&none(sub {
$_ eq $self->{"comment_delimeters"}[0];
}
, "/*", "<!--")
&none(sub {
$_ eq $self->{"comment_delimeters"}[1];
}
, "*/", "-->")
Truth table100%4/4
A or B or C
A= ref $self->{"comment_delimeters"} ne "ARRAY"B= &none(sub {
$_ eq $self->{"comment_delimeters"}[0];
}
, "/*", "<!--")C= &none(sub {
$_ eq $self->{"comment_delimeters"}[1];
}
, "*/", "-->")
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 32 | ▶ | || (none { $_ eq $self->{'comment_delimeters'}->[0] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | (q{/*}, '<!--')) | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 30 | ▶ | || (none { $_ eq $self->{'comment_delimeters'}->[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | (q{*/}, '-->'))) { | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 6 | err 'Bad comment delimeters.'; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 26 | return; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | # At-rules. | ||||||||||||||||||||||||||||||||||||||||||
| 217 | sub _put_at_rules { | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 1 | ▶ | my ($self, $at_rule, $file) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_put_at_rules: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 1 | push @{$self->{'flush_code'}}, 'At-rule'; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | # Comment. | ||||||||||||||||||||||||||||||||||||||||||
| 224 | sub _put_comment { | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | ▶ | my ($self, @comments) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_put_comment: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 1 | push @{$self->{'flush_code'}}, 'Comment'; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | # Definition. | ||||||||||||||||||||||||||||||||||||||||||
| 231 | sub _put_definition { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 8 | ▶ | my ($self, $key, $value) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_put_definition: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 8 | push @{$self->{'flush_code'}}, 'Definition'; | |||||||||||||||||||||||||||||||||||||||||
| 234 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | # End of selector. | ||||||||||||||||||||||||||||||||||||||||||
| 238 | sub _put_end_of_selector { | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 8 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_put_end_of_selector: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 8 | push @{$self->{'flush_code'}}, 'End of selector'; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | # Instruction. | ||||||||||||||||||||||||||||||||||||||||||
| 245 | sub _put_instruction { | ||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | ▶ | my ($self, $target, $code) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_put_instruction: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | push @{$self->{'flush_code'}}, 'Instruction'; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | # Raw data. | ||||||||||||||||||||||||||||||||||||||||||
| 252 | sub _put_raw { | ||||||||||||||||||||||||||||||||||||||||||
| 253 | 1 | ▶ | my ($self, @raw_data) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_put_raw: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 1 | push @{$self->{'flush_code'}}, 'Raw data'; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | # Selectors. | ||||||||||||||||||||||||||||||||||||||||||
| 259 | sub _put_selector { | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 8 | ▶ | my ($self, $selector) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_put_selector: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 8 | push @{$self->{'flush_code'}}, 'Selector'; | |||||||||||||||||||||||||||||||||||||||||
| 262 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | # Reset flush code. | ||||||||||||||||||||||||||||||||||||||||||
| 266 | sub _reset_flush_code { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 12 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reset_flush_code: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 12 | $self->{'flush_code'} = []; | |||||||||||||||||||||||||||||||||||||||||
| 269 | 12 | return; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 21 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | __END__ | ||||||||||||||||||||||||||||||||||||||||||