Net::DRI::Data::Contact::IT - Handle .IT contact data for Net::DRI


Net-DRI documentation Contained in the Net-DRI distribution.

Index


Code Index:

NAME

Top

Net::DRI::Data::Contact::IT - Handle .IT contact data for Net::DRI

SUPPORT

Top

For now, support questions should be sent to:

<noc@towertech.it>

Please also see the SUPPORT file in the distribution.

AUTHOR

Top

Alessandro Zummo, <a.zummo@towertech.it>

COPYRIGHT

Top


Net-DRI documentation Contained in the Net-DRI distribution.

## Domain Registry Interface, Handling of contact data for .IT
##
## Copyright (C) 2009-2010 Tower Technologies. All rights reserved.
##
## This program free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License v2.
#
# 
#

package Net::DRI::Data::Contact::IT;

use strict;
use warnings;

use base qw / Net::DRI::Data::Contact /;

use Net::DRI::Exception;

our $VERSION=do { my @r=(q$Revision: 1.1 $=~/\d+/g); sprintf("%d".".%02d" x $#r, @r); };

__PACKAGE__->register_attributes(qw/
       consent_for_publishing entity_type
       nationality_code reg_code /);


sub validate
{
       my ($self, $change) = @_;
       $change ||= 0;
       my @errs;
 
       $self->SUPER::validate($change);

       push @errs, 'consent_for_publishing'
               if defined $self->consent_for_publishing
               and $self->consent_for_publishing !~m/^(?:0|1)$/;
 
       push @errs, 'nationality_code'
               if defined $self->nationality_code
               and $self->nationality_code !~m/^[a-zA-Z]{2}$/;
 
       push @errs, 'entity_type'
               if defined $self->entity_type
               and $self->entity_type !~m/^[1-7]$/;
 
       Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: ' . join('/', @errs))
               if scalar @errs;

       return 1;
}

1;