Simple question: how do I start and stop a Perl script? For example a very simple script at end of this message will connect to the database and poll it forever to a value and update the database. How do I start and stop it?
Thanks!
-----------------------------------------------
#!/usr/bin/perl -w
use DBI;
$DSN = "DBI:mysql:database=guestdb";
my $dbh = DBI->connect($DSN) || die "Can't connect";
while ( 1 ) {
my $qs = $dbh->prepare("SELECT * FROM guestTbl");
$qs->execute();
while (my $rs=$qs->fetchrow_hashref()) {
print "Name: ",$rs->{'name'}," EMail: ",$rs->{'email'};
print " msgFrom: ",$rs->{'msgFrom'},"\n";
}
my $qs = $dbh->prepare("UPDATE guestTbl SET name='Bob'");
$qs->execute();
}
$qs->finish();
$dbh->disconnect;
exit;
|