Metabase-Fact

 view release on metacpan or  search on metacpan

lib/Metabase/Fact/String.pm  view on Meta::CPAN

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
sub validate_content {
    my ($self) = @_;
    Carp::confess "content must be scalar value"
      unless defined $self->content && ref \( $self->content ) eq 'SCALAR';
}
 
sub content_as_bytes {
    my ($self) = @_;
    my $bytes = $self->content;
    utf8::encode($bytes) if $] ge '5.008'; # converts in-place
    return $bytes;
}
 
sub content_from_bytes {
    my ( $class, $bytes ) = @_;
    utf8::decode($bytes) if $] ge '5.008'; # converts in-place
    return $bytes;
}
 
1;
 
# ABSTRACT: fact subtype for simple strings
 
__END__
 
=pod



( run in 0.545 second using v1.01-cache-2.11-cpan-fb7fbe3ddfd )