in reply to Re^10: Class::DBI::AbstractSearch and SpeedyCGI
in thread Class::DBI::AbstractSearch and SpeedyCGI
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 ...
-- zigdon
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^12: Class::DBI::AbstractSearch and SpeedyCGI
by perrin (Chancellor) on Oct 05, 2005 at 14:18 UTC | |
by zigdon (Deacon) on Oct 12, 2005 at 03:19 UTC | |
by perrin (Chancellor) on Oct 20, 2005 at 14:29 UTC | |
by zigdon (Deacon) on Oct 30, 2005 at 04:59 UTC |