/usr/share/perl5/Statistics/Basic/_OneVectorBase.pm is in libstatistics-basic-perl 1.6607-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 92 93 94 95 96 97 98 99 100 101 102 103 104 | package Statistics::Basic::_OneVectorBase;
use strict;
use warnings;
use Carp;
use Statistics::Basic; # make sure all the basic classes are loaded
use overload
'""' => sub { defined( my $v = $_[0]->query ) or return "n/a"; $Statistics::Basic::fmt->format_number("$v", $Statistics::Basic::IPRES) },
'0+' => sub { $_[0]->query },
( defined($Statistics::Basic::TOLER) ? ('==' => sub { abs($_[0]-$_[1])<=$Statistics::Basic::TOLER }) : () ),
'eq' => sub { "$_[0]" eq "$_[1]" },
'bool' => sub { 1 },
fallback => 1; # tries to do what it would have done if this wasn't present.
# _recalc_needed {{{
sub _recalc_needed {
my $this = shift;
$this->{recalc_needed} = 1;
warn "[recalc_needed " . ref($this) . "]\n" if $Statistics::Basic::DEBUG;
return;
}
# }}}
# query {{{
sub query {
my $this = shift;
$this->_recalc if $this->{recalc_needed};
warn "[query " . ref($this) . " $this->{_value}]\n" if $Statistics::Basic::DEBUG;
return $this->{_value};
}
# }}}
# query_vector {{{
sub query_vector {
my $this = shift;
return $this->{v};
}
# }}}
# query_size {{{
sub query_size {
my $this = shift;
return $this->{v}->query_size;
}
# maybe deprecate this later
*size = \&query_size unless $ENV{TEST_AUTHOR};
# }}}
# set_size {{{
sub set_size {
my $this = shift;
my $size = shift;
my $nofl = shift;
eval { $this->{v}->set_size($size, $nofl) } or croak $@;
return $this;
}
# }}}
# set_vector {{{
sub set_vector {
my $this = shift;
warn "[set_vector " . ref($this) . "]\n" if $Statistics::Basic::DEBUG;
$this->{v}->set_vector(@_);
return $this;
}
# }}}
# insert {{{
sub insert {
my $this = shift;
warn "[insert " . ref($this) . "]\n" if $Statistics::Basic::DEBUG;
$this->{v}->insert(@_);
return $this;
}
# }}}
# ginsert {{{
sub ginsert {
my $this = shift;
warn "[ginsert " . ref($this) . "]\n" if $Statistics::Basic::DEBUG;
$this->{v}->ginsert(@_);
return $this;
}
*append = \&ginsert;
# }}}
1;
|