| 1 | package PDL::Role::Stringifiable; | ||||||||||||||
| 2 | 19 | $PDL::Role::Stringifiable::VERSION = '0.006005'; | |||||||||||||
| 3 | 19 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 19 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 19 | ▶ | use Role::Tiny; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | |||||||||||||||
| 7 | 19 | requires 'element_stringify'; | |||||||||||||
| 8 | 19 | requires 'element_stringify_max_width'; | |||||||||||||
| 9 | |||||||||||||||
| 10 | 170 | ▶ | sub element_stringify { | ||||||||||||
|
Subroutine
element_stringify: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||
| 11 | 170 | my($self, $element) = @_; | |||||||||||||
| 12 | 170 | "$element"; | |||||||||||||
| 13 | } | ||||||||||||||
| 14 | |||||||||||||||
| 15 | 207 | ▶ | sub string { | ||||||||||||
|
Subroutine
string: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||
| 16 | # TODO | ||||||||||||||
| 17 | 207 | my ($self) = @_; | |||||||||||||
| 18 | |||||||||||||||
| 19 | 207 | ▶ | if ($self->nelem > $PDL::toolongtoprint) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 20 | 1 | return "TOO LONG TO PRINT"; | |||||||||||||
| 21 | } | ||||||||||||||
| 22 | |||||||||||||||
| 23 | 206 | my $ndims = $self->ndims; | |||||||||||||
| 24 | 206 | ▶ | if( $ndims == 0 ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 25 | 200 | return $self->element_stringify( $self->at() ); | |||||||||||||
| 26 | } | ||||||||||||||
| 27 | elsif( $ndims == 1 ) { | ||||||||||||||
| 28 | 6 | return $self->string1d; | |||||||||||||
| 29 | } | ||||||||||||||
| 30 | # TODO string2d, stringNd | ||||||||||||||
| 31 | ... | ||||||||||||||
| 32 | 0 | } | |||||||||||||
| 33 | |||||||||||||||
| 34 | 6 | ▶ | sub string1d { | ||||||||||||
|
Subroutine
string1d: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||
| 35 | 6 | my ($self) = @_; | |||||||||||||
| 36 | 6 | my $str = "["; | |||||||||||||
| 37 | |||||||||||||||
| 38 | 6 | for my $w (0..$self->nelem-1) { | |||||||||||||
| 39 | 18 | $str .= " "; | |||||||||||||
| 40 | 18 | $str .= $self->element_stringify( $self->at($w) ); | |||||||||||||
| 41 | } | ||||||||||||||
| 42 | 6 | ▶ | $str .= " " if ($self->nelem > 0); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 43 | 6 | $str .= "]"; | |||||||||||||
| 44 | 6 | $str; | |||||||||||||
| 45 | } | ||||||||||||||
| 46 | |||||||||||||||
| 47 | 0 | ▶ | sub string2d { | ||||||||||||
|
Subroutine
string2d: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 48 | ... | ||||||||||||||
| 49 | 0 | } | |||||||||||||
| 50 | |||||||||||||||
| 51 | |||||||||||||||
| 52 | 19 | 1; | |||||||||||||
| 53 | |||||||||||||||
| 54 | __END__ | ||||||||||||||