| 1 | package TPath::Numifiable; | ||||||||||
| 2 | 2 | $TPath::Numifiable::VERSION = '1.007'; | |||||||||
| 3 | # ABSTRACT: role of things that evaluate to numbers | ||||||||||
| 4 | |||||||||||
| 5 | 2 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | 2 | with 'TPath::Stringifiable'; | |||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | 2 | has negated => ( is => 'ro', isa => 'Bool', default => 0 ); | |||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | 2 | requires 'to_num'; | |||||||||
| 15 | |||||||||||
| 16 | 0 | ▶ | around to_num => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 17 | 0 | my ( $orig, $self, $ctx ) = @_; | |||||||||
| 18 | 0 | my $v = $self->$orig($ctx); | |||||||||
| 19 | 0 | ▶ | return $self->negated ? -$v : $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 2 | }; | |||||||||
| 21 | |||||||||||
| 22 | 2 | 1; | |||||||||
| 23 | |||||||||||
| 24 | __END__ | ||||||||||