in reply to How to store objects as arrays in other objects

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().

Replies are listed 'Best First'.
Re^2: How to store objects as arrays in other objects
by halfbaked (Sexton) on Dec 07, 2008 at 22:26 UTC
    Yes, that code looked junkie, but I wasn't sure how to clean it up.

    Thanks.