lib/OWL/Data/String.pm

filter: Statementstmt 72.7% 16 / 22 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 100% 1 / 1 totaltotal 60.0% 21 / 35 CC 4 SCAR 17.5
CC
4
Cov
57%
_attr_prop
12.0
_accessible
6.0
BEGIN
1.0
CRAP 5.8
« lib/OWL/Data/Integer.pm ↑ Summary lib/OWL/Generators/GenOWL.pm »
1 #-----------------------------------------------------------------
2 # OWL::Data::String
3 # Author: Edward Kawas <edward.kawas@gmail.com>,
4 # Martin Senger <martin.senger@gmail.com>
5 # For copyright and disclaimer see below.
6 #
7 # $Id: String.pm,v 1.3 2010-01-07 21:46:39 ubuntu Exp $
8 #-----------------------------------------------------------------
9
10 package OWL::Data::String;
11 3 ▶use base ("OWL::Data::Object");
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13
14 # add versioning to this module
15 3 ▶use vars qw /$VERSION/;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 $VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /: (\d+)\.(\d+)/;
17
18 =head1 NAME
19
20 OWL::Data::String - A primitive data type for strings
21
22 =head1 SYNOPSIS
23
24 use OWL::Data::String;
25
26 # create a String with initial value of 'eddie'
27 my $data = OWL::Data::String->new (value => 'eddie');
28 my $data = OWL::Data::String->new ('eddie');
29
30 # later change the value of this data object
31 $data->value ('tulak');
32 print $data->value();
33
34 =head1 DESCRIPTION
35
36 An object representing a String, an owl primitive data type.
37
38 =head1 AUTHORS
39
40 Edward Kawas (edward.kawas [at] gmail [dot] com)
41 Martin Senger (martin.senger [at] gmail [dot] com)
42
43 =cut
44
45 #-----------------------------------------------------------------
46 # A list of allowed attribute names. See OWL::Base for details.
47 #-----------------------------------------------------------------
48
49 =head1 ACCESSIBLE ATTRIBUTES
50
51 Details are in L<OWL::Base>. Here just a list of them (additionally
52 to the attributes from the parent classes)
53
54 =over
55
56 =item B<value>
57
58 A value of this datatype. Must be an integer.
59
60 =back
61
62 =cut
63
64 {
65 3 my %_allowed = (
66 value => { type => OWL::Base->STRING },
67 );
68
69 0 ▶ sub _accessible {
Subroutine _accessible: not called CC=2 SCAR=17.9
70 0 my ( $self, $attr ) = @_;
71 0 ▶ exists $_allowed{$attr} or $self->SUPER::_accessible($attr);
Branch: 1 branch
BranchTrueFalseTotal
exists $_allowed{$attr} or $self->SUPER::_accessible($attr) 0 0 0
72 }
73
74 0 ▶ sub _attr_prop {
Subroutine _attr_prop: not called CC=3 SCAR=24.8
75 0 my ( $self, $attr_name, $prop_name ) = @_;
76 0 my $attr = $_allowed{$attr_name};
77 0 ▶ return ref($attr) ? $attr->{$prop_name} : $attr if $attr;
Branch: 2 branches
BranchTrueFalseTotal
if $attr 0 0 0
ref $attr ? : 0 0 0
78 0 return $self->SUPER::_attr_prop( $attr_name, $prop_name );
79 }
80 }
81
82 #-----------------------------------------------------------------
83 # init
84 #-----------------------------------------------------------------
85 3 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
86 1 my ($self) = shift;
87 1 $self->SUPER::init();
88 1 $self->primitive('yes');
89 }
90
91 3 1;
92 __END__
« lib/OWL/Data/Integer.pm ↑ Summary lib/OWL/Generators/GenOWL.pm »