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


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

Index


Code Index:

NAME

Top

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

DESCRIPTION

Top

This subclass of Net::DRI::Data::Contact adds accessors and validation for .CAT specific data.

.CAT uses only localized data.

METHODS

Top

The following accessors/mutators can be called in chain, as they all return the object itself.

lang()

optional language of contact, according to RFC3066

maintainer()

optional free-form element that is published in whois

email_sponsor()

e-mail address to use when participating in the community sponsoring model of the puntCAT registry ; may be identical to the primary e-mail address

SUPPORT

Top

For now, support questions should be sent to:

<netdri@dotandco.com>

Please also see the SUPPORT file in the distribution.

SEE ALSO

Top

http://www.dotandco.com/services/software/Net-DRI/

AUTHOR

Top

Patrick Mevzek, <netdri@dotandco.com>

COPYRIGHT

Top


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

## Domain Registry Interface, Handling of contact data for .CAT
##
## Copyright (c) 2006,2008 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
##
## This file is part of Net::DRI
##
## Net::DRI is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## See the LICENSE file that comes with this distribution for more details.
#
# 
#
####################################################################################################

package Net::DRI::Data::Contact::CAT;

use strict;
use base qw/Net::DRI::Data::Contact/;
use Email::Valid;
use Net::DRI::Util;
use Net::DRI::Exception;

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

__PACKAGE__->register_attributes(qw(lang email_sponsor maintainer));

####################################################################################################

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

 $self->SUPER::validate($change); ## will trigger an Exception if problem

 push @errs,'lang'          if ($self->lang() && !Net::DRI::Util::xml_is_language($self->lang()));
 push @errs,'maintainer'    if ($self->maintainer() && !Net::DRI::Util::xml_is_token($self->maintainer(),undef,128));
 push @errs,'email_sponsor' if ($self->email_sponsor() && !Net::DRI::Util::xml_is_token($self->email_sponsor(),1,undef) && !Email::Valid->rfc822($self->email_sponsor()));

 push @errs,'srid'          if ($self->srid() && $self->srid()=~m/^REG-/);

 Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;

 return 1; ## everything ok.
}

####################################################################################################
1;