my $pod = readline *DATA;
$pod =~ s/^=over\K/ 25/; # indent options list
$pod =~ s/^=item\ \N*\n\n\N*\n\K (?:(?:^=over.*?^=back\n)?(?!=)\N*\n)*/\n/g;
my $pod = readline *DATA;
$pod =~ s/^=over\K/ 25/; # indent options list
$pod =~ s/^=item\ \N*\n\n\N*\n\K (?:(?:^=over.*?^=back\n)?(?!=)\N*\n)*/\n/g;
$opt{markers} //= '=avg >31.73v <68.27v +50v |0';
$opt{palette} //= $opt{color} && [31, 90, 32];
$opt{hidemin} = ($opt{hidemin} || 1) - 1;
$opt{markers} //= '=avg >31.73v <68.27v +50v |0';
$opt{palette} //= $opt{color} && [31, 90, 32];
$opt{hidemin} = ($opt{hidemin} || 1) - 1;
and undef $opt{interval};
my (@lines, @values, @order);
and undef $opt{interval};
my (@lines, @values, @order);
while (defined ($_ = $opt{input} ? shift @{ $opt{input} } : readline)) {
s/\r?\n\z//;
s/\A\h*// unless $opt{unmodified};
while (defined ($_ = $opt{input} ? shift @{ $opt{input} } : readline)) {
s/\r?\n\z//;
s/\A\h*// unless $opt{unmodified};
- push @values, s/$valmatch/\n/ && $1;
- push @order, $1 if length $1;
- if (defined $opt{trim} and defined $1) {
+ my $valnum = s/$valmatch/\n/ && $1;
+ push @values, $valnum;
+ push @order, $valnum if length $valnum;
+ if (defined $opt{trim} and defined $valnum) {
sub sival {
my $unit = int(log(abs $_[0] || 1) / log(10) - 3*($_[0] < 1) + 1e-15);
my $float = $_[0] !~ /\A0*[-0-9]{1,3}\z/;
sub sival {
my $unit = int(log(abs $_[0] || 1) / log(10) - 3*($_[0] < 1) + 1e-15);
my $float = $_[0] !~ /\A0*[-0-9]{1,3}\z/;
$float && ($unit % 3) == ($unit < 0), # tenths
$_[0] / 1000 ** int($unit/3), # number
$#{$opt{units}} * 1.5 < abs $unit ? "e$unit" : $opt{units}->[$unit/3]
$float && ($unit % 3) == ($unit < 0), # tenths
$_[0] / 1000 ** int($unit/3), # number
$#{$opt{units}} * 1.5 < abs $unit ? "e$unit" : $opt{units}->[$unit/3]
my $len = defined $opt{trim} && $opt{trim} <= 0 ? -$opt{trim} + 1 :
max map { length $values[$_] && length $lines[$_] }
0 .. min $#lines, $opt{hidemax} || (); # left padding
my $len = defined $opt{trim} && $opt{trim} <= 0 ? -$opt{trim} + 1 :
max map { length $values[$_] && length $lines[$_] }
0 .. min $#lines, $opt{hidemax} || (); # left padding
if ($opt{spark}) {
say '' if $opt{width} and $nr and $nr % $opt{width} == 0;
print color($color), $opt{spark}->[
if ($opt{spark}) {
say '' if $opt{width} and $nr and $nr % $opt{width} == 0;
print color($color), $opt{spark}->[
$val == $order[0] ? -1 : # max
$val == $order[-1] ? 1 : # min
$#{$opt{spark}} < 3 ? 1 :
$val == $order[0] ? -1 : # max
$val == $order[-1] ? 1 : # min
$#{$opt{spark}} < 3 ? 1 :