This file is indexed.

/usr/share/perl5/Number/Tolerant/Constant.pm is in libnumber-tolerant-perl 1.708-2.

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
105
106
107
108
109
110
111
use strict;
use warnings;
package Number::Tolerant::Constant;
# ABSTRACT: a blessed constant type
$Number::Tolerant::Constant::VERSION = '1.708';
#pod =head1 SYNOPSIS
#pod
#pod  use Number::Tolerant;
#pod  use Number::Tolerant::Constant;
#pod
#pod  my $range  = tolerance(10);
#pod  ref $range; # "Number::Tolerant" -- w/o ::Constant, would be undef
#pod
#pod =head1 DESCRIPTION
#pod
#pod When Number::Tolerant is about to return a tolerance with zero variation, it
#pod will return a constant instead.  This module will register a constant type that
#pod will catch these constants and return them as Number::Tolerant objects.
#pod
#pod I wrote this module to make it simpler to use tolerances with Class::DBI, which
#pod would otherwise complain that the constructor hadn't returned a blessed object.
#pod
#pod =cut

package
  Number::Tolerant::Type::constant_obj;
use parent qw(Number::Tolerant::Type);

sub construct { shift;
  { value => $_[0], min => $_[0], max => $_[0], constant => 1 }
};

sub parse {
  my ($self, $string, $factory) = @_;
  my $number = $self->number_re;
  return $factory->new($string) if ($string =~ m!\A($number)\z!);
  return;
}

sub numify { $_[0]->{value} }

sub stringify { "$_[0]->{value}" }

sub valid_args {
  my $self = shift;
  my $number = $self->normalize_number($_[0]);

  return unless defined $number;

  return $number if @_ == 1;

  return;
}

package Number::Tolerant::Constant;

sub import {
  Number::Tolerant->disable_plugin("Number::Tolerant::Type::constant");
  Number::Tolerant->enable_plugin( "Number::Tolerant::Type::constant_obj");
}

sub _disable {
  Number::Tolerant->disable_plugin("Number::Tolerant::Type::constant_obj");
  Number::Tolerant->enable_plugin( "Number::Tolerant::Type::constant");
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Number::Tolerant::Constant - a blessed constant type

=head1 VERSION

version 1.708

=head1 SYNOPSIS

 use Number::Tolerant;
 use Number::Tolerant::Constant;

 my $range  = tolerance(10);
 ref $range; # "Number::Tolerant" -- w/o ::Constant, would be undef

=head1 DESCRIPTION

When Number::Tolerant is about to return a tolerance with zero variation, it
will return a constant instead.  This module will register a constant type that
will catch these constants and return them as Number::Tolerant objects.

I wrote this module to make it simpler to use tolerances with Class::DBI, which
would otherwise complain that the constructor hadn't returned a blessed object.

=head1 AUTHOR

Ricardo Signes <rjbs@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2004 by Ricardo Signes.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut