Listing 5. Insert-appointment.pl
#!/usr/bin/perl -w
use strict;
use People;
use Appointments;
# Create a new People instance
my $people = new People;
# Create a new instance of Appointments
my $appointments = new Appointments;
# Set the current person by name
$people->set_current_person_by_name("Hadar", "Re'em")
|| die "Error retrieving person.";
# Add a new appointment with the current person
my $result = $appointments->add_appointment($people,
'October 22, 2000 18:30',
'October 22, 2000 19:00',
'Play games);
# Did it succeed?
if ($result)
{
print "Success!\n";
}
else
{
print "Could not insert: '$DBI::errstr'" unless $result;
}
Copyright © 1994 - 2019 Linux Journal. All rights reserved.