| 1 | package Attribute::Signature; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | #use warnings::register; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Scalar::Util qw ( blessed ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | #use Data::Dumper; | ||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Attribute::Handlers; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use attributes (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | #local $^W=0; | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | our $VERSION = '1.11'; | |||||||||||||||||||||||||||
| 16 | 1 | my $SIGNATURES = {}; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 28 | ▶ | sub UNIVERSAL::with : ATTR(CODE,INIT) { | ||||||||||||||||||||||||||
|
Subroutine
with: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 28 | my ($package, $symbol, $referent, $attr, $data) = @_; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 28 | my $large = *{$symbol}{NAME}; | |||||||||||||||||||||||||||
| 22 | 28 | my $subname = substr($large, rindex($large, ':') + 1); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | ▶ | no warnings qw( redefine ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | ## make sure we have an array ref, so its easier | ||||||||||||||||||||||||||||
| 27 | 28 | ▶ | if (!ref($data)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 0 | $data = [ $data ]; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | ## save this for later use | ||||||||||||||||||||||||||||
| 32 | 28 | $SIGNATURES->{$package}->{with}->{$subname} = $data; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 28 | my $attributes = { map { ($_, 1) } attributes::get( $referent ) }; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 28 | ▶ | if ($attributes->{method}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 1 | ▶ | print "Signature on sub $subname is for a method\n" if $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 1 | unshift @$data, $package; ## put a placeholder in the front | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 28 | ▶ | *{$symbol} = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=21 SCAR=31.4
| |||||||||||||||||||||||||||||
| 42 | 117 | my $i = 0; | |||||||||||||||||||||||||||
| 43 | 117 | my $count = scalar(@_); | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 117 | ▶ | if ($attributes->{method}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 3 | $i = 1; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 117 | ▶ | if ($count != scalar(@$data)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 20 | ▶ | if ($attributes->{method}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 1 | croak("invalid number of arguments passed to method $subname"); | |||||||||||||||||||||||||||
| 52 | } else { | ||||||||||||||||||||||||||||
| 53 | 19 | croak("invalid number of arguments passed to subroutine $subname ($count passed, ".scalar(@$data)." required"); | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 97 | my $m = 0; | |||||||||||||||||||||||||||
| 58 | 97 | ▶ | print "Comparisons\n" if $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 97 | ▶ | print "\tSignature\tValue\n" if $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 97 | my @failed; | |||||||||||||||||||||||||||
| 61 | 97 | ▶ | while($i <= $count) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | 201 | ▶ | print "\t$data->[$i]\t\t$_[$i]\n" if $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | 201 | ▶ | last unless $data->[$i]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | 104 | my $ok=0; | |||||||||||||||||||||||||||
| 65 | 104 | ▶ | if (lc($data->[$i]) eq $data->[$i]) { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 66 | ## here we are checking for little types | ||||||||||||||||||||||||||||
| 67 | 72 | my $type = $data->[$i]; | |||||||||||||||||||||||||||
| 68 | 72 | ▶ | if (Attribute::Signature->can( $type )) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 72 | ▶ | if (Attribute::Signature->$type( $_[$i] )) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 49 | $ok++; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | ▶ | } elsif ((blessed($_[$i])) && $_[$i]->isa( $data->[$i]) ) { | |||||||||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($_[$i]) and $_[$i]->isa($data->[$i])
MC/DC0%0/2
builtin::blessed($_[$i]) and $_[$i]->isa($data->[$i])
builtin::blessed($_[$i])
$_[$i]->isa($data->[$i])
Truth table33%1/3
A and B
A= builtin::blessed($_[$i])B= $_[$i]->isa($data->[$i])
| |||||||||||||||||||||||||||||
| 74 | # || string($_[$i]) | ||||||||||||||||||||||||||||
| 75 | 0 | $ok++; | |||||||||||||||||||||||||||
| 76 | ▶ | } elsif (!blessed($_[$i]) && ref($_[$i]) eq $data->[$i]) { | |||||||||||||||||||||||||||
|
Condition66%2/3
not builtin::blessed($_[$i]) and ref $_[$i] eq $data->[$i]
MC/DC50%1/2
not builtin::blessed($_[$i]) and ref $_[$i] eq $data->[$i]
not builtin::blessed($_[$i])
ref $_[$i] eq $data->[$i]
Truth table66%2/3
not(A) and B
A= not builtin::blessed($_[$i])B= ref $_[$i] eq $data->[$i]
| |||||||||||||||||||||||||||||
| 77 | 8 | $ok++; | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | 104 | ▶ | if ($ok) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 57 | $m++ ; | |||||||||||||||||||||||||||
| 81 | } else { | ||||||||||||||||||||||||||||
| 82 | 47 | push @failed,$i; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | 104 | $i++; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 97 | ▶ | if ($attributes->{method}) { $m++; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 97 | ▶ | print "Out of band:\n\tCount\tMatched\n\t$count\t$m\n" if defined $::AS_DEBUG && $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $main::AS_DEBUG and $main::AS_DEBUG
MC/DC0%0/2
defined $main::AS_DEBUG and $main::AS_DEBUG
defined $main::AS_DEBUG
$main::AS_DEBUG
Truth table33%1/3
A and B
A= defined $main::AS_DEBUGB= $main::AS_DEBUG
| |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 97 | ▶ | if ($m != $count) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 47 | croak("call to $subname does not match signature (failed args:".join(',',@failed).")"); | |||||||||||||||||||||||||||
| 93 | } else { | ||||||||||||||||||||||||||||
| 94 | #$referent->( @_ ); | ||||||||||||||||||||||||||||
| 95 | 50 | goto &$referent; | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | 28 | }; | |||||||||||||||||||||||||||
| 98 | 1 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 28 | ▶ | sub UNIVERSAL::returns : ATTR(CODE,INIT) { | ||||||||||||||||||||||||||
|
Subroutine
returns: called CC=4 SCAR=14.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 101 | 28 | my ($package, $symbol, $referent, $attr, $data) = @_; | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 28 | my $large = *{$symbol}{NAME}; | |||||||||||||||||||||||||||
| 104 | 28 | my $subname = substr($large, rindex($large, ':') + 1); | |||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 1 | ▶ | no warnings qw( redefine ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | ## make sure we have an array ref, so its easier | ||||||||||||||||||||||||||||
| 109 | 28 | ▶ | if (!ref($data)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | $data = [ $data ]; | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | ## save this for later use | ||||||||||||||||||||||||||||
| 114 | 28 | $SIGNATURES->{$package}->{returns}->{$subname} = $data; | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 0 | my $attributes = { map { ($_, 1) } attributes::get( $referent ) }; | |||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 28 | ▶ | if ($attributes->{method}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | print "Signature on sub $subname is for a method\n" if $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | 0 | unshift @$data, $package; ## put a placeholder in the front | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 28 | ▶ | *{$symbol} = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=20 SCAR=33.3
| |||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 96 | my @return = $referent->( @_ ); | |||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 29 | my $i = 0; | |||||||||||||||||||||||||||
| 128 | 29 | my $count = scalar(@return); | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 29 | ▶ | if ($count != scalar(@$data)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | if ($attributes->{method}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | 0 | croak("invalid number of arguments returned from method $subname"); | |||||||||||||||||||||||||||
| 133 | } else { | ||||||||||||||||||||||||||||
| 134 | 0 | croak("invalid number of arguments returned from subroutine $subname"); | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 29 | my $m = 0; | |||||||||||||||||||||||||||
| 139 | 29 | ▶ | print "ReturnComparisons\n" if $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | 29 | ▶ | print "\tSignature\tValue\n" if $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | 29 | ▶ | while($i <= $count) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | 60 | ▶ | print "\t$data->[$i]\t\t$return[$i]\n" if $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 60 | ▶ | last unless $data->[$i]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 31 | ▶ | if (lc($data->[$i]) eq $data->[$i]) { | ||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||
| 145 | ## here we are checking for little types | ||||||||||||||||||||||||||||
| 146 | 23 | my $type = $data->[$i]; | |||||||||||||||||||||||||||
| 147 | 23 | ▶ | if (Attribute::Signature->can( $type )) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 23 | ▶ | if (Attribute::Signature->$type( $return[$i] )) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 19 | $m++; | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | ▶ | } elsif ($data->[$i] eq 'REF' && ref($return[$i])) { | |||||||||||||||||||||||||||
|
Condition100%3/3
$data->[$i] eq "REF" and ref $return[$i]
MC/DC100%2/2
$data->[$i] eq "REF" and ref $return[$i]
$data->[$i] eq "REF"
ref $return[$i]
Truth table100%3/3
A and B
A= $data->[$i] eq "REF"B= ref $return[$i]
| |||||||||||||||||||||||||||||
| 153 | 1 | $m++; | |||||||||||||||||||||||||||
| 154 | # } elsif ((blessed($return[$i]) || string($return[$i])) && $return[$i]->isa( $data->[$i]) ) { | ||||||||||||||||||||||||||||
| 155 | ▶ | } elsif (blessed($return[$i]) && $return[$i]->isa( $data->[$i]) ) { | |||||||||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($return[$i]) and $return[$i]->isa($data->[$i])
MC/DC0%0/2
builtin::blessed($return[$i]) and $return[$i]->isa($data->[$i])
builtin::blessed($return[$i])
$return[$i]->isa($data->[$i])
Truth table33%1/3
A and B
A= builtin::blessed($return[$i])B= $return[$i]->isa($data->[$i])
| |||||||||||||||||||||||||||||
| 156 | 0 | $m++; | |||||||||||||||||||||||||||
| 157 | ▶ | } elsif (!blessed($return[$i]) && ref($return[$i]) eq $data->[$i]) { | |||||||||||||||||||||||||||
|
Condition66%2/3
not builtin::blessed($return[$i]) and ref $return[$i] eq $data->[$i]
MC/DC50%1/2
not builtin::blessed($return[$i]) and ref $return[$i] eq $data->[$i]
not builtin::blessed($return[$i])
ref $return[$i] eq $data->[$i]
Truth table66%2/3
not(A) and B
A= not builtin::blessed($return[$i])B= ref $return[$i] eq $data->[$i]
| |||||||||||||||||||||||||||||
| 158 | 3 | $m++; | |||||||||||||||||||||||||||
| 159 | } else { | ||||||||||||||||||||||||||||
| 160 | # no match | ||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | 31 | $i++; | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ($attributes->{method}) { $m++; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 29 | ▶ | print "ReturnOut of band:\n\tCount\tMatched\n\t$count\t$m\n" if $::AS_DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 29 | ▶ | if ($m != $count) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | 8 | croak("Arguments returned from $subname do not match signature $m != $count"); | |||||||||||||||||||||||||||
| 171 | } else { | ||||||||||||||||||||||||||||
| 172 | 21 | $referent->( @_ ); | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | 28 | }; | |||||||||||||||||||||||||||
| 175 | 1 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 2 | ▶ | sub getSignature { | ||||||||||||||||||||||||||
|
Subroutine
getSignature: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 178 | 2 | my $class = shift; | |||||||||||||||||||||||||||
| 179 | 2 | my $fqsn = shift; | |||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | ## this is my sub && package | ||||||||||||||||||||||||||||
| 182 | 2 | my $subname = substr($fqsn, rindex($fqsn, ':') + 1); | |||||||||||||||||||||||||||
| 183 | 2 | my $package = substr($fqsn, 0, rindex($fqsn, '::')); | |||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 2 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | 1 | return($SIGNATURES->{$package}->{with}->{$subname}, $SIGNATURES->{$package}->{returns}->{$subname}); | |||||||||||||||||||||||||||
| 187 | } else { | ||||||||||||||||||||||||||||
| 188 | 1 | return $SIGNATURES->{$package}->{with}->{$subname}; | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 45 | ▶ | sub string { | ||||||||||||||||||||||||||
|
Subroutine
string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 193 | 45 | my $class = shift; | |||||||||||||||||||||||||||
| 194 | 45 | return not ref $_[0]; | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 20 | ▶ | sub number { | ||||||||||||||||||||||||||
|
Subroutine
number: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 198 | 20 | my $class = shift; | |||||||||||||||||||||||||||
| 199 | 20 | ▶ | return $class->float($_[0]) || $class->integer($_[0]); | ||||||||||||||||||||||||||
|
Condition100%3/3
$class->float($_[0]) || $class->integer($_[0])
MC/DC100%2/2
$class->float($_[0]) || $class->integer($_[0])
$class->float($_[0])
$class->integer($_[0])
Truth table100%3/3
A || B
A= $class->float($_[0])B= $class->integer($_[0])
| |||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 37 | ▶ | sub float { | ||||||||||||||||||||||||||
|
Subroutine
float: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 203 | 37 | my $class = shift; | |||||||||||||||||||||||||||
| 204 | 37 | return $_[0] =~ /^\d*\.\d*$/; | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 29 | ▶ | sub integer { | ||||||||||||||||||||||||||
|
Subroutine
integer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 208 | 29 | my $class = shift; | |||||||||||||||||||||||||||
| 209 | 29 | return $_[0] =~ /^\d+$/; | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 1 | 1; | |||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | __END__ | ||||||||||||||||||||||||||||