Subject: | Change request |
Date: | Wed, 03 Jul 2013 15:54:49 +0200 |
To: | bug-Nmap-Parser [...] rt.cpan.org |
From: | Michael Zedeler <mz [...] leasingborsen.dk> |
The current implementation of list getters for things like osfamily are
cumbersome to use and not very perlish.
If I want to get all the available osfamily names, as I understand it, I
have to write something like this:
my @families;
my $i = 0;
while(1) {
my $family = $os->osfamily($i);
break if $family eq $osfamilies[$i-1];
push @families, $family;
$i++;
}
If the method call just returned an array, getting any part of the list
would be simple:
# get first os family
$os->osfamily()[0];
# get last os family
$os->osfamily()[-1];
# get the count of os families
scalar $os->osfamily();
The fact that $os->osfamilies($i) returns the last item on the list for
any number of $i greater that the last index is making it even harder to
work around this problem, since you don't have any simple stopping
condition.
I don't mind writing a patch for this.