#!/usr/bin/perl use strict; use DBI; my $dbh; my $sth; my $status; my $sql_insert; my $pidm; my $location; my $time; my $dbname = "chipdb"; my $hostname = "quark.cs.earlham.edu"; # must pass the pidm, location, time to this script # time must be with year already added or "now" for keypad $pidm = $ARGV[0]; $location = $ARGV[1]; $time = $ARGV[2]; # inputing to the database from here $sql_insert = "INSERT INTO here_now VALUES ($pidm, '$location', '$time')"; $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$hostname") || die "test.pl - Can't connect, $DBI::errstr"; print "Connected\n"; $sth = $dbh->prepare($sql_insert) || die "test.pl - prepare error: ($sql_insert) $DBI::errstr"; $status = $sth->execute || die "test.pl - execute error: ($sql_insert) status=$status $DBI::errstr"; $dbh->disconnect(); exit; # use the C command system("./perlscript "billybob" "dennis door" "timestamp""); # to call this function or a similar one from perl.