{
# cat vers file
if ($l =~ m!href="(/projects/bacula/files/(.+?)/(.+?)/(.+?)/download)"!) {
- if ($cur && $cur->{date} && !exists $seen{$cur->{file}}) {
- push @{$cats{$cur->{cat}}}, $cur;
- $seen{$cur->{file}} = 1;
- }
-
$cur = {
dl => $1,
cat => $2,
}
# the size and the date are just after
- if ($l =~ m!<td>([\d\.]+ [KMG]B)</td>!) {
+ if ($cur && $l =~ m!<td>([\d\.]+ [KMG]B)</td>!) {
$cur->{size} = $1;
do {
$l = <FP>;
$cur->{date} = $1;
}
} while (!$cur->{date});
+
+ # once we have a full $cur element, we can store it
+ if (!exists $seen{$cur->{file}}) {
+ push @{$cats{$cur->{cat}}}, $cur;
+ $seen{$cur->{file}} = 1;
+ $cur = undef;
+ }
}
}
close(FP);