line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
58387
|
use 5.006; |
|
7
|
|
|
|
|
25
|
|
|
7
|
|
|
|
|
263
|
|
2
|
7
|
|
|
7
|
|
36
|
use strict; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
179
|
|
3
|
7
|
|
|
7
|
|
35
|
use warnings; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
346
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Metabase::Fact::String; |
6
|
|
|
|
|
|
|
our $VERSION = '0.024'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
41
|
use Carp (); |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
134
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
2070
|
use Metabase::Fact; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
1557
|
|
11
|
|
|
|
|
|
|
our @ISA = qw/Metabase::Fact/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# document that content must be characters, not bytes -- dagolden, 2009-03-28 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub validate_content { |
16
|
16
|
|
|
16
|
1
|
59
|
my ($self) = @_; |
17
|
16
|
50
|
33
|
|
|
133
|
Carp::confess "content must be scalar value" |
18
|
|
|
|
|
|
|
unless defined $self->content && ref \( $self->content ) eq 'SCALAR'; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub content_as_bytes { |
22
|
7
|
|
|
7
|
1
|
12
|
my ($self) = @_; |
23
|
7
|
|
|
|
|
28
|
my $bytes = $self->content; |
24
|
7
|
50
|
|
|
|
35
|
utf8::encode($bytes) if $] ge '5.008'; # converts in-place |
25
|
7
|
|
|
|
|
1056
|
return $bytes; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub content_from_bytes { |
29
|
5
|
|
|
5
|
1
|
10
|
my ( $class, $bytes ) = @_; |
30
|
5
|
50
|
|
|
|
25
|
utf8::decode($bytes) if $] ge '5.008'; # converts in-place |
31
|
5
|
|
|
|
|
32
|
return $bytes; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# ABSTRACT: fact subtype for simple strings |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |