恥ずかしい勘違いから生まれた、DHCP6の不要かつ部分的な実装
Revision | bd1a0e671c5423fd4ace1015ec4cb7cff8beb076 (tree) |
---|---|
Time | 2021-08-12 21:52:04 |
Author | dyknon <dyknon@user...> |
Commiter | dyknon |
fix errrors
@@ -52,9 +52,11 @@ sub new { | ||
52 | 52 | my @ooro = grep{$_->code == DHCP6_OPT_ORO}@{$opts{options}}; |
53 | 53 | die "there are multiple option request options" if(@ooro >= 2); |
54 | 54 | if(@{$opts{request}}){ |
55 | - die if(!$ooro[0]->isa(Net::DHCP6::Option::OptionRequest)); | |
56 | 55 | @{$opts{options}} = grep{$_->code != DHCP6_OPT_ORO}@{$opts{options}}; |
57 | - push @{$opts{request}}, $ooro[0]->all_elems if(@ooro); | |
56 | + if(@ooro){ | |
57 | + die if(!$ooro[0]->isa("Net::DHCP6::Option::OptionRequest")); | |
58 | + push @{$opts{request}}, $ooro[0]->all_elems | |
59 | + }; | |
58 | 60 | push @{$opts{options}}, |
59 | 61 | d6opt_new_option_request(list => @{$opts{request}}); |
60 | 62 | } |
@@ -27,20 +27,21 @@ sub new { | ||
27 | 27 | } |
28 | 28 | $class->new(@label); |
29 | 29 | }else{ |
30 | - push @label, "" if($_[$#_] ne ""); | |
31 | - if(join "", map{length $_ > 63} @_){ | |
30 | + my @label = @_; | |
31 | + push @label, "" if($label[$#label] ne ""); | |
32 | + if(join "", map{length $_ > 63} @label){ | |
32 | 33 | die "length of domain label > 63"; |
33 | 34 | } |
34 | - if(length join(".", @_) > 254){ | |
35 | + if(length join(".", @label) > 254){ | |
35 | 36 | die "length of domain name > 255"; |
36 | 37 | } |
37 | 38 | if(join "", |
38 | 39 | map{$_ !~ /^[A-Za-z](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/} |
39 | - @_[0 .. ($#_-1)] | |
40 | + @label[0 .. ($#label-1)] | |
40 | 41 | ){ |
41 | 42 | die "invalid domain name"; |
42 | 43 | } |
43 | - my $self = [@_]; | |
44 | + my $self = [@label]; | |
44 | 45 | bless $self, $class; |
45 | 46 | } |
46 | 47 | } |