| 1 | package Net::Whois::ARIN::Contact; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | Net::Whois::ARIN::Contact - ARIN whois Contact record class | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | use Net::Whois::ARIN::Contact; | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | my $poc = Net::Whois::ARIN::Contact->new( | ||||||||||||||||||||||||||||
| 12 | Name => 'Caine, Todd', | ||||||||||||||||||||||||||||
| 13 | Handle => 'TCA53-ARIN', | ||||||||||||||||||||||||||||
| 14 | Company => 'Electric Lightwave', | ||||||||||||||||||||||||||||
| 15 | Address => '4400 NE 77th Ave', | ||||||||||||||||||||||||||||
| 16 | City => 'Vancouver', | ||||||||||||||||||||||||||||
| 17 | StateProv => 'WA', | ||||||||||||||||||||||||||||
| 18 | PostalCode => '98662', | ||||||||||||||||||||||||||||
| 19 | Country => 'US', | ||||||||||||||||||||||||||||
| 20 | Comment => '', | ||||||||||||||||||||||||||||
| 21 | RegDate => '1995-07-25', | ||||||||||||||||||||||||||||
| 22 | Updated => '2001-05-17', | ||||||||||||||||||||||||||||
| 23 | Phone => '503-555-1212', | ||||||||||||||||||||||||||||
| 24 | Email => 'nobody@nobody.net', | ||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | printf "The ARIN contact handle for %s is %s.\n", | ||||||||||||||||||||||||||||
| 28 | $poc->Name, | ||||||||||||||||||||||||||||
| 29 | $poc->Handle; | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | The Net::Whois::ARIN::Contact module is simple class which is used to store the attributes of a point-of-contact record in ARIN's Whois server. Each attribute of the contact record has an accessor/mutator of the same name. | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | =cut | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 38 | 7 | ▶ | use Carp "croak"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 7 | our $AUTOLOAD; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 METHODS | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =over 4 | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =item B<new> - create a Net::Whois::ARIN::Contact object | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =cut | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 7 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 51 | 7 | my $class = shift; | |||||||||||||||||||||||||||
| 52 | 7 | return bless { @_ }, $class; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =item B<dump> - return the current whois record | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | print $o->dump; | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =back | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =cut | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub dump { | ||||||||||||||||||||||||||
|
Subroutine
dump: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 64 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 65 | 0 | my $record = sprintf "\nName: %s\n",$self->Name; | |||||||||||||||||||||||||||
| 66 | 0 | $record .= sprintf "Handle: %s\n",$self->Handle; | |||||||||||||||||||||||||||
| 67 | 0 | $record .= sprintf "Company: %s\n",$self->Company; | |||||||||||||||||||||||||||
| 68 | 0 | $record .= sprintf("Address: %s\n", $_) for @{ $self->Address }; | |||||||||||||||||||||||||||
| 69 | 0 | $record .= sprintf "City: %s\n",$self->City; | |||||||||||||||||||||||||||
| 70 | 0 | $record .= sprintf "StateProv: %s\n",$self->StateProv; | |||||||||||||||||||||||||||
| 71 | 0 | $record .= sprintf "PostalCode: %s\n",$self->PostalCode; | |||||||||||||||||||||||||||
| 72 | 0 | $record .= sprintf "Country: %s\n",$self->Country; | |||||||||||||||||||||||||||
| 73 | 0 | $record .= sprintf "Comment: %s\n",$self->Comment; | |||||||||||||||||||||||||||
| 74 | 0 | $record .= sprintf "RegDate: %s\n",$self->RegDate; | |||||||||||||||||||||||||||
| 75 | 0 | $record .= sprintf "Updated: %s\n",$self->Updated; | |||||||||||||||||||||||||||
| 76 | 0 | $record .= sprintf "Phone: %s\n",$self->Phone; | |||||||||||||||||||||||||||
| 77 | 0 | $record .= sprintf "Email: %s\n",$self->Email; | |||||||||||||||||||||||||||
| 78 | 0 | return $record; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 12 | ▶ | sub Type { | ||||||||||||||||||||||||||
|
Subroutine
Type: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 82 | 12 | my $self = shift; | |||||||||||||||||||||||||||
| 83 | 12 | ▶ | $self->{Type} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 12 | return $self->{Type}; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | These methods are the accessors/mutators for the fields found in the Whois record. | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =over 4 | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | =item B<Type> - get/set the contact type | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =item B<Name> - get/set the contact name | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =item B<Handle> - get/set the contact handle | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =item B<Company> - get/set the company | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | =item B<Address> - get/set the address | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | =item B<City> - get/set the city | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | =item B<StateProv> - get/set the state or province | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =item B<PostalCode> - get/set the postal code | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | =item B<Country> - get/set the country | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | =item B<RegDate> - get/set the registration date | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =item B<Updated> - get/set the last updated date | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =item B<Phone> - get/set the contact phone number | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | =item B<Email> - get/set the contact email address | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =item B<Comment> - get/set the public comment | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | =back | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | =cut | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 20 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=5 SCAR=17.8
| |||||||||||||||||||||||||||||
| 126 | 20 | my $self = shift; | |||||||||||||||||||||||||||
| 127 | 20 | my $name = $AUTOLOAD; | |||||||||||||||||||||||||||
| 128 | 20 | $name =~ s/.*://; | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 20 | ▶ | return if $name eq 'DESTROY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 13 | ▶ | if ($name !~ /^_/ && exists $self->{$name}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $name =~ /^_/ and exists $self->{$name}
MC/DC0%0/2
not $name =~ /^_/ and exists $self->{$name}
not $name =~ /^_/
exists $self->{$name}
Truth table33%1/3
not(A) and B
A= not $name =~ /^_/B= exists $self->{$name}
| |||||||||||||||||||||||||||||
| 133 | 13 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | 0 | return $self->{$name} = shift; | |||||||||||||||||||||||||||
| 135 | } else { | ||||||||||||||||||||||||||||
| 136 | 13 | return $self->{$name}; | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 0 | croak "Undefined subroutine \&$AUTOLOAD called"; | |||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | Todd Caine <todd.caine at gmail.com> | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | Copyright (c) 2004-2011 Todd Caine. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | =cut | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 7 | 1; | |||||||||||||||||||||||||||
| 154 | __END__ | ||||||||||||||||||||||||||||