##
sub next {
my $self = $_[0];
our $arg; local *arg = \$_[1];
if (...) {
return 0;
} else {
$arg = ...;
return 1;
}
}
while ($i->next($arg)) {
...
}
####
sub next {
my ($self) = @_;
if (...) {
return;
} else {
return ...;
}
}
while (my ($arg) = $i->next()) {
...
}
####
while (my $arg = $i->next()) {
...
}