Object/Metadata/Column/Varchar.pm

filter: Statementstmt 57.1% 16 / 28 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 2 / 2 totaltotal 46.8% 22 / 47 CC 7 SCAR 35.8
CC
7
Cov
40%
parse_value
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 36.0
« Object/Metadata/ForeignKey.pm ↑ Summary Object/Metadata/Column/Datetime.pm »
1 package Rose::DB::Object::Metadata::Column::Varchar;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶use Carp();
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Rose::DB::Object::Metadata::Column::Character;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 our @ISA = qw(Rose::DB::Object::Metadata::Column::Character);
9  
10 3 our $VERSION = '0.803';
11  
12 3 foreach my $type (__PACKAGE__->available_method_types)
13 {
14 9 __PACKAGE__->method_maker_type($type => 'varchar');
15 }
16  
17 7 ▶sub type { 'varchar' }
Subroutine type: called CC=1 SCAR=0.0
Pod documented
18  
19 sub parse_value
20 0 ▶{
Subroutine parse_value: not called CC=7 SCAR=40.3
Pod documented
21 0 my ($self, $db, $value) = @_;
22  
23 0 ▶ my $length = $self->length or return $value;
Branch: 1 branch
BranchTrueFalseTotal
my $length = $self->length or return $value 0 0 0
24  
25 0 ▶ if(length($value) > $length)
Branch: 1 branch
BranchTrueFalseTotal
if (length $value > $length) 0 0 0
26 {
27 0 my $overflow = $self->overflow;
28
29 0 ▶ if($overflow eq 'fatal')
Branch: 2 branches
BranchTrueFalseTotal
if ($overflow eq 'fatal') { } 0 0 0
elsif ($overflow eq 'warn') { } 0 0 0
30 {
31 0 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
32 0 Carp::croak $self->parent->class, ': Value for ', $self->name, ' is too long. Maximum ',
33 0 ▶ "length is $length character@{[ $length == 1 ? '' : 's' ]}. ",
Branch: 1 branch
BranchTrueFalseTotal
$length == 1 ? : 0 0 0
34 "Value is ", length($value), " characters: $value";
35 }
36 elsif($overflow eq 'warn')
37 {
38 0 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
39 0 Carp::carp $self->parent->class, ': Value for ', $self->name, ' is too long. Maximum ',
40 0 ▶ "length is $length character@{[ $length == 1 ? '' : 's' ]}. ",
Branch: 1 branch
BranchTrueFalseTotal
$length == 1 ? : 0 0 0
41 "Value is ", length($value), " characters: $value";
42 }
43 }
44  
45 0 return substr($value, 0, $length);
46 }
47  
48 3 *format_value = \&parse_value;
49  
50 3 1;
51  
52 __END__
« Object/Metadata/ForeignKey.pm ↑ Summary Object/Metadata/Column/Datetime.pm »