| 1 | package Leading::Zeros; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use version; $VERSION = qv('0.0.2'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use overload; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=1 SCAR=3.8
| |||||||||||
| 11 | 1 | my ($package, @flags) = @_; | |||||||||
| 12 | 0 | my $converting_to_decimals = !grep { m/\A -warning \z /xms } @flags; | |||||||||
| 13 | overload::constant ( | ||||||||||
| 14 | 0 | ▶ | binary => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 15 | 0 | my ($raw, $cooked) = @_; | |||||||||
| 16 | 0 | ▶ | my ($octal_flag, $digits) = $raw =~ m/\A (0+) (\d+) \z/xms | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | or return $cooked; # since it must have been a hexadecimal | ||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | return 0+$digits if $converting_to_decimals; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | |||||||||||
| 21 | 0 | carp qq{Warning: octal constant $raw (decimal value: $cooked) used}; | |||||||||
| 22 | 0 | return $cooked; | |||||||||
| 23 | }, | ||||||||||
| 24 | 1 | ); | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub unimport { | ||||||||
|
Subroutine
unimport: not called CC=1 SCAR=6.9
| |||||||||||
| 28 | overload::constant ( | ||||||||||
| 29 | 0 | ▶ | binary => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 30 | 0 | my ($raw, $cooked) = @_; | |||||||||
| 31 | 0 | ▶ | return $cooked if $raw !~ m/\A 0 \d+/xms; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | croak qq{Can't use octal constant ($raw) }, | |||||||||
| 33 | qq{while 'no Leading::Zeros' in effect\nError}; | ||||||||||
| 34 | }, | ||||||||||
| 35 | 0 | ); | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 2 | 1; # Magic true value required at end of module | |||||||||
| 39 | __END__ | ||||||||||