in reply to Possibly long lists and memory leaks
However, this still isn't entirely perfect. These are some examples from my current log that generate inconsistent results:sub length { my ($self, $uri); my $length = 1; if (ref($_[0])) { $self = shift; $uri = $self->{uri}; } else { $uri = shift; } while ($uri =~ m/((?:\{[^\}]+\})|(?:\[[^\]]+\]))/ig) { if ($1 =~ m/\{([^\}]+)\}/i) { my $temp = $1; $length *= ($temp =~ tr/,/,/); } elsif ($1 =~ m/\[([^\]]+)\]/i) { my ($start, $stop) = sort split('-',$1); $stop = $start+10 unless ($stop); if ($start =~ /\d+/) { #There is one or more digit, so we'll remove anything + else that might be there $start =~ s/\D+//g; $stop =~ s/\D+//g; } $length *= $stop - $start + 1; } } return $length; }
scalar($uriobj->as_list) $uriobj->length $uri 1 0 foo{011-047}bar 0 -398 foo[800-1199]bar 0 -348 foo[850-1199]bar 0 -298 foo[900-1199]bar 0 50 foo[001-50]bar 0 -97 foo[2-100]bar 0 -97 foo[2-100]bar 0 -7 foo[2-10]bar 1 0 foo{001-188}bar 0 -140 foo[01-20]bar 0 -3 foo[1-05]bar 0 -46 foo[53-100]bar 975 -23 foo[001+-+025]bar 9 6 foo{one,two,three}/[01-03]bar 27 6 foo{one[01-03],two,three}/[01-03]bar 0 -120 foo[2-13]/[01-12]bar 0 -120 foo[2-13]/[1-12]bar 0 -90 foo[2-13]/[1-9]bar 0 101 foo[0000-100]bar 0 41 foo[0000-40]bar 0 -10 foo[8-19]bar 0 -399 foo[600-1000]bar 1 0 foo{011-047}bar
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Possibly long lists and memory leaks
by waswas-fng (Curate) on Dec 03, 2002 at 19:23 UTC |