| 1 | package Rose::DB::Object::Metadata::Column::Character; | ||||||||||||||
| 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::Object::MakeMethods::Generic; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | 3 | ▶ | use Rose::DB::Object::MakeMethods::Generic; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | |||||||||||||||
| 10 | 3 | ▶ | use Rose::DB::Object::Metadata::Column::Scalar; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | 3 | our @ISA = qw(Rose::DB::Object::Metadata::Column::Scalar); | |||||||||||||
| 12 | |||||||||||||||
| 13 | 3 | our $VERSION = '0.803'; | |||||||||||||
| 14 | |||||||||||||||
| 15 | 0 | ▶ | sub type { 'character' } | ||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 16 | |||||||||||||||
| 17 | 3 | foreach my $type (__PACKAGE__->available_method_types) | |||||||||||||
| 18 | { | ||||||||||||||
| 19 | 9 | __PACKAGE__->method_maker_type($type => 'character') | |||||||||||||
| 20 | } | ||||||||||||||
| 21 | |||||||||||||||
| 22 | sub parse_value | ||||||||||||||
| 23 | 0 | ▶ | { | ||||||||||||
|
Subroutine
parse_value: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||
| 24 | 0 | my ($self, $db, $value) = @_; | |||||||||||||
| 25 | |||||||||||||||
| 26 | 0 | ▶ | my $length = $self->length or return $value; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 27 | |||||||||||||||
| 28 | 0 | ▶ | if(length($value) > $length) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 29 | { | ||||||||||||||
| 30 | 0 | my $overflow = $self->overflow; | |||||||||||||
| 31 | |||||||||||||||
| 32 | 0 | ▶ | if($overflow eq 'fatal') | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 33 | { | ||||||||||||||
| 34 | 0 | local $Carp::CarpLevel = $Carp::CarpLevel + 1; | |||||||||||||
| 35 | 0 | Carp::croak $self->parent->class, ': Value for ', $self->name, ' is too long. Maximum ', | |||||||||||||
| 36 | 0 | ▶ | "length is $length character@{[ $length == 1 ? '' : 's' ]}. ", | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 37 | "Value is ", length($value), " characters: $value"; | ||||||||||||||
| 38 | } | ||||||||||||||
| 39 | elsif($overflow eq 'warn') | ||||||||||||||
| 40 | { | ||||||||||||||
| 41 | 0 | local $Carp::CarpLevel = $Carp::CarpLevel + 1; | |||||||||||||
| 42 | 0 | Carp::carp $self->parent->class, ': Value for ', $self->name, ' is too long. Maximum ', | |||||||||||||
| 43 | 0 | ▶ | "length is $length character@{[ $length == 1 ? '' : 's' ]}. ", | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 44 | "Value is ", length($value), " characters: $value"; | ||||||||||||||
| 45 | } | ||||||||||||||
| 46 | } | ||||||||||||||
| 47 | |||||||||||||||
| 48 | 0 | return sprintf("%-*s", $length, substr($value, 0, $length)); | |||||||||||||
| 49 | } | ||||||||||||||
| 50 | |||||||||||||||
| 51 | 3 | *format_value = \&parse_value; | |||||||||||||
| 52 | |||||||||||||||
| 53 | sub init_with_dbi_column_info | ||||||||||||||
| 54 | 0 | ▶ | { | ||||||||||||
|
Subroutine
init_with_dbi_column_info: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 55 | 0 | my($self, $col_info) = @_; | |||||||||||||
| 56 | |||||||||||||||
| 57 | 0 | $self->SUPER::init_with_dbi_column_info($col_info); | |||||||||||||
| 58 | |||||||||||||||
| 59 | 0 | ▶ | if(defined $col_info->{'CHAR_OCTET_LENGTH'}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 60 | { | ||||||||||||||
| 61 | 0 | $self->length($col_info->{'CHAR_OCTET_LENGTH'}); | |||||||||||||
| 62 | } | ||||||||||||||
| 63 | |||||||||||||||
| 64 | 0 | return; | |||||||||||||
| 65 | } | ||||||||||||||
| 66 | |||||||||||||||
| 67 | 3 | 1; | |||||||||||||
| 68 | |||||||||||||||
| 69 | __END__ | ||||||||||||||