This is my script, i am having problems with the line
Code:
$resortid = $func->getresortid($resortname);
- i am trying to write out the resortid to the screen, with no luck however.

Code:
#!/usr/bin/perl

# Craig R Morton
# Last_Edit: 16-Nov-2006

use ready::Sql;
use ready::DataInterface::Locations;

$sql = new ready::Sql;
$newsql = new ready::Sql;
$func = new ready::DataInterfaces::Locations;

open(IN, "/usr/local/search/currenttables");
while(<IN>) {
	chomp;
	(undef, $table) = split(/:/);
	if ($table =~ /^package/) {
		push(@tables, $table);
	}
}
close(IN);

@cursor = $sql->query(q{SELECT DISTINCT(name) FROM `location`.`resorts`});
while ($returned = $cursor[0]->fetchrow_hashref) {

	$resortname = $returned->{name};
	$resortname =~ s/'/\\\'/;		
	$resortid = $func->getresortid($resortname); 
	print "Resort ID: $resortid\n";
}
Locations.pm - module inside '/usr/lib/perl5/ready/DataInterface'
shown is just one subroutine from the module
Code:
sub getresortid {

	my $self				= shift;
	my $parameters			= shift;

	my (@cursor, $returned, @cursor2, $returned2, $resortid);

	# First try a basic name match
	@cursor = $self->{SQL}->query("select id from location.resorts where name = ?", $parameters->{name});
	if ($returned = $cursor[0]->fetchrow_hashref) {
		$resortid = $returned->{"id"};
	} else {
		# Try and see if we've got an alternate spelling
		@cursor2 = $self->{SQL}->query("select attachedtoid from location.altspellings where name = ? and attachedto = 'resort'", $parameters->{name});
		if ($returned2 = $cursor2[0]->fetchrow_hashref) {
			$resortid = $returned2->{"attachedtoid"};
		}
	}
	
	if ($resortid) {
		return $resortid;
	} else {
		return undef;
	}

}