This file is indexed.

/usr/share/perl5/WWW/CNic/Simple.pm is in libwww-cnic-perl 0.38-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Copyright (c) 2011 CentralNic Ltd. All rights reserved. This program is
# free software; you can redistribute it and/or modify it under the same
# terms as Perl itself.
# $Id: Simple.pm,v 1.12 2011/05/13 13:31:49 gavin Exp $

package WWW::CNic::Simple;
@ISA = qw(Exporter);
@EXPORT = qw(&suffixes &check &whois);

use WWW::CNic;
use strict;

=pod

=head1 NAME

WWW::CNic::Simple - a procedural interface to WWW::CNic

=head1 SYNOPSIS

	#!/usr/bin/perl
	use WWW::CNic::Simple;

	my @suffixes = suffixes();

	my %results = check('test-domain', 'uk.com', 'uk.net');
	print "test-domain.uk.com is registered.\n" if ($results{'uk.com'} == 1);

	my %whois = whois('test-domain.uk.com');
	print "domain status: $whois{status}\n";

=head1 DESCRIPTION

This interface is intended for those who want a simplified view of the WWW::CNic library. It provides simple functions for querying the CentralNic system, making it ideal for one-liners and other tasks.

Please note that it is not possible to make domain registrations or modifications using C<WWW::CNic::Simple>.

=head1 FUNCTIONS

	my @suffixes = suffixes();

This function returns an array containing the currently live CentralNic suffixes.

	my %result = check($domain, @suffixes);

This function does an availability check on C<$domain> against the suffixes contained in C<@suffixes>. Note that if C<@suffixes> is omitted the check will run against all CentralNic domains.

The function returns a hash of the form:

	my %result = (	'uk.com'	=> 1,
			'uk.net'	=> 0,
			'eu.com'	=> 0);

where C<1> indicates that the domain is already registered.

	my %whois = whois($domain);

This function returns a hash containing whois data for the given C<$domain> This hash is of the form:

	my %whois =	{	chandle		=> {	postcode	=> 'SW6 4SN',
							country		=> 'UK',
							userid		=> 'C11480',
							fax		=> 'N/A',
							addr		=> "163 New King's Road, Fulham, London",
							name		=> 'Hostmaster',
							email		=> 'webservices@centralnic.com',
							phone		=> '020 7751 9000',
							company		=> 'CentralNic Ltd' },
				expires		=> '1001458800',
				status		=> 'Live',
				thandle		=> # as chandle above
				bhandle		=> # as chandle above
				registrant	=> 'CentralNic Ltd',
				domain		=> 'toolkit-test.uk.com',
				created		=> '1001458800'
			 };

=head1 COPYRIGHT

This module is (c) 2011 CentralNic Ltd. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

=head1 SEE ALSO

=over

=item *

http://toolkit.centralnic.com/

=item *

L<WWW::CNic>

=item *

L<WWW::CNic::Cookbook>

=back

=cut

our $HOSTNAME = 'toolkit.centralnic.com';
our $USE_SSL = 0;

sub suffixes { return WWW::CNic->new(host=>$HOSTNAME,command=>'suffixes')->execute()->suffixes() }

sub check {
	my $domain = shift;
	my @suffixes = @_;
	my $query = WWW::CNic->new(	command	=> 'search',
					domain	=> $domain,
					host	=> $HOSTNAME);
	$query->set(suffixlist => @suffixes) if (scalar @suffixes > 0);
	my $response = $query->execute();
	my %results;
	foreach my $suffix(@suffixes) {
		$results{$suffix} = ($response->is_registered($suffix) ? 1 : 0);
	}
	return %results;
}

sub whois {
	my $domain = shift;
	my %return;
	my $query = WWW::CNic->new(	command	=> 'whois',
					domain	=> $domain,
					host	=> $HOSTNAME);
	my $response = $query->execute();
	foreach my $key($response->keys()) {
		$return{$key} = $response->response($key);
	}
	return %return;
}

1;