| 1 | package CXC::Gnuplot::V1::Types; | ||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use v5.38; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use experimental 'builtin'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||
| 6 | 3 | our $VERSION = 'v0.29.3'; | |||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use Type::Utils -all; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 9 | use Type::Library | ||||||||||||||||||||||||||||||||||
| 10 | 3 | -extends => [ 'Types::Standard', 'Types::Common::Numeric', 'Types::Common::String', ], | |||||||||||||||||||||||||||||||||
| 11 | -declare => qw( | ||||||||||||||||||||||||||||||||||
| 12 | ColorSpec | ||||||||||||||||||||||||||||||||||
| 13 | CoordOffset2D | ||||||||||||||||||||||||||||||||||
| 14 | CoordOffset3D | ||||||||||||||||||||||||||||||||||
| 15 | CoordPosition2D | ||||||||||||||||||||||||||||||||||
| 16 | CoordPosition3D | ||||||||||||||||||||||||||||||||||
| 17 | CoordSys | ||||||||||||||||||||||||||||||||||
| 18 | CoordValue | ||||||||||||||||||||||||||||||||||
| 19 | Coords | ||||||||||||||||||||||||||||||||||
| 20 | FormatCoordSys | ||||||||||||||||||||||||||||||||||
| 21 | Fraction | ||||||||||||||||||||||||||||||||||
| 22 | LiteralDataValue | ||||||||||||||||||||||||||||||||||
| 23 | MultiPlotLayout | ||||||||||||||||||||||||||||||||||
| 24 | Palette | ||||||||||||||||||||||||||||||||||
| 25 | Range | ||||||||||||||||||||||||||||||||||
| 26 | RGBColor | ||||||||||||||||||||||||||||||||||
| 27 | SetFormats | ||||||||||||||||||||||||||||||||||
| 28 | TicEntry | ||||||||||||||||||||||||||||||||||
| 29 | TicEntries | ||||||||||||||||||||||||||||||||||
| 30 | AddTicEntries | ||||||||||||||||||||||||||||||||||
| 31 | TicIncr | ||||||||||||||||||||||||||||||||||
| 32 | TicList | ||||||||||||||||||||||||||||||||||
| 33 | TicPosition | ||||||||||||||||||||||||||||||||||
| 34 | TicSeries | ||||||||||||||||||||||||||||||||||
| 35 | TicTimeIncr | ||||||||||||||||||||||||||||||||||
| 36 | TicTimeUnits | ||||||||||||||||||||||||||||||||||
| 37 | 3 | ▶ | ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||
| 39 | 3 | ▶ | use Type::Params 'signature_for'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||
| 41 | 3 | use Exporter::Shiny qw( | |||||||||||||||||||||||||||||||||
| 42 | COORDSYS | ||||||||||||||||||||||||||||||||||
| 43 | FORMAT_COORD_SYS | ||||||||||||||||||||||||||||||||||
| 44 | signature_for | ||||||||||||||||||||||||||||||||||
| 45 | 3 | ▶ | ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||
| 48 | 3 | ▶ | use Types::Common::Numeric 'is_PositiveInt'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||
| 50 | ## no critic (CodeLayout::ProhibitQuotedWordLists) | ||||||||||||||||||||||||||||||||||
| 51 | 3 | ▶ | use constant COORDSYS => ( 'first', 'second', 'polar', 'graph', 'screen', 'character', 'char' ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 52 | 3 | ▶ | use constant FORMAT_COORD_SYS => ( 'numeric', 'timedate', 'geographic' ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||
| 54 | 3 | declare CoordSys, as Enum [COORDSYS]; | |||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||
| 56 | # this is silly. would prefer to truly validate the date, but | ||||||||||||||||||||||||||||||||||
| 57 | # that's difficult without providing a format. | ||||||||||||||||||||||||||||||||||
| 58 | 3 | ▶ | use constant Date => NonEmptyStr; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||
| 60 | 3 | declare LiteralDataValue, as InstanceOf ['CXC::Gnuplot::V1::LiteralDataValue']; | |||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||
| 62 | coerce LiteralDataValue, | ||||||||||||||||||||||||||||||||||
| 63 | from Any, via { | ||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | require CXC::Gnuplot::V1::LiteralDataValue; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 65 | 0 | CXC::Gnuplot::V1::LiteralDataValue->new( value => $_[0] ); | |||||||||||||||||||||||||||||||||
| 66 | 3 | }; | |||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||
| 68 | 3 | declare CoordValue, as InstanceOf ['CXC::Gnuplot::V1::CoordValue']; | |||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||
| 70 | coerce CoordValue, from HashRef, via { | ||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | require CXC::Gnuplot::V1::CoordValue; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 72 | 0 | CXC::Gnuplot::V1::CoordValue->new( $_[0]->%* ); | |||||||||||||||||||||||||||||||||
| 73 | 3 | }; | |||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||
| 75 | coerce CoordValue, from Value, via { | ||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | require CXC::Gnuplot::V1::CoordValue; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 77 | 0 | CXC::Gnuplot::V1::CoordValue->new( value => $_[0] ); | |||||||||||||||||||||||||||||||||
| 78 | 3 | }; | |||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||
| 80 | coerce CoordValue, from ArrayRef, via { | ||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | require CXC::Gnuplot::V1::CoordValue; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 82 | 0 | CXC::Gnuplot::V1::CoordValue->new( coordsys => $_[0][0], value => $_[0][1] ); | |||||||||||||||||||||||||||||||||
| 83 | 3 | }; | |||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||
| 85 | 3 | declare FormatCoordSys, as Enum [FORMAT_COORD_SYS]; | |||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||
| 87 | 3 | declare CoordOffset3D, as InstanceOf ['CXC::Gnuplot::V1::CoordOffset3D']; | |||||||||||||||||||||||||||||||||
| 88 | coerce CoordOffset3D, from HashRef, via { | ||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | require CXC::Gnuplot::V1::CoordOffset3D; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 90 | 0 | CXC::Gnuplot::V1::CoordOffset3D->new( $_[0]->%* ); | |||||||||||||||||||||||||||||||||
| 91 | 3 | }; | |||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||
| 93 | 3 | declare CoordOffset2D, as InstanceOf ['CXC::Gnuplot::V1::CoordOffset2D']; | |||||||||||||||||||||||||||||||||
| 94 | coerce CoordOffset2D, from HashRef, via { | ||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | require CXC::Gnuplot::V1::CoordOffset2D; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 96 | 0 | CXC::Gnuplot::V1::CoordOffset2D->new( $_[0]->%* ); | |||||||||||||||||||||||||||||||||
| 97 | 3 | }; | |||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||
| 99 | 3 | declare CoordPosition3D, as InstanceOf ['CXC::Gnuplot::V1::CoordPosition3D']; | |||||||||||||||||||||||||||||||||
| 100 | coerce CoordPosition3D, from HashRef, via { | ||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | require CXC::Gnuplot::V1::CoordPosition3D; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 102 | 0 | CXC::Gnuplot::V1::CoordPosition3D->new( $_[0]->%* ); | |||||||||||||||||||||||||||||||||
| 103 | 3 | }; | |||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||
| 105 | 3 | declare CoordPosition2D, as InstanceOf ['CXC::Gnuplot::V1::CoordPosition2D']; | |||||||||||||||||||||||||||||||||
| 106 | coerce CoordPosition2D, from HashRef, via { | ||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | require CXC::Gnuplot::V1::CoordPosition2D; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 108 | 0 | CXC::Gnuplot::V1::CoordPosition2D->new( $_[0]->%* ); | |||||||||||||||||||||||||||||||||
| 109 | 3 | }; | |||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||
| 112 | 3 | declare TicTimeUnits, as Enum [qw( seconds minutes hours days weeks months years )]; | |||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||
| 114 | 3 | declare TicTimeIncr, as Dict [ multiple => PositiveNum, unit => TicTimeUnits ]; | |||||||||||||||||||||||||||||||||
| 115 | coerce TicTimeIncr, | ||||||||||||||||||||||||||||||||||
| 116 | from Tuple [ PositiveNum, TicTimeUnits ], | ||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | sub { my %incr; @incr{ 'multiple', 'unit' } = $_[0]->@*; return \%incr; }; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=3.5
| |||||||||||||||||||||||||||||||||||
| 118 | 3 | declare TicIncr, as Num | TicTimeIncr, coercion => 1; | |||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||
| 120 | 3 | declare TicPosition, as LiteralDataValue, coercion => 1; | |||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||
| 122 | 3 | declare TicEntry, as # | |||||||||||||||||||||||||||||||||
| 123 | Dict [ | ||||||||||||||||||||||||||||||||||
| 124 | pos => TicPosition, | ||||||||||||||||||||||||||||||||||
| 125 | label => Optional [Str], | ||||||||||||||||||||||||||||||||||
| 126 | level => Optional [PositiveOrZeroInt], | ||||||||||||||||||||||||||||||||||
| 127 | ], | ||||||||||||||||||||||||||||||||||
| 128 | coercion => 1; | ||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | coerce TicEntry, from Num, via { { pos => TicPosition->coerce( $_[0] ) } }; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||
| 131 | coerce TicEntry, from HashRef, via { | ||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | my %entry = $_[0]->%*; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | $entry{pos} = TicPosition->coerce( $entry{pos} ) if exists $entry{pos}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 134 | 0 | \%entry; | |||||||||||||||||||||||||||||||||
| 135 | 3 | }; | |||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||
| 137 | 3 | declare TicEntries, as ArrayRef [TicEntry], coercion => 1; | |||||||||||||||||||||||||||||||||
| 138 | coerce TicEntries, from TicEntry->coercibles, via { | ||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | [ to_TicEntry( $_[0] ) ] | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 140 | 3 | }; | |||||||||||||||||||||||||||||||||
| 141 | coerce TicEntries, from ArrayRef, via { | ||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | [ map { to_TicEntry( $_ ) } $_[0]->@* ] | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 143 | 3 | }; | |||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||
| 145 | 3 | declare TicSeries, as # | |||||||||||||||||||||||||||||||||
| 146 | Dict [ | ||||||||||||||||||||||||||||||||||
| 147 | start => Optional [TicPosition], | ||||||||||||||||||||||||||||||||||
| 148 | incr => TicIncr, | ||||||||||||||||||||||||||||||||||
| 149 | end => Optional [TicPosition], | ||||||||||||||||||||||||||||||||||
| 150 | ], | ||||||||||||||||||||||||||||||||||
| 151 | coercion => 1; | ||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||
| 153 | 3 | coerce TicSeries, from TicIncr, q{ { incr => $_[0] } }; | |||||||||||||||||||||||||||||||||
| 154 | coerce TicSeries, from HashRef, via { | ||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | my %series = $_[0]->%*; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | $series{start} = TicPosition->coerce( $series{start} ) if exists $series{start}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | $series{end} = TicPosition->coerce( $series{end} ) if exists $series{end}; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 158 | 0 | \%series; | |||||||||||||||||||||||||||||||||
| 159 | 3 | }; | |||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||
| 161 | 3 | declare AddTicEntries, as Tuple->of( Enum ['add'], Slurpy->of( TicEntries ) ), coercion => 1; | |||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||
| 163 | 3 | declare TicList, as TicEntries | AddTicEntries; | |||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||
| 165 | coerce TicList, from Any, via { | ||||||||||||||||||||||||||||||||||
| 166 | 0 | eval { TicEntries->assert_coerce( $_[0] ) } | |||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | // eval { AddTicEntries->assert_coerce( $_[0] ) } | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Condition0%0/6
(eval {
do {
&TicEntries()->assert_coerce($_[0])
}
} // eval {
do {
&AddTicEntries()->assert_coerce($_[0])
}
}) // $_[0]
eval {
do {
&TicEntries()->assert_coerce($_[0])
}
} // eval {
do {
&AddTicEntries()->assert_coerce($_[0])
}
}
MC/DC0%0/3
(eval {
do {
&TicEntries()->assert_coerce($_[0])
}
} // eval {
do {
&AddTicEntries()->assert_coerce($_[0])
}
}) // $_[0]
eval {
do {
&TicEntries()->assert_coerce($_[0])
}
}
eval {
do {
&AddTicEntries()->assert_coerce($_[0])
}
}
$_[0]
Truth table0%0/4
A // B // C
A= eval {
do {
&TicEntries()->assert_coerce($_[0])
}
}B= eval {
do {
&AddTicEntries()->assert_coerce($_[0])
}
}C= $_[0]
| |||||||||||||||||||||||||||||||||||
| 168 | // $_[0] | ||||||||||||||||||||||||||||||||||
| 169 | 3 | }; | |||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||
| 171 | declare MultiPlotLayout, as Dict( [ nrows => PositiveInt, ncols => PositiveInt ] ), message { | ||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | require Data::Dump; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||
| 173 | 0 | my $value = Data::Dump::pp( $_ ); | |||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | is_ArrayRef( $_ ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 175 | and return "$value is not an array of two positive integers"; | ||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | is_NonEmptyStr( $_ ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 178 | and return "$value is not a string of form <PositiveInt,PositiveInt>"; | ||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | is_HashRef( $_ ) | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 181 | and return "$value is not a hashref with keys 'nrows' and 'ncols'"; | ||||||||||||||||||||||||||||||||||
| 182 | 3 | }; | |||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||
| 184 | 3 | coerce MultiPlotLayout, | |||||||||||||||||||||||||||||||||
| 185 | ArrayRef [ PositiveInt, 2, 2 ], q{ { nrows => $_[0][0], ncols => $_[0][1] } }, # | ||||||||||||||||||||||||||||||||||
| 186 | NonEmptyStr, <<~'EOS' | ||||||||||||||||||||||||||||||||||
| 187 | do { | ||||||||||||||||||||||||||||||||||
| 188 | use experimental 'builtin'; | ||||||||||||||||||||||||||||||||||
| 189 | BEGIN{ builtin::export_lexically is_PositiveInt => \&Types::Common::Numeric::is_PositiveInt }; | ||||||||||||||||||||||||||||||||||
| 190 | my ( $nrows, $ncols, $extra ) = split( qr/,/, $_[0] ); | ||||||||||||||||||||||||||||||||||
| 191 | defined $extra || !( is_PositiveInt( $nrows ) && is_PositiveInt( $ncols ) ) | ||||||||||||||||||||||||||||||||||
| 192 | ? $_[0] | ||||||||||||||||||||||||||||||||||
| 193 | : { nrows => $nrows, ncols => $ncols }; | ||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||
| 195 | EOS | ||||||||||||||||||||||||||||||||||
| 196 | ; | ||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||
| 198 | my $PerlBool = Type::Tiny->new( | ||||||||||||||||||||||||||||||||||
| 199 | name => 'PerlBool', | ||||||||||||||||||||||||||||||||||
| 200 | constraint => sub { | ||||||||||||||||||||||||||||||||||
| 201 | 3 | ▶ | use builtin 'is_bool'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | is_bool( $_ ); | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 203 | 3 | } ); | |||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||
| 205 | 3 | __PACKAGE__->add_type( $PerlBool ); | |||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||
| 207 | __PACKAGE__->add_type( | ||||||||||||||||||||||||||||||||||
| 208 | Type::Tiny->new( | ||||||||||||||||||||||||||||||||||
| 209 | name => 'PerlBoolFalse', | ||||||||||||||||||||||||||||||||||
| 210 | parent => $PerlBool, | ||||||||||||||||||||||||||||||||||
| 211 | constraint => sub { | ||||||||||||||||||||||||||||||||||
| 212 | 3 | ▶ | use builtin 'false'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | $_ == false; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 214 | 3 | } ) ); | |||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||
| 216 | 3 | declare Fraction, as NumRange [ 0, 1, 1, 1 ]; | |||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||
| 218 | # rgbcolor "0xRRGGBB" # string containing hexadecimal constant | ||||||||||||||||||||||||||||||||||
| 219 | # rgbcolor "0xAARRGGBB" # string containing hexadecimal constant | ||||||||||||||||||||||||||||||||||
| 220 | # rgbcolor "#RRGGBB" # string containing hexadecimal in x11 format | ||||||||||||||||||||||||||||||||||
| 221 | # rgbcolor "#AARRGGBB" | ||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||
| 223 | 3 | declare RGBColor, as StrMatch [ | |||||||||||||||||||||||||||||||||
| 224 | qr{^ | ||||||||||||||||||||||||||||||||||
| 225 | (?:[0][xX]|[#]) | ||||||||||||||||||||||||||||||||||
| 226 | (?:[\da-hA-H]{2}){3,4} | ||||||||||||||||||||||||||||||||||
| 227 | $}x, | ||||||||||||||||||||||||||||||||||
| 228 | ]; | ||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||
| 230 | 3 | declare ColorSpec, | |||||||||||||||||||||||||||||||||
| 231 | as RGBColor | Dict [ rgbcolor => RGBColor ] | Dict [ palette => Dict [ frac => Fraction ] ]; | ||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||
| 233 | 3 | declare Range, as InstanceOf ['CXC::Gnuplot::V1::Range']; | |||||||||||||||||||||||||||||||||
| 234 | coerce Range, from HashRef, via { | ||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | require CXC::Gnuplot::V1::Range; | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 236 | 0 | CXC::Gnuplot::V1::Range->new( $_[0]->%* ); | |||||||||||||||||||||||||||||||||
| 237 | 3 | }; | |||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||
| 239 | 3 | declare Palette, as Enum( ['z'] ) | Dict [ frac => Fraction ] | Dict [ cb => Range ], coercion => 1; | |||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||
| 241 | 3 | declare SetFormats, as Enum [ 'array', 'flat_array', 'string' ]; | |||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||
| 243 | # | ||||||||||||||||||||||||||||||||||
| 244 | # This file is part of CXC-Gnuplot | ||||||||||||||||||||||||||||||||||
| 245 | # | ||||||||||||||||||||||||||||||||||
| 246 | # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory. | ||||||||||||||||||||||||||||||||||
| 247 | # | ||||||||||||||||||||||||||||||||||
| 248 | # This is free software, licensed under: | ||||||||||||||||||||||||||||||||||
| 249 | # | ||||||||||||||||||||||||||||||||||
| 250 | # The GNU General Public License, Version 3, June 2007 | ||||||||||||||||||||||||||||||||||
| 251 | # | ||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||
| 253 | __END__ | ||||||||||||||||||||||||||||||||||