ChristinaH has asked for the wisdom of the Perl Monks concerning the following question:

I'm fairly new Perl so any help on working this out is awesome.

The application I'm working on is based on catalyst MVC architecture. My Postgresql table looks like this:
CREATE TABLE zips ( zip_code CHAR(5) NOT NULL, zip_type CHAR(1), city_name VARCHAR(64), city_type CHAR(1), state_name VARCHAR(64), state_abbr CHAR(2) NOT NULL, area_code CHAR(3), latitude NUMERIC(9,6) NOT NULL, longitude NUMERIC(9,6) NOT NULL ); CREATE INDEX zip_codes ON zips (zip_code); CREATE INDEX state_abbrs ON zips (state_abbr); CREATE INDEX city_names ON zips USING btree (city_name); CREATE TABLE distance_cache ( orig_zip CHAR(5) NOT NULL, dest_zip CHAR(5) NOT NULL, miles SMALLINT );

My search by zipcode is working great and turning out the results I need. Searching by city and state however, is not working. This started not working when I had to create a backup of zips called zips_backup because I corrupted the zips table. I changed a perl module to pull from zips_backup . As far as I can tell, this one module is the only thing that was changed but some insight would be great.

I can supply any files that one would need. Thank you in advance - I look forward to learning whats going on with this.
Here is the module I'm referring to:
package WeilMclainDB::Zips; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/PK::Auto Core/); __PACKAGE__->table('zips'); __PACKAGE__->add_columns(qw/zip_code zip_type city_name city_type stat +e_name state_abbr area_code latitude longitude/); __PACKAGE__->resultset_class('WeilMclainDB::ZipsResultSet'); 1; package WeilMclainDB::ZipsResultSet; use base 'DBIx::Class::ResultSet'; use Geo::Distance; sub get_zip { my ($self, $city, $state) = @_; #return undef unless ($city && $state =~ /^(\d*)$/); if (my $zip = $self->single({city_name => uc($city),state_abbr=>uc +($state)},{columns => [qw/zip_code/]})) { return $zip->get_column('zip_code'); } return undef; return $self->single({city_name=>uc($city),state_abbr=>uc($state)} +,{columns=>[qw/zip_code/]})->get_column('zip_code'); } sub get_closest { my ($self, $zip_code, $miles) = @_; # First get the latitude and longititude for the given zip code if (my $zip = $self->single({zip_code => $zip_code})) { my $geo = Geo::Distance->new; my $locations = $geo->closest( dbh => $self->result_source->storage->dbh, table => 'zips', lon => $zip->longitude, lat => $zip->latitude, unit => 'mile', distance => $miles, lon_field => 'longitude', lat_field => 'latitude', 'sort' => 1, fields => [qw/zip_code/], ); my @zips; foreach my $result (@{$locations}) { push (@zips, $result->{zip_code}); } return \@zips; } else { return undef; } } 1;