Permalink
Browse files

Merge branch 'feature/moritz-attribute-order' into develop

  • Loading branch information...
2 parents edaf140 + 0729aab commit 2ecedfd63b325fe3257cb4993181a80fef0fac34 @arhuman arhuman committed Sep 17, 2012
Showing with 129 additions and 182 deletions.
  1. +3 −0 Changes
  2. +19 −4 lib/Net/Whois/Object.pm
  3. +3 −6 lib/Net/Whois/Object/AsBlock.pm
  4. +4 −7 lib/Net/Whois/Object/AsSet.pm
  5. +4 −7 lib/Net/Whois/Object/AutNum.pm
  6. +4 −7 lib/Net/Whois/Object/Domain.pm
  7. +4 −7 lib/Net/Whois/Object/FilterSet.pm
  8. +4 −7 lib/Net/Whois/Object/Inet6Num.pm
  9. +4 −6 lib/Net/Whois/Object/InetNum.pm
  10. +4 −7 lib/Net/Whois/Object/InetRtr.pm
  11. +4 −7 lib/Net/Whois/Object/Information.pm
  12. +3 −6 lib/Net/Whois/Object/Irt.pm
  13. +3 −6 lib/Net/Whois/Object/KeyCert.pm
  14. +3 −6 lib/Net/Whois/Object/Limerick.pm
  15. +3 −6 lib/Net/Whois/Object/Mntner.pm
  16. +3 −6 lib/Net/Whois/Object/Organisation.pm
  17. +3 −6 lib/Net/Whois/Object/PeeringSet.pm
  18. +3 −6 lib/Net/Whois/Object/Person.pm
  19. +3 −6 lib/Net/Whois/Object/Poem.pm
  20. +3 −6 lib/Net/Whois/Object/PoeticForm.pm
  21. +3 −6 lib/Net/Whois/Object/Response.pm
  22. +3 −6 lib/Net/Whois/Object/Role.pm
  23. +3 −6 lib/Net/Whois/Object/Route.pm
  24. +3 −6 lib/Net/Whois/Object/Route6.pm
  25. +3 −6 lib/Net/Whois/Object/RouteSet.pm
  26. +3 −6 lib/Net/Whois/Object/RtrSet.pm
  27. +3 −3 t/03-objects.t
  28. +1 −1 t/105-AsBlock.t
  29. +1 −1 t/115-Person.t
  30. +1 −1 t/120-Role.t
  31. +1 −1 t/125-AsSet.t
  32. +1 −1 t/130-Domain.t
  33. +1 −1 t/135-InetNum.t
  34. +1 −1 t/140-Inet6Num.t
  35. +1 −1 t/145-InetRtr.t
  36. +1 −1 t/150-RtrSet.t
  37. +1 −1 t/155-Mntner.t
  38. +1 −1 t/160-KeyCert.t
  39. +1 −1 t/165-Route.t
  40. +1 −1 t/167-Route6.t
  41. +1 −1 t/170-RouteSet.t
  42. +1 −1 t/175-PeeringSet.t
  43. +1 −1 t/180-Limerick.t
  44. +1 −1 t/185-Poem.t
  45. +1 −1 t/187-PoeticForm.t
  46. +1 −1 t/190-Organisation.t
  47. +1 −1 t/205-Irt.t
  48. +1 −1 t/210-FilterSet.t
  49. +3 −3 t/common.pl
View
@@ -1,6 +1,9 @@
Revision history for net-whois-ripe
+ A big thank you to Moritz Lenz from Noris Network AG
+ for all his patches :
- Fix new() to handle unfiltered option
+ - Preserve attribute order in constructor
2.00016 11 Sep 2012
- Depend on LWP::UserAgent instead of WWW::Mechanize
View
@@ -240,7 +240,7 @@ $type can be
'primary' Primary/Lookup key
'mandatory' Required for update creation
- 'optionnal' Optionnal for update/creation
+ 'optional' Optionnal for update/creation
'multiple' Can have multiple values
'single' Have only one value
'all' You can't specify attributes for this special type
@@ -254,9 +254,9 @@ Returns a list of attributes of the required type.
sub attributes {
my ( $self, $type, $ra_attributes ) = @_;
if ( not defined $type or $type =~ /all/i ) {
- return ( $self->attributes('mandatory'), $self->attributes('optionnal') );
+ return ( $self->attributes('mandatory'), $self->attributes('optional') );
}
- croak "Invalid attribute's type ($type)" unless $type =~ m/(all|primary|mandatory|optionnal|single|multiple)/i;
+ croak "Invalid attribute's type ($type)" unless $type =~ m/(all|primary|mandatory|optional|single|multiple)/i;
if ($ra_attributes) {
for my $a ( @{$ra_attributes} ) {
$self->{TYPE}{$type}{$a} = 1;
@@ -387,7 +387,7 @@ sub syncupdates_update {
Delete the object in the RIPE database through the web syncupdates interface.
Use the password passed as parameter to authenticate.
-The optionnal parmeter reason is used to explain why the object is deleted.
+The optional parmeter reason is used to explain why the object is deleted.
=cut
@@ -543,6 +543,21 @@ sub _multiple_attribute_setget {
return $self->{$attribute};
}
+=head2 B<_init( @options )>
+
+Initialize self with C<@options>
+
+=cut
+
+sub _init {
+ my ($self, @options) = @_;
+
+ while (my ($key, $val ) = splice(@options, 0, 2)) {
+ $self->$key( $val );
+ }
+}
+
+
=head2 B<_syncupdates_submit( $text, $password )>
Interact with the RIPE database through the web syncupdates interface.
@@ -40,17 +40,14 @@ Constructor for the Net::Whois::Object::AsBlock class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['as_block'] );
$self->attributes( 'mandatory', [ 'as_block', 'admin_c', 'tech_c', 'mnt_by', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'descr', 'remarks', 'org', 'notify', 'mnt_lower' ] );
+ $self->attributes( 'optional', [ 'descr', 'remarks', 'org', 'notify', 'mnt_lower' ] );
$self->attributes( 'single', [ 'as_block', 'source' ] );
$self->attributes( 'multiple', [ 'descr', 'remarks', 'org', 'admin_c', 'tech_c', 'notify', 'mnt_lower', 'mnt_by', 'changed' ] );
@@ -28,24 +28,21 @@ It defines a group of Autonomous Systems with the same routing policies.
=head1 METHODS
-=head2 new ( %options )
+=head2 new ( @options )
Constructor for the Net::Whois::Object::AsSet class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['as_set'] );
$self->attributes( 'mandatory', [ 'as_set', 'descr', 'tech_c', 'admin_c', 'mnt_by', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'members', 'mbrs_by_ref', 'remarks', 'notify' ] );
+ $self->attributes( 'optional', [ 'members', 'mbrs_by_ref', 'remarks', 'notify' ] );
$self->attributes( 'single', [ 'as_set', 'source' ] );
$self->attributes( 'multiple', [ 'descr', 'members', 'mbrs_by_ref', 'remarks', 'tech_c', 'admin_c', 'notify', 'mnt_by', 'changed' ] );
@@ -40,24 +40,21 @@ operated by one or more network operators – an Autonomous System (AS).
=head1 METHODS
-=head2 new ( %options )
+=head2 new ( @options )
Constructor for the Net::Whois::Object::AutNum class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['aut_num'] );
$self->attributes( 'mandatory', [ 'aut_num', 'as_name', 'descr', 'tech_c', 'admin_c', 'mnt_by', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'member_of', 'import', 'mp_import', 'export', 'mp_export', 'default', 'mp_default', 'remarks', 'notify', 'mnt_lower', 'mnt_routes' ] );
+ $self->attributes( 'optional', [ 'member_of', 'import', 'mp_import', 'export', 'mp_export', 'default', 'mp_default', 'remarks', 'notify', 'mnt_lower', 'mnt_routes' ] );
$self->attributes( 'single', [ 'aut_num', 'as_name', 'source' ] );
$self->attributes( 'multiple', [ 'descr', 'member_of', 'import', 'mp_import', 'export', 'mp_export', 'default', 'mp_default', 'remarks', 'admin_c', 'tech_c', 'notify', 'mnt_lower', 'mnt_routes', 'mnt_by', 'changed' ] );
@@ -35,24 +35,21 @@ name is written in fully qualified format, without a trailing " . "
=head1 METHODS
-=head2 new ( %options )
+=head2 new ( @options )
Constructor for the Net::Whois::Object::Domain class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['domain'] );
$self->attributes( 'mandatory', [ 'domain', 'descr', 'tech_c', 'admin_c', 'zone_c', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'org', 'nserver', 'ds_rdata', 'sub_dom', 'dom_net', 'remarks', 'notify', 'mnt_by', 'mnt_lower', 'refer' ] );
+ $self->attributes( 'optional', [ 'org', 'nserver', 'ds_rdata', 'sub_dom', 'dom_net', 'remarks', 'notify', 'mnt_by', 'mnt_lower', 'refer' ] );
$self->attributes( 'single', [ 'domain', 'refer', 'source' ] );
$self->attributes( 'multiple', [ 'descr', 'org', 'admin_c', 'tech_c', 'zone_c', 'nserver', 'ds_rdata', 'sub_dom', 'dom_net', 'remarks', 'notify', 'mnt_by', 'mnt_lower', 'changed' ] );
@@ -31,24 +31,21 @@ not want to see.
=head1 METHODS
-=head2 new ( %options )
+=head2 new ( @options )
Constructor for the Net::Whois::Object::FilterSet class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['filter_set'] );
$self->attributes( 'mandatory', [ 'filter_set', 'filter', 'mp_filter', 'source' ] );
- $self->attributes( 'optionnal', [ 'remarks', 'org', 'notify', 'mnt_lower' ] );
+ $self->attributes( 'optional', [ 'remarks', 'org', 'notify', 'mnt_lower' ] );
$self->attributes( 'single', [ 'filter_set', 'filter', 'mp_filter', 'source' ] );
$self->attributes( 'multiple', [ 'descr', 'remarks', 'org', 'tech_c', 'admin_c', 'notify', 'mnt_by', 'mnt_lower', 'changed' ] );
@@ -38,24 +38,21 @@ of IPv6 address space.
=head1 METHODS
-=head2 new ( %options )
+=head2 new ( @options )
Constructor for the Net::Whois::Object::Inet6Num class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['inet6num'] );
$self->attributes( 'mandatory', [ 'inet6num', 'netname', 'status', 'source' ] );
- $self->attributes( 'optionnal', [ 'org', 'remarks', 'notify', 'mnt_lower', 'mnt_routes', 'mnt_domains', 'mnt_irt' ] );
+ $self->attributes( 'optional', [ 'org', 'remarks', 'notify', 'mnt_lower', 'mnt_routes', 'mnt_domains', 'mnt_irt' ] );
$self->attributes( 'single', [ 'inet6num', 'netname', 'org', 'status', 'source' ] );
$self->attributes( 'multiple', [ 'descr', 'country', 'tech_c', 'admin_c', 'remarks', 'notify', 'mnt_by', 'mnt_lower', 'mnt_routes', 'mnt_domains', 'mnt_irt', 'changed' ] );
@@ -39,24 +39,22 @@ of IPv4 address space.
=head1 METHODS
-=head2 new ( %options )
+=head2 new ( @options )
Constructor for the Net::Whois::Object::InetNum class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['inetnum'] );
$self->attributes( 'mandatory', [ 'inetnum', 'netname', 'descr', 'country', 'tech_c', 'admin_c', 'status', 'mnt_by', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'org', 'remarks', 'notify', 'mnt_lower', 'mnt_routes', 'mnt_domains', 'mnt_irt' ] );
+ $self->attributes( 'optional', [ 'org', 'remarks', 'notify', 'mnt_lower', 'mnt_routes', 'mnt_domains', 'mnt_irt' ] );
$self->attributes( 'single', [ 'inetnum', 'netname', 'org', 'status', 'source' ] );
$self->attributes( 'multiple', [ 'descr', 'country', 'tech_c', 'admin_c', 'remarks', 'notify', 'mnt_by', 'mnt_lower', 'mnt_routes', 'mnt_domains', 'mnt_irt', 'changed' ] );
@@ -33,24 +33,21 @@ The inet-rtr object specifies routers.
=head1 METHODS
-=head2 new ( %options )
+=head2 new ( @options )
Constructor for the Net::Whois::Object::InetRtr class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['inet_rtr'] );
$self->attributes( 'mandatory', [ 'inet_rtr', 'descr', 'local_as', 'ifaddr', 'tech_c', 'admin_c', 'mnt_by', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'alias', 'interface', 'peer', 'mp_peer', 'member_of', 'remarks', 'org', 'notify' ] );
+ $self->attributes( 'optional', [ 'alias', 'interface', 'peer', 'mp_peer', 'member_of', 'remarks', 'org', 'notify' ] );
$self->attributes( 'single', [ 'inet_rtr', 'local_as', 'source' ] );
$self->attributes( 'multiple', [ 'descr', 'remarks', 'alias', 'ifaddr', 'interface', 'peer', 'mp_peer', 'member_of', 'org', 'tech_c', 'admin_c', 'notify', 'mnt_by', 'changed' ] );
@@ -21,23 +21,20 @@ information.
=head1 METHODS
-=head2 new ( %options )
+=head2 new ( @options )
Constructor for the Net::Whois::Object::Information class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'mandatory', ['comment'] );
- $self->attributes( 'optionnal', [] );
+ $self->attributes( 'optional', [] );
$self->attributes( 'multiple', ['comment'] );
return $self;
@@ -46,17 +46,14 @@ Constructor for the Net::Whois::Object::Irt class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['irt'] );
$self->attributes( 'mandatory', [ 'irt', 'address', 'e_mail', 'abuse_mailbox', 'tech_c', 'admin_c', 'auth', 'mnt_by', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'phone', 'fax_no', 'signature', 'encryption', 'org', 'remarks', 'irt_nfy', 'notify' ] );
+ $self->attributes( 'optional', [ 'phone', 'fax_no', 'signature', 'encryption', 'org', 'remarks', 'irt_nfy', 'notify' ] );
$self->attributes( 'single', [ 'irt', 'source' ] );
$self->attributes( 'multiple', [ 'address', 'phone', 'fax_no', 'e_mail', 'abuse_mailbox', 'signature', 'encryption', 'org', 'auth', 'remarks', 'tech_c', 'admin_c', 'irt_nfy', 'notify', 'mnt_by', 'changed' ] );
@@ -38,17 +38,14 @@ Constructor for the Net::Whois::Object::InetRtr class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['key_cert'] );
$self->attributes( 'mandatory', [ 'key_cert', 'certif', 'mnt_by', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'org', 'remarks', 'notify', 'admin_c', 'tech_c' ] );
+ $self->attributes( 'optional', [ 'org', 'remarks', 'notify', 'admin_c', 'tech_c' ] );
$self->attributes( 'single', [ 'key_cert', 'method', 'fingerpr', 'source' ] );
$self->attributes( 'multiple', [ 'owner', 'certif', 'org', 'remarks', 'tech_c', 'admin_c', 'notify', 'mnt_by', 'changed' ] );
@@ -34,17 +34,14 @@ Constructor for the Net::Whois::Object::Limerick class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['limerick'] );
$self->attributes( 'mandatory', [ 'limerick', 'text', 'admin_c', 'author', 'mnt_by', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'descr', 'remarks', 'notify' ] );
+ $self->attributes( 'optional', [ 'descr', 'remarks', 'notify' ] );
$self->attributes( 'single', [ 'limerick', 'source' ] );
$self->attributes( 'multiple', [ 'text', 'admin_c', 'author', 'mnt_by', 'changed', 'descr', 'remarks', 'notify' ] );
@@ -48,17 +48,14 @@ Constructor for the Net::Whois::Object::Mntner class
=cut
sub new {
- my ( $class, %options ) = @_;
+ my ( $class, @options ) = @_;
my $self = bless {}, $class;
-
- for my $key ( keys %options ) {
- $self->$key( $options{$key} );
- }
+ $self->_init(@options);
$self->attributes( 'primary', ['mntner'] );
$self->attributes( 'mandatory', [ 'mntner', 'descr', 'admin_c', 'auth', 'mnt_by', 'referral_by', 'changed', 'source' ] );
- $self->attributes( 'optionnal', [ 'org', 'tech_c', 'mnt_nfy', 'remarks', 'notify', 'abuse_mailbox', 'auth_override' ] );
+ $self->attributes( 'optional', [ 'org', 'tech_c', 'mnt_nfy', 'remarks', 'notify', 'abuse_mailbox', 'auth_override' ] );
$self->attributes( 'single', [ 'mntner', 'auth_override', 'auth', 'referral_by', 'source' ] );
$self->attributes( 'multiple', [ 'descr', 'admin_c', 'mnt_by', 'changed', 'org', 'tech_c', 'mnt_nfy', 'remarks', 'notify', 'abuse_mailbox' ] );
Oops, something went wrong.

0 comments on commit 2ecedfd

Please sign in to comment.