Net-Whois-RIPE-1.23/0000755000076400007650000000000010420763542013331 5ustar pgampepgampeNet-Whois-RIPE-1.23/test.cfg0000644000076400007650000000147410420763542014777 0ustar pgampepgampe############################################################################### # Net::Whois::RIPE - implementation of RIPE Whois. # Copyright (C) 2005 Paul Gampe, Kevin Baker # vim:tw=78:ts=4 ############################################################################### # If you have access to a whois server on your network you can set the hostname # here and it will be used to validate the test suite. If you do not have one, # then those tests requiring a server will be skipped during the test phase. # TODO do this via a prompt in Build.PL #$HOST = "whois.apnic.net"; $HOST = "localhost"; $SOURCE = "apnic"; @TEMPLATES = qw( as-block as-set aut-num domain inet-rtr inet6num inetnum key-cert limerick mntner person role route route-set filter-set peering-set rtr-set irt ); 1; Net-Whois-RIPE-1.23/MANIFEST0000644000076400007650000000162010420763542014461 0ustar pgampepgampeBuild.PL ChangeLog MANIFEST This list of files META.yml Makefile.PL README lib/Net/Whois/RIPE.pm lib/Net/Whois/RIPE.pod lib/Net/Whois/RIPE/Iterator.pm lib/Net/Whois/RIPE/Iterator.pod lib/Net/Whois/RIPE/Object.pm lib/Net/Whois/RIPE/Object.pod lib/Net/Whois/RIPE/Object/Template.pm perl-Net-Whois-RIPE.spec t/01_test.t t/02_net_whois_ripe.t t/03_template.t t/03_template_as-macro.obj t/03_template_aut-num.obj t/03_template_blah.obj t/03_template_domain.obj t/03_template_inet-rtr.obj t/03_template_inet6num.obj t/03_template_inetnum.obj t/03_template_key-cert.obj t/03_template_mntner.obj t/03_template_person.obj t/03_template_role.obj t/03_template_route.obj t/06_iterator.t t/10_object_general.obj t/10_object_general.t t/11_object_empty.t t/11_object_empty_1.obj t/11_object_empty_2.obj t/11_object_empty_3.obj t/12_object_large.obj t/12_object_large.t t/20_object_template.t t/common.pl test.cfg update.pl Net-Whois-RIPE-1.23/update.pl0000644000076400007650000000136510420763542015155 0ustar pgampepgampe#!/usr/bin/perl ############################################################################### # Net::Whois::RIPE - implementation of RIPE Whois. # Copyright (C) 2005 Paul Gampe, Kevin Baker # vim:tw=78:ts=4 ############################################################################### use strict; BEGIN { require "t/common.pl" }; use vars qw($HOST @TEMPLATES); $|=1; foreach my $t (@TEMPLATES) { print "fetching $t ... "; my $cmd = "whois -h $HOST -- -t $t"; my $ret = `$cmd`; $ret =~ s/^\[.*\n//mg; $ret =~ s/^%.*\n//mg; $ret =~ s/^\n//mg; $ret =~ s/\n\n//mg; print "ok\n"; my $file = "t/03_template_$t.obj"; print "writing $file ... "; open(FH,"> $file") or die("could not open $file\n"); print FH $ret; close(FH); print "ok\n"; } Net-Whois-RIPE-1.23/t/0000755000076400007650000000000010420763542013574 5ustar pgampepgampeNet-Whois-RIPE-1.23/t/03_template_person.obj0000644000076400007650000000112410420763542017771 0ustar pgampepgampeperson: [mandatory] [single] [lookup key] address: [mandatory] [multiple] [ ] country: [mandatory] [single] [ ] phone: [mandatory] [multiple] [ ] fax-no: [optional] [multiple] [ ] e-mail: [mandatory] [multiple] [lookup key] nic-hdl: [mandatory] [single] [primary/look-up key] remarks: [optional] [multiple] [ ] notify: [optional] [multiple] [inverse key] mnt-by: [mandatory] [multiple] [inverse key] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/03_template_mntner.obj0000644000076400007650000000131610420763542017771 0ustar pgampepgampemntner: [mandatory] [single] [primary/look-up key] descr: [mandatory] [multiple] [ ] country: [optional] [single] [ ] admin-c: [mandatory] [multiple] [inverse key] tech-c: [optional] [multiple] [inverse key] upd-to: [mandatory] [multiple] [inverse key] mnt-nfy: [optional] [multiple] [inverse key] auth: [mandatory] [multiple] [ ] remarks: [optional] [multiple] [ ] notify: [optional] [multiple] [inverse key] mnt-by: [mandatory] [multiple] [inverse key] referral-by: [mandatory] [single] [inverse key] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/11_object_empty_1.obj0000644000076400007650000000000010420763542017463 0ustar pgampepgampeNet-Whois-RIPE-1.23/t/12_object_large.t0000644000076400007650000000174710420763542016714 0ustar pgampepgampeBEGIN { $| = 1; print "1..8\n"; } END {print "not ok 1\n" unless $loaded;} use Net::Whois::RIPE::Object; $loaded = 1; print "ok 1\n"; sub test { local($^W)=0; my($num,$true,$msg)=@_; print($true ? "ok $num\n" : "not ok $num $msg\n"); } my $o; my $file = $0; $file =~ s/\.t$/\.obj/; test(2,open(FH,$file),"cannot open $file: $!"); my $cnt = 0; my $success = 0; my $attributes = 0; my $person = 0; while ($o = Net::Whois::RIPE::Object->new(\*FH)) { $cnt++; $success += ($o->success ? 1 : 0); $attributes += ($o->attributes ? 1 : 0); $person += ($o->person ? 1 : 0); } # $i == 3+291 after this run test(3,close(FH),"error closing file: $!"); test(4,!($cnt>291),"more than 291 person objects parsed"); test(5,!($cnt<291),"less than 291 person objects parsed"); test(6,($success==291),"not all objects parsed successfully"); test(7,($attributes==291),"not all objects parsed attributes successfully"); test(8,($person==291),"not all objects parsed person attribute successfully"); exit 0; Net-Whois-RIPE-1.23/t/11_object_empty.t0000644000076400007650000000271410420763542016752 0ustar pgampepgampeBEGIN { $| = 1; print "1..13\n"; } END {print "not ok 1\n" unless $loaded;} use Net::Whois::RIPE::Object; $loaded = 1; print "ok 1\n"; sub test { local($^W)=0; my($num,$true,$msg)=@_; print($true ? "ok $num\n" : "not ok $num $msg\n"); } # this test tests an empty input handles my $o; # test case 1. totally empty my $file = $0; $file =~ s/\.t$/_1\.obj/; test(2,open(FH,$file),"cannot open $file: $!"); test(3,!($o = Net::Whois::RIPE::Object->new(\*FH)), "object constructor should have failed"); test(4,close(FH),"unable to close file: $!"); test(5,Net::Whois::RIPE::Object->errstr eq "no lines read from handle", "mismatch on error message for empty file"); # test case 2. just newlines $file = $0; $file =~ s/\.t$/_2\.obj/; test(6,open(FH,$file),"cannot open $file: $!"); test(7,!($o = Net::Whois::RIPE::Object->new(\*FH)), "object constructor should have failed"); test(8,close(FH),"unable to close file: $!"); test(9,Net::Whois::RIPE::Object->errstr eq "content is all whitespace", "mismatch on error message for new lines only file"); # test case 3. just newlines, tabs and spaces $file = $0; $file =~ s/\.t$/_3\.obj/; test(10,open(FH,$file),"cannot open $file: $!"); test(11,!($o = Net::Whois::RIPE::Object->new(\*FH)), "object constructor should have failed"); test(12,close(FH),"unable to close file: $!"); test(13,Net::Whois::RIPE::Object->errstr eq "content is all whitespace", "mismatch on error message for newlines,tabs & whitespace file"); exit 0; Net-Whois-RIPE-1.23/t/11_object_empty_3.obj0000644000076400007650000000004710420763542017500 0ustar pgampepgampe Net-Whois-RIPE-1.23/t/03_template_aut-num.obj0000644000076400007650000000167110420763542020060 0ustar pgampepgampeaut-num: [mandatory] [single] [primary/look-up key] as-name: [mandatory] [single] [ ] descr: [mandatory] [multiple] [ ] country: [mandatory] [single] [ ] member-of: [optional] [multiple] [ ] import: [optional] [multiple] [ ] export: [optional] [multiple] [ ] default: [optional] [multiple] [ ] remarks: [optional] [multiple] [ ] admin-c: [mandatory] [multiple] [inverse key] tech-c: [mandatory] [multiple] [inverse key] cross-mnt: [optional] [multiple] [inverse key] cross-nfy: [optional] [multiple] [inverse key] notify: [optional] [multiple] [inverse key] mnt-lower: [optional] [multiple] [inverse key] mnt-routes: [optional] [multiple] [inverse key] mnt-by: [mandatory] [multiple] [inverse key] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/03_template_inetnum.obj0000644000076400007650000000147310420763542020151 0ustar pgampepgampeinetnum: [mandatory] [single] [primary/look-up key] netname: [mandatory] [single] [lookup key] descr: [mandatory] [multiple] [ ] country: [mandatory] [multiple] [ ] admin-c: [mandatory] [multiple] [inverse key] tech-c: [mandatory] [multiple] [inverse key] rev-srv: [optional] [multiple] [inverse key] status: [mandatory] [single] [ ] remarks: [optional] [multiple] [ ] notify: [optional] [multiple] [inverse key] mnt-by: [mandatory] [multiple] [inverse key] mnt-lower: [optional] [multiple] [inverse key] mnt-routes: [optional] [multiple] [inverse key] mnt-irt: [optional] [multiple] [inverse key] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/02_net_whois_ripe.t0000644000076400007650000000205110420763542017276 0ustar pgampepgampeuse Module::Build; use Test::More tests => 6; use strict; BEGIN { use_ok('Net::Whois::RIPE'); use_ok('Net::Whois::RIPE::Iterator'); use_ok('Net::Whois::RIPE::Object'); use_ok('Net::Whois::RIPE::Object::Template'); } my $build = Module::Build->current; # source test vars from M:B my $HOST = $build->notes('host'); my $w = new Net::Whois::RIPE($HOST); isa_ok($w, 'Net::Whois::RIPE', 'created a whois ripe object ok'); can_ok($w, qw( connect query_iterator template verbose_template query update max_read_size disconnect search_all fast_raw set_persistance find_less find_more find_all_more no_recursive no_referral no_sugar no_filtering no_grouping persistant sync inverse_lookup primary_only source type port server debug ) ); exit; Net-Whois-RIPE-1.23/t/10_object_general.t0000644000076400007650000000446110420763542017231 0ustar pgampepgampeBEGIN { $| = 1; print "1..30\n"; } END {print "not ok 1\n" unless $loaded;} use Net::Whois::RIPE::Object; $loaded = 1; print "ok 1\n"; sub test { local($^W)=0; my($num,$true,$msg)=@_; print($true ? "ok $num\n" : "not ok $num $msg\n"); } my $o; my $file = $0; $file =~ s/\.t$/\.obj/; test(2,open(FH,$file),"cannot open $file: $!"); test(3,$o = Net::Whois::RIPE::Object->new(\*FH), "object constructor failed".Net::Whois::RIPE::Object->errstr); test(4,close(FH),"error closing file: $!"); test(5,$o->success==1,"failed to parse $file"); # now pull all that back out my @addy; test(6,($o->person eq 'Firstname Lastname'),"person method failed"); test(7,@addy = $o->address,"address method failed"); test(8,($addy[0] eq 'Address 1'),"add method failed"); test(9,($addy[1] eq 'Address 2'),"add method failed"); test(10,($o->country eq 'AU'),"country method failed"); test(11,($o->phone eq '+11-1-1111-1111'),"phone method failed"); test(12,($o->fax_no eq '+11-1-1111-1111'),"fax method failed"); test(13,($o->e_mail eq 'nobody@nowhere.test'),"e_mail method failed"); test(14,($o->nic_hdl eq 'AA11-AA'),"nic_hdl method failed"); test(15,($o->remarks eq 'remarks remarks'),"remarks failed"); test(16,($o->notify eq 'nobody@nowhere.test'),"notify method failed"); test(17,($o->mnt_by eq 'MAINT-AAAAA-AA'),"mnt_by method failed"); test(18,($o->changed eq 'nobody@nowhere.test 19990909'),"changed method failed"); test(19,($o->source eq 'TEST'),"source method failed"); # try a method that should not exist my @temp; test(20,defined($o->blah)==0,"blah method succeeded!"); # try to add reserved attributes test(21,defined($o->add('content','val'))==0,"added reserved attribute!"); test(22,defined($o->add('methods','val'))==0,"added reserved attribute!"); test(23,defined($o->add('attributes','va'))==0,"added reserved attribute!"); test(24,defined($o->add('warning','val'))==0,"added reserved attribute!"); test(25,defined($o->add('error','val'))==0,"added reserved attribute!"); test(26,defined($o->add('debug','val'))==0,"added reserved attribute!"); test(27,defined($o->add('_err','val'))==0,"added reserved attribute!"); test(28,defined($o->add('_wrn','val'))==0,"added reserved attribute!"); test(29,defined($o->add('_ok','val'))==0,"added reserved attribute!"); test(30,defined($o->add('parse','val'))==0,"added reserved attribute!"); exit 0; Net-Whois-RIPE-1.23/t/01_test.t0000644000076400007650000000071710420763542015245 0ustar pgampepgampeuse Test; use Carp; use strict; BEGIN { require "t/common.pl", plan tests => 5 }; my $w; my $DEBUG = 1; use vars qw($HOST); eval { require Net::Whois::RIPE; return 1;}; ok($@,''); croak() if $@; ok($w = Net::Whois::RIPE->debug($DEBUG)==$DEBUG); ok($w = Net::Whois::RIPE->debug(0)==0); eval { $w = Net::Whois::RIPE->new($HOST); croak() unless $w; }; skip(!defined($w),defined($w)); # these tests should fail. ok(!($w = Net::Whois::RIPE->new)); exit 0; Net-Whois-RIPE-1.23/t/03_template_domain.obj0000644000076400007650000000140510420763542017734 0ustar pgampepgampedomain: [mandatory] [single] [primary/look-up key] descr: [mandatory] [multiple] [ ] admin-c: [mandatory] [multiple] [inverse key] tech-c: [mandatory] [multiple] [inverse key] zone-c: [mandatory] [multiple] [inverse key] nserver: [optional] [multiple] [inverse key] sub-dom: [optional] [multiple] [inverse key] dom-net: [optional] [multiple] [ ] remarks: [optional] [multiple] [ ] notify: [optional] [multiple] [inverse key] mnt-by: [optional] [multiple] [inverse key] mnt-lower: [optional] [multiple] [inverse key] refer: [optional] [single] [ ] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/03_template_inet-rtr.obj0000644000076400007650000000131510420763542020231 0ustar pgampepgampeinet-rtr: [mandatory] [single] [primary/look-up key] descr: [mandatory] [multiple] [ ] alias: [optional] [multiple] [ ] local-as: [mandatory] [single] [inverse key] ifaddr: [mandatory] [multiple] [lookup key] peer: [optional] [multiple] [ ] member-of: [optional] [multiple] [inverse key] remarks: [optional] [multiple] [ ] admin-c: [mandatory] [multiple] [inverse key] tech-c: [mandatory] [multiple] [inverse key] notify: [optional] [multiple] [inverse key] mnt-by: [mandatory] [multiple] [inverse key] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/10_object_general.obj0000644000076400007650000000066710420763542017544 0ustar pgampepgampe % Rights restricted by copyright. See http://www.apnic.net/db/dbcopyright.html person: Firstname Lastname address: Address 1 address: Address 2 country: AU phone: +11-1-1111-1111 fax-no: +11-1-1111-1111 e-mail: nobody@nowhere.test nic-hdl: AA11-AA remarks: remarks remarks notify: nobody@nowhere.test mnt-by: MAINT-AAAAA-AA changed: nobody@nowhere.test 19990909 source: TEST Net-Whois-RIPE-1.23/t/03_template_role.obj0000644000076400007650000000135710420763542017434 0ustar pgampepgamperole: [mandatory] [single] [lookup key] address: [mandatory] [multiple] [ ] country: [mandatory] [single] [ ] phone: [mandatory] [multiple] [ ] fax-no: [optional] [multiple] [ ] e-mail: [mandatory] [multiple] [lookup key] trouble: [optional] [multiple] [ ] admin-c: [mandatory] [multiple] [inverse key] tech-c: [mandatory] [multiple] [inverse key] nic-hdl: [mandatory] [single] [primary/look-up key] remarks: [optional] [multiple] [ ] notify: [optional] [multiple] [inverse key] mnt-by: [mandatory] [multiple] [inverse key] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/03_template_as-macro.obj0000644000076400007650000000153710420763542020175 0ustar pgampepgampe % Rights restricted by copyright. See http://www.apnic.net/db/dbcopyright.html as-macro: [mandatory] [single] [primary/look-up key] descr: [mandatory] [multiple] [ ] country: [optional] [single] [ ] as-list: [mandatory] [multiple] [ ] guardian: [optional] [single] [ ] tech-c: [mandatory] [multiple] [inverse key] admin-c: [mandatory] [multiple] [inverse key] remarks: [optional] [multiple] [ ] notify: [optional] [multiple] [inverse key] mnt-by: [mandatory] [multiple] [inverse key] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/03_template_route.obj0000644000076400007650000000174410420763542017631 0ustar pgampepgamperoute: [mandatory] [single] [primary/look-up key] descr: [mandatory] [multiple] [ ] country: [optional] [single] [ ] origin: [mandatory] [single] [primary/inverse key] holes: [optional] [multiple] [ ] member-of: [optional] [multiple] [ ] inject: [optional] [multiple] [ ] aggr-mtd: [optional] [single] [ ] aggr-bndry: [optional] [single] [ ] export-comps: [optional] [single] [ ] components: [optional] [single] [ ] remarks: [optional] [multiple] [ ] cross-mnt: [optional] [multiple] [inverse key] cross-nfy: [optional] [multiple] [inverse key] notify: [optional] [multiple] [inverse key] mnt-lower: [optional] [multiple] [inverse key] mnt-routes: [optional] [multiple] [inverse key] mnt-by: [mandatory] [multiple] [inverse key] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/11_object_empty_2.obj0000644000076400007650000000003010420763542017467 0ustar pgampepgampe Net-Whois-RIPE-1.23/t/common.pl0000644000076400007650000000025610420763542015424 0ustar pgampepgampeBEGIN { foreach (qw(test.cfg)) { -f and require "$_" and last; } # If your host cannot be contacted as localhost, change this $HOST ||= '127.0.0.1'; } 1; Net-Whois-RIPE-1.23/t/03_template_inet6num.obj0000644000076400007650000000140410420763542020231 0ustar pgampepgampeinet6num: [mandatory] [single] [primary/look-up key] netname: [mandatory] [single] [lookup key] descr: [mandatory] [multiple] [ ] country: [mandatory] [multiple] [ ] admin-c: [mandatory] [multiple] [inverse key] tech-c: [mandatory] [multiple] [inverse key] rev-srv: [optional] [multiple] [inverse key] status: [mandatory] [single] [ ] remarks: [optional] [multiple] [ ] notify: [optional] [multiple] [inverse key] mnt-by: [mandatory] [multiple] [inverse key] mnt-lower: [optional] [multiple] [inverse key] mnt-irt: [optional] [multiple] [inverse key] changed: [mandatory] [multiple] [ ] source: [mandatory] [single] [ ] Net-Whois-RIPE-1.23/t/03_template.t0000644000076400007650000000322010420763542016073 0ustar pgampepgampeuse strict; use Test; BEGIN { require "t/common.pl", plan tests => 98 }; eval { require Net::Whois::RIPE; return 1;}; ok($@,''); croak() if $@; use vars qw($HOST @TEMPLATES); my $w; my $i; my $DEBUG = 1; foreach my $t (@TEMPLATES) { $i = compare($i,$t,1); } # test a template that does not exist at all $i = compare($i,'blah'); # test passing no object to template my @q; # array for return of queries ok($w = Net::Whois::RIPE->new($HOST)); my $no_server = $w->connect() ? 0 : 1; skip($no_server,@q = $w->template(),0); # test # compare # there is a 03template_$cmp.obj file for each item in the @TEMPLATES # array. This is the saved response from a whois -t