| 1 | ### Change History | ||||||||||
| 2 | # 1999-08-13 Added padding | ||||||||||
| 3 | # 1999-02-21 Created. -Simon | ||||||||||
| 4 | |||||||||||
| 5 | package Data::Quantity::Number::Integer; | ||||||||||
| 6 | |||||||||||
| 7 | 4 | require 5; | |||||||||
| 8 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 4 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 4 | ▶ | use vars qw( $VERSION ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 4 | $VERSION = 0.001; | |||||||||
| 13 | |||||||||||
| 14 | 4 | ▶ | use Data::Quantity::Number::Number '-isasubclass'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | # $previous_q = $quantity->previous; | ||||||||||
| 17 | # $next_q = $quantity->previous( $incr ); | ||||||||||
| 18 | 4 | ▶ | sub previous { | ||||||||
|
Subroutine
previous: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 19 | 4 | my $quantity = shift; | |||||||||
| 20 | 4 | my $clone = $quantity->new_instance; | |||||||||
| 21 | 4 | ▶ | my $incr = scalar(@_) ? shift : 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 4 | $clone->value( $quantity->value - $incr ); | |||||||||
| 23 | 4 | return $clone; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | # $next_q = $quantity->next; | ||||||||||
| 27 | # $next_q = $quantity->next( $incr ); | ||||||||||
| 28 | 3 | ▶ | sub next { | ||||||||
|
Subroutine
next: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 29 | 3 | my $quantity = shift; | |||||||||
| 30 | 3 | my $clone = $quantity->new_instance; | |||||||||
| 31 | 3 | ▶ | my $incr = scalar(@_) ? shift : 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 3 | $clone->value( $quantity->value + $incr ); | |||||||||
| 33 | 3 | return $clone; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | # $padded = $quantity->zero_padded( $positions ); | ||||||||||
| 37 | 0 | ▶ | sub zero_padded { | ||||||||
|
Subroutine
zero_padded: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 38 | 0 | my $quantity = shift; | |||||||||
| 39 | 0 | my $value = $quantity->value; | |||||||||
| 40 | 0 | my $places = shift; | |||||||||
| 41 | 0 | return ( '0' x ( $places - length($value) ) ) . $value; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | # $padded = $quantity->zero_padded_value( $value, $positions ); | ||||||||||
| 45 | 0 | ▶ | sub zero_padded_value { | ||||||||
|
Subroutine
zero_padded_value: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 46 | 0 | my $quantity = shift; | |||||||||
| 47 | 0 | my ($value, $places) = @_; | |||||||||
| 48 | 0 | return ( '0' x ( $places - length($value) ) ) . $value; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 4 | 1; | |||||||||