Net::Whois::ARIN::Organization - ARIN whois Organization record class


Net-Whois-ARIN documentation Contained in the Net-Whois-ARIN distribution.

Index


Code Index:

NAME

Top

Net::Whois::ARIN::Organization - ARIN whois Organization record class

SYNOPSIS

Top

  use Net::Whois::ARIN::Organization;

  my $org = Net::Whois::ARIN::Organization->new(
               OrgName    => 'Electric Lightwave Inc',
               OrgID      => 'ELIX',
               Address    => '4400 NE 77th Ave',
               City       => 'Vancouver',
               StateProv  => 'WA',
               PostalCode => '98662',
               Country    => 'US',
               Comment    => '',
               RegDate    => '1995-07-25',
               Updated    => '2001-05-17',
           );

  printf "%s is located in %s, %s\n",
         $org->OrgName,
         $org->City,
         $org->StateProv;

DESCRIPTION

Top

The Net::Whois::ARIN::Organization module is simple class which is used to store the attributes of an Organization record in ARIN's Whois server. Each attribute of the Organization record has an accessor/mutator of the same name.

METHODS

Top

new - create a Net::Whois::ARIN::Organization object
contacts - get/set Net::Whois::ARIN::Contact

This method accepts a list of Net::Whois::ARIN::Contact and associates these objects with the Organization record. If no arguments are specified, the method returns a list of Net::Whois::ARIN::Contact objects.

dump - return the current whois record
  print $o->dump;

ATTRIBUTES

Top

These methods are the accessors/mutators for the fields found in the Whois record.

OrgName - get/set the organization name
OrgID - get/set the organization id
Address - get/set the address
City - get/set the city
StateProv - get/set the state or province
PostalCode - get/set the postal code
Country - get/set the country
RegDate - get/set the registration date
Updated - get/set the last updated date
NetRange - get/set the network range
CIDR - get/set the CIDR netblock
NetName - get/set the network name
NetHandle - get/set the network handle
Parent - get/set the parent network handle
NetType - get/set the network type
Comment - get/set the public comment

AUTHOR

Top

Todd Caine <todd.caine at gmail.com>

COPYRIGHT AND LICENSE

Top


Net-Whois-ARIN documentation Contained in the Net-Whois-ARIN distribution.
package Net::Whois::ARIN::Organization;

use strict;
use Carp "croak";

our $AUTOLOAD;

sub new {
    my $class = shift;
    return bless { _contacts => [], @_ }, $class;
}

sub contacts {
    my $self = shift;
    $self->{_contacts} = [ @_ ] if @_;
    return @{ $self->{_contacts} };
}

sub dump {
    my $self = shift;
    my $record = sprintf "\nOrgName:    %s\n", $self->OrgName;
    $record .= sprintf "OrgID:      %s\n",$self->OrgID;
    $record .= sprintf("Address:    %s\n", $_) for @{ $self->Address };
    $record .= sprintf "City:       %s\n",$self->City;
    $record .= sprintf "StateProv:  %s\n",$self->StateProv;
    $record .= sprintf "PostalCode: %s\n",$self->PostalCode;
    $record .= sprintf "Country:    %s\n",$self->Country;
    $record .= sprintf "RegDate:    %s\n",$self->RegDate;
    $record .= sprintf "Updated:    %s\n\n",$self->Updated;

    $record .= sprintf "NetRange:   %s\n",$self->NetRange;
    $record .= sprintf "CIDR:       %s\n",$self->CIDR;
    $record .= sprintf "NetName:    %s\n",$self->NetName;
    $record .= sprintf "NetHandle:  %s\n",$self->NetHandle;
    $record .= sprintf "Parent:     %s\n",$self->Parent;
    $record .= sprintf "NetType:    %s\n",$self->NetType;
    $record .= sprintf "Comment:    %s\n",$self->Comment;
    $record .= sprintf "RegDate:    %s\n",$self->RegDate;
    $record .= sprintf "Updated:    %s\n",$self->Updated;

    foreach my $contact ( $self->contacts ) {
        $record .= sprintf "%sHandle: %s\n", $contact->Type, $contact->Handle;
        $record .= sprintf "%sName: %s\n", $contact->Type, $contact->Name;
        $record .= sprintf "%sPhone: %s\n", $contact->Type, $contact->Phone;
        $record .= sprintf "%sEmail: %s\n", $contact->Type, $contact->Email;
    }

    return $record;
}

sub Parent { 
    my $self = shift;
    $self->{Parent} = shift if @_;
    return $self->{Parent};
} 

sub AUTOLOAD {
    my $self = shift;
    my $name = $AUTOLOAD;
    $name =~ s/.*://;

    return if $name eq 'DESTROY';

    if ($name !~ /^_/ && exists $self->{$name}) {
        if (@_) {
            return $self->{$name} = shift;
        } else {
            return $self->{$name};
        }
    }

    croak "Undefined subroutine \&$AUTOLOAD called";
}

1;
__END__