| 1 | ## Domain Registry Interface, Handling of contact data for .COOP | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2006-2008,2013 Patrick Mevzek <netdri@dotandco.com>. 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::COOP; | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use base qw/Net::DRI::Data::Contact/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | __PACKAGE__->register_attributes(qw(sponsors state lang mailing_list)); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =pod | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head1 NAME | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | Net::DRI::Data::Contact::COOP - Handle .COOP contact data for Net::DRI | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | This subclass of Net::DRI::Data::Contact adds accessors and validation for | ||||||||||||||||||||||||||||
| 35 | .COOP specific data. | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | Organizations must have names and phone numbers. | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | Contact ids must begin with a prefix given by the registry (tied to the registrar account). | ||||||||||||||||||||||||||||
| 40 | If you specify a localized version for data, you need the internationalized version also | ||||||||||||||||||||||||||||
| 41 | (see documentation of Net::DRI::Data::Contact and its loc2int method) ; you can however | ||||||||||||||||||||||||||||
| 42 | specify just internationalized data, without a localized version. | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =head1 METHODS | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | The following accessors/mutators can be called in chain, as they all return the object itself. | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =head2 sponsors() | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | list of sponsors as registry contact ids (mandatory for registrants, at least 2) | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =head2 state() | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | verification state : verified, pendingVerification, ableToApeal, underInvestigation, refused | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =head2 lang() | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | language of contact | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =head2 mailing_list() | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | boolean showing opt-in status of contact for .COOP newsletters | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | http://www.dotandco.com/services/software/Net-DRI/ | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | Copyright (c) 2006-2008,2013 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||
| 83 | All rights reserved. | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 86 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 87 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 88 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =cut | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | #################################################################################################### | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | sub validate | ||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my ($self,$change)=@_; | ||||||||||||||||||||||||||
|
Subroutine
validate: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 99 | 0 | ▶ | $change||=0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$change ||= 0
MC/DC0%0/1
$change ||= 0
$change
Truth table0%0/2
A
A= $change
| |||||||||||||||||||||||||||||
| 100 | 0 | my @errs; | |||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | $self->SUPER::validate($change); ## will trigger an Exception if problem | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | if ($self->sponsors()) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | { | ||||||||||||||||||||||||||||
| 106 | 0 | ▶ | foreach my $id (ref($self->sponsors())? @{$self->sponsors()} : ($self->sponsors())) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | next if Net::DRI::Util::xml_is_token($id,3,16); ## clIDType | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | 0 | push @errs,'sponsors'; | |||||||||||||||||||||||||||
| 110 | 0 | last; | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | push @errs,'lang' if ($self->lang() && !Net::DRI::Util::xml_is_language($self->lang())); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->lang and not Net::DRI::Util::xml_is_language($self->lang)
MC/DC0%0/2
$self->lang and not Net::DRI::Util::xml_is_language($self->lang)
$self->lang
not Net::DRI::Util::xml_is_language($self->lang)
Truth table0%0/3
A and not(B)
A= $self->langB= not Net::DRI::Util::xml_is_language($self->lang)
| |||||||||||||||||||||||||||||
| 114 | 0 | ▶ | push @errs,'mailing_list' if ($self->mailing_list() && !Net::DRI::Util::xml_is_boolean($self->mailing_list())); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->mailing_list and not Net::DRI::Util::xml_is_boolean($self->mailing_list)
MC/DC0%0/2
$self->mailing_list and not Net::DRI::Util::xml_is_boolean($self->mailing_list)
$self->mailing_list
not Net::DRI::Util::xml_is_boolean($self->mailing_list)
Truth table0%0/3
A and not(B)
A= $self->mailing_listB= not Net::DRI::Util::xml_is_boolean($self->mailing_list)
| |||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | return 1; ## everything ok. | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | #################################################################################################### | ||||||||||||||||||||||||||||
| 122 | 1 | 1; | |||||||||||||||||||||||||||