I think this looks a little better. You will have to test it to see if it works for you.
sub ip { my $self = shift; my $ip = shift || '0.0.0.0'; $self->{ip} = ($ip eq '0.0.0.0' && $self->{conf}{ip}) ? $self->{conf}{ip} : $ip; return $self->{ip}; } sub port { my $self = shift; my $port = shift || '7800'; $self->{port} = ($port eq '7800' && $self->{conf}{port}) ? $self->{conf}{port} : $port; return $self->{port}; }
In reply to Re: More concise way to write these accessors?
by $h4X4_|=73}{
in thread More concise way to write these accessors?
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |