/usr/share/perl5/WWW/CNic/NG.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 | # $Id: NG.pm,v 1.10 2011/05/13 13:31:49 gavin Exp $
# Copyright (c) 2011 CentralNic Ltd. This program is Free Software; you
# can use it and/or modify it under the same terms as Perl itself.
package WWW::CNic::NG;
use WWW::CNic;
use strict;
our $AUTOLOAD;
sub new {
use Data::Dumper;
my $package = shift(@_);
my $self = bless({'package' => $package}, $package);
my %params = @_;
foreach my $name (keys(%params)) {
$self->{$name} = $params{$name};
}
return $self;
}
sub AUTOLOAD {
my ($self, %params) = @_;
$AUTOLOAD =~ s/^$self->{'package'}:://g;
return if ($AUTOLOAD eq 'DESTROY');
my $query = WWW::CNic->new(
'command' => $AUTOLOAD,
'test' => $self->{'test'},
'username' => $self->{'username'},
'password' => $self->{'password'},
'domain' => $params{'domain'},
'host' => $self->{'host'},
);
$query->set(%params);
return $query->execute;
};
=pod
=head1 NAME
WWW::CNic::NG - a next generation interface to C<WWW:CNic>.
=head1 USAGE
#!/usr/bin/perl
use WWW::CNic::NG;
use strict;
my $cnic = WWW::CNic::NG->new(
'username' => 'H12345',
'password' => 'password',
'test' => 1, # run against the test database
);
# $response is a WWW::CNic::Response submodule:
my $response = $cnic->whois('domain' => 'example.uk.com');
=head1 SYNOPSIS
C<WWW::CNIC::NG> provides a simpler and more consistent interface to the
C<WWW::CNIC> module. It allows you to reuse the same object for multiple
API calls, and provides Toolkit commands as methods of the object.
=head1 Executing Toolkit Commands
If you have used C<WWW:CNic> you will be familiar with using it like so:
my $query = WWW::CNic->new(
'command' => 'whois',
'username' => 'H12345',
'password' => 'password',
'domain' => 'example.uk.com',
);
$query->set(%more_params);
# $response is a WWW::CNic::Response submodule:
my $response = $query->execute;
This is somewhat cumbersome compared to the earlier example.
C<WWW::CNIC::NG> serves to tidy up some of this mess.
Instead of specifying the desired command as a parameter supplied to the
constructor, you simply call the method you want to use on the
C<WWW::CNIC::NG> object. The method's parameters are then used to
prepare a query, and the response from the server is returned from the
method.
=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::Cookbook>
=item *
L<WWW::CNic::Simple>
=back
=cut
1;
|