You're doing quite a lot of copying, which - it seems - is mostly unnecessary. For example, your next() method
sub next { my $self = shift; my @urls = @{$self->{urls}}; if (!@urls) { return undef; } my $url = pop(@urls); $self->{urls} = \@urls; return $url; }
could also be written as
sub next { my $self = shift; return pop @{$self->{urls}}; }
which should be functionally equivalent... Similarly add().
In reply to Re: How to store objects as arrays in other objects
by almut
in thread How to store objects as arrays in other objects
by halfbaked
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |