line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::AutoColor;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1122
|
use 5.006;
|
|
2
|
|
|
|
|
5
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict;
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
31
|
|
5
|
2
|
|
|
2
|
|
6
|
use warnings;
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
68
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
836
|
use Graphics::ColorNames 0.32;
|
|
2
|
|
|
|
|
10725
|
|
|
2
|
|
|
|
|
3988
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.04';
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $Colors;
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub import {
|
14
|
2
|
|
|
2
|
|
17
|
my $class = shift;
|
15
|
|
|
|
|
|
|
# TODO: parse version numbers
|
16
|
2
|
|
|
|
|
7
|
$Colors = Graphics::ColorNames->new(@_);
|
17
|
|
|
|
|
|
|
}
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package main;
|
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
12
|
use Carp qw( croak );
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
70
|
|
22
|
2
|
|
|
2
|
|
11
|
use Graphics::ColorNames qw( hex2tuple );
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
304
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $AUTOLOAD;
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub AUTOLOAD {
|
27
|
8
|
|
|
8
|
|
7772
|
my $class = shift;
|
28
|
8
|
|
|
|
|
38
|
$AUTOLOAD =~ /.*::(\w+)/;
|
29
|
|
|
|
|
|
|
|
30
|
8
|
|
|
|
|
14
|
my $cname = $1;
|
31
|
|
|
|
|
|
|
|
32
|
8
|
100
|
|
|
|
22
|
if($cname eq "OCTARINE") {
|
33
|
|
|
|
|
|
|
# Discworlds eigth color. Can't display it yet,
|
34
|
|
|
|
|
|
|
# but as far as we know, R, G and B are zero,
|
35
|
|
|
|
|
|
|
# and O is 255
|
36
|
2
|
100
|
|
|
|
4
|
if(wantarray) {
|
37
|
1
|
|
|
|
|
3
|
return(0,0,0,255);
|
38
|
|
|
|
|
|
|
} else {
|
39
|
1
|
|
|
|
|
6
|
return "000000ff";
|
40
|
|
|
|
|
|
|
}
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
|
43
|
6
|
|
|
|
|
14
|
my $value = $Acme::AutoColor::Colors->hex($1);
|
44
|
6
|
50
|
|
|
|
151
|
if (defined $value) {
|
45
|
6
|
100
|
|
|
|
21
|
return wantarray ? hex2tuple($value) : $value;
|
46
|
|
|
|
|
|
|
} else {
|
47
|
0
|
|
|
|
|
|
croak "Unknown method: $cname";
|
48
|
|
|
|
|
|
|
}
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1;
|
52
|
|
|
|
|
|
|
__END__
|