package booker; require Exporter; our @ISA = ("Exporter"); sub Get_Booking_Course_Event { my $BookingID = shift; my $dbh = DBI->connect("DBI:mysql:database=foo", "bar", "baz") or die $DBI::errstr; my $sth; $sth = $dbh->prepare("SELECT * FROM booking WHERE BookingID = $BookingID") or die $dbh->errstr; $sth->execute(); $ref_booking = $sth->fetchrow_hashref; $sth = $dbh->prepare("SELECT * FROM event WHERE EventID = $ref_booking->{'EventID'}") or die $dbh->errstr; $sth->execute(); $ref_event = $sth->fetchrow_hashref; $sth = $dbh->prepare("SELECT * FROM course WHERE CourseID = $ref_booking->{'CourseID'}") or die $dbh->errstr; $sth->execute(); $ref_course = $sth->fetchrow_hashref; } our @EXPORT = qw/Get_Booking_Course_Event/; 1; #### my $ref_booking; my $ref_event; my $ref_course; &Get_Booking_Course_Event($ref->{'BookingID'}); # the arg in this sub cd be one of a number of # things depending on where in the script we are do_stuff_with($ref_booking, $ref_course, $ref_event); #### &Get_Booking_Course_Event($ref->{'BookingID'}); # the arg in this sub cd be one of a number of # things depending on where in the script we are do_stuff_with($booker::ref_booking, $booker::ref_course, $booker::ref_event);