Bind8/DB/A.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 47 CC 5 SCAR 27.7
CC
5
Cov
0%
rdata
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 16.0
1 # Bind8 A record handling
2 #
3 # Copyright Karthik Krishnamurthy <karthik.k@extremix.net>
4  
5 =head1 NAME
6  
7 Unix::Conf::Bind8::DB::A - Class representing A records.
8  
9 =head1 SYNOPSIS
10  
11 Refer to the SYNOPSIS section for Unix::Conf::Bind8::DB::Record.
12  
13 =head1 METHODS
14  
15 Methods specified here are overridden. They might or not be differnt from
16 the derived ones. For other methods refer to the METHODS section for
17 Unix::Conf::Bind8::DB::Record.
18  
19 =over 4
20  
21 =cut
22  
23 package Unix::Conf::Bind8::DB::A;
24  
25 use strict;
26 use warnings;
27  
28 use Unix::Conf;
29 use Unix::Conf::Bind8::Conf::Lib;
30 use Unix::Conf::Bind8::DB::Record;
31  
32 our (@ISA) = qw (Unix::Conf::Bind8::DB::Record);
33  
34 =item rdata ()
35  
36 Arguments
37 data
38  
39 Object method.
40 Get/set the record's rdata. If an argument is passed, the invocant's
41 rdata is set and true returned, on success, an Err object otherwise.
42 If no argument is passed the invocant's rdata is returned.
43  
44 =cut
45  
46 # Override base class (Unix::Conf::Bind8::DB::Record) method. The only
47 # difference is the validation of the IP address.
48 sub rdata
49 {
50 my ($self, $rdata) = @_;
51  
52 if (defined ($rdata)) {
53 return (Unix::Conf->_err ('rdata', "`$rdata' not a valid IP"))
54 unless (__valid_ipaddress ($rdata));
55 if (defined ($self->{RDATA})) {
56 my $ret;
57 $ret = Unix::Conf::Bind8::DB::_delete_object ($self)
58 or return ($ret);
59 # change rdata now before storing in new location as it is
60 # depenedant on the rdata.
61 $self->{RDATA} = $rdata;
62 $self->dirty (1);
63 return (Unix::Conf::Bind8::DB::_insert_object ($self));
64 }
65 $self->{RDATA} = $rdata;
66 $self->dirty (1);
67 return (1);
68 }
69 return (
70 defined ($self->{RDATA}) ? $self->{RDATA} :
71 Unix::Conf->_err ('rdata', "RDATA not defined")
72 );
73 }
74  
75 1;