The code is exactly the same, afaict. Here's the relevant code (note, it's ugly, most of it written before I know much perl).
script.pl:
opendir(DIR, $MyApp::Conf::SUBMITROOT) or die "Can't read dir: $!";
foreach (grep /^\d+(?:-\d+)?\.\d+$|^[\-\w]+\.\d+(?:\.jpg)?$|^set\.\d
++(?:-\d+)?\.\d+\.jpg$/, readdir DIR) {
$h = {};
$h->{File} = $_;
if (/^(\d+(?:-\d+)?)\.(\d+)$/) {
...
} elsif (/^set\.(\d+(-\d+)?).(\d+)\.jpg$/) { # this is the case we
+'re hitting
$h->{Set} = $1;
$h->{Set} .= "-1" unless $2;
$h->{Timestamp} = $3;
$h->{Pic} = 1;
my $curpic = $db->GetSetPictures({SetID => $h->{Set}, PicID => 0
+});
$h->{New} = not keys %$curpic;
} else {
warn "Unknown file: $_";
next;
}
----
in the $db object:
sub GetSetPictures {
my $self = shift;
my ($param) = @_;
croak "Bad params" unless exists $param->{SetID};
$param->{Self} = "/inv/sets/$param->{SetID}" unless exists $param->{
+Self};
my ($setinfo) = $self->GetSetInfo({Set => $param->{SetID}});
...
sub GetSetInfo {
my $self = shift;
my ($param) = @_;
my %where;
if (exists $param->{Set}) {
if ($param->{Set} eq '*') {
...
} else {
if ($param->{Set} =~ /-\d/) {
$where{ID} = $param->{Set}; # this is our case in all 3 itera
+tions
} else {
...
}
}
} else {
...
}
my @res = MyApp::Sets->search_where(%where); # Class::DBI object wi
+th the AbstractSearch plugin
...
|