use strict; use DBI; my $dbh = DBI->connect(blah blah blah) or die "blah"; use Vhost; use Vhost::Location; my @vhosts; # the constructor takes the ID (the primary key) # of the virtual host, queries the DB # and returns all the # properties of the host (name, etc.) foreach (#list of identifiers from DB) { push (@vhosts, new Vhost($_); } my @locations; foreach my $vhost(@vhosts) { my @location_ids = $vhost->get_location_ids(); foreach @location_ids) { # here, as above, the constructor takes the primary key # of the object in the DB, and returns the other properties push @locations, new Vhost::Location($_); } }