Our website uses Perl to provide a simple mechanism for our HR staff to post vacancies on our website. It was developed by a third party, but they have long been thrilled, and unfortunately, we do not have Perl skills within the company. This is what happens when marketing people go around their own IT team!
I need to make a simple change for this application. Currently, the vacancy page says: "We currently have the following vacancies:", regardless of the availability of vacancies! Therefore, we want to change it so that this line is displayed only at the corresponding time points.
I could obviously start learning a little Perl, but we are already planning on replacing the site, and, of course, it will not use Perl. Therefore, since the solution will be trivial for those who have these skills, I thought I would ask for help.
The following is the procedure for listing vacancies.
sub list {
require HTTP::Date;
import HTTP::Date;
my $date = [split /\s+/, HTTP::Date::time2iso(time())]->[0];
my $dbh = DBI->connect($dsn, $user, $password)
|| die "cannot connect to $database: $!\n";
my $sql = <<EOSQL;
SELECT * FROM $table where expiry >= '$date' order by expiry
EOSQL
my $sth = $dbh->prepare($sql);
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
my $temp = $template;
$temp =~ s
my $job_spec = $ref->{'job_spec'};
...etc...
Key line while (my $ref = $sth->fetchrow_hashref()) {. I believe this says "so far I can remove another job from the returned record set ...". If I put my print statement before this line, it will always be displayed; after this line, and this was repeated for each vacancy.
How to determine that there are some vacancies that need to be displayed without prematurely moving around the returned recordset?
while if() ( while), . If any records then print "We currently have.." line. , .
, , , !