File Coverage

blib/lib/Net/DRI/Data/Contact/PL.pm
Criterion Covered Total %
statement 12 20 60.0
branch 0 6 0.0
condition 0 8 0.0
subroutine 4 5 80.0
pod 0 1 0.0
total 16 40 40.0


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, Handling of contact data for .PL
2             ##
3             ## Copyright (c) 2006,2008,2013 Patrick Mevzek . All rights reserved.
4             ##
5             ## This file is part of Net::DRI
6             ##
7             ## Net::DRI is free software; you can redistribute it and/or modify
8             ## it under the terms of the GNU General Public License as published by
9             ## the Free Software Foundation; either version 2 of the License, or
10             ## (at your option) any later version.
11             ##
12             ## See the LICENSE file that comes with this distribution for more details.
13             #########################################################################################
14              
15             package Net::DRI::Data::Contact::PL;
16              
17 1     1   1060 use strict;
  1         2  
  1         28  
18 1     1   4 use warnings;
  1         1  
  1         24  
19              
20 1     1   3 use base qw/Net::DRI::Data::Contact/;
  1         1  
  1         66  
21 1     1   5 use Net::DRI::Exception;
  1         1  
  1         185  
22              
23             __PACKAGE__->register_attributes(qw(individual consent_for_publishing));
24              
25             =pod
26              
27             =head1 NAME
28              
29             Net::DRI::Data::Contact::PL - Handle .PL contact data for Net::DRI
30              
31             =head1 DESCRIPTION
32              
33             This subclass of Net::DRI::Data::Contact adds accessors and validation for
34             .PL specific data.
35              
36             =head1 METHODS
37              
38             The following accessors/mutators can be called in chain, as they all return the object itself.
39              
40             =head2 individual()
41              
42             1 if the object represents a private person, 0 otherwise
43              
44             =head2 consent_for_publishing()
45              
46             1 if this person gave its assent for publishing personal details in WHOIS database, 0 otherwise.
47             This element has no meaning for a contact which does not represent a private person.
48              
49             =head1 SUPPORT
50              
51             For now, support questions should be sent to:
52              
53             Enetdri@dotandco.comE
54              
55             Please also see the SUPPORT file in the distribution.
56              
57             =head1 SEE ALSO
58              
59             http://www.dotandco.com/services/software/Net-DRI/
60              
61             =head1 AUTHOR
62              
63             Patrick Mevzek, Enetdri@dotandco.comE
64              
65             =head1 COPYRIGHT
66              
67             Copyright (c) 2006,2008,2013 Patrick Mevzek .
68             All rights reserved.
69              
70             This program is free software; you can redistribute it and/or modify
71             it under the terms of the GNU General Public License as published by
72             the Free Software Foundation; either version 2 of the License, or
73             (at your option) any later version.
74              
75             See the LICENSE file that comes with this distribution for more details.
76              
77             =cut
78              
79             ####################################################################################################
80              
81             sub validate
82             {
83 0     0 0   my ($self,$change)=@_;
84 0   0       $change||=0;
85 0           my @errs;
86              
87 0           $self->SUPER::validate($change); ## will trigger an Exception if problem
88              
89 0 0 0       push @errs,'individual' if (defined($self->individual()) && $self->individual()!~m/^(?:0|1)$/);
90 0 0 0       push @errs,'consent_for_publishing' if (defined($self->consent_for_publishing()) && $self->consent_for_publishing()!~m/^(?:0|1)$/);
91              
92 0 0         Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
93              
94 0           return 1; ## everything ok.
95             }
96              
97             ####################################################################################################
98             1;