Below is some of the code. The Class::DBI part works perfect everywhere else I am using it. I tried passing in the parameters directly in the find_or_create, and with the hash. I also tried not deferencing the hash in the find_or_create().
my %list_params = (
listnum => $listnum,
address => $address,
city => $city,
state => $state,
zip => $zip,
tot_bed => $tot_bed,
tot_bath => $tot_bath,
tot_sqft => $tot_sqft,
home_style => $home_style,
home_type => $home_type,
sch_element => $sch_element,
sch_intermed=> $sch_intermed,
sch_highsch => $sch_highsch,
price => $price,
photo => $photos[0][2],
acres => $acres
);
print Dumper(\%list_params);
$addlisting = Table::Listings->find_or_create(\%list_params);
Both were added to the database for the following hashes, when in reality only the first should have:
$VAR1 = {
'sch_element' => 'Salina',
'home_style' => 'Manufact/Modular',
'photo' => 'http://photo.somesite.com/280x210/419964.jpg',
'tot_bed' => '3',
'acres' => '0.270000',
'tot_bath' => '2',
'state' => 'UT',
'home_type' => 'Single Family',
'zip' => '84614',
'city' => 'Salina',
'listnum' => '419764',
'price' => '88900',
'sch_highsch' => 'North Sevier',
'address' => ' SALINA CREEK DR',
'sch_intermed' => 'Red Hills',
'tot_sqft' => '1404'
};
$VAR1 = {
'sch_element' => 'Salina',
'home_style' => 'Manufact/Modular',
'photo' => 'http://photo.somesite.com/280x210/419964.jpg',
'tot_bed' => '3',
'acres' => '0.270000',
'tot_bath' => '2',
'state' => 'UT',
'home_type' => 'Single Family',
'zip' => '84614',
'city' => 'Salina',
'listnum' => '419764',
'price' => '88900',
'sch_highsch' => 'North Sevier',
'address' => ' SALINA CREEK DR',
'sch_intermed' => 'Red Hills',
'tot_sqft' => '1404'
};
In the following find_or_create the first attempt was added (blank table) and then the second one was not added. So this is how it is supposed to work, but again only 5 of 21 work properly.
$VAR1 = {
'sch_element' => 'Monroe',
'home_style' => 'Rambler/Ranch',
'photo' => 'http://photo.somesite.com/280x210/415584.jpg',
'tot_bed' => '5',
'acres' => '3.000000',
'tot_bath' => '1',
'state' => 'UT',
'home_type' => 'Single Family',
'zip' => '84777',
'city' => 'Annabella',
'listnum' => '415684',
'price' => '63900',
'sch_highsch' => 'South Sevier',
'address' => ' N ANNABELLA RD ',
'sch_intermed' => 'South Sevier',
'tot_sqft' => '2392'
};
$VAR1 = {
'sch_element' => 'Monroe',
'home_style' => 'Rambler/Ranch',
'photo' => 'http://photo.somesite.com/280x210/415584.jpg',
'tot_bed' => '5',
'acres' => '3.000000',
'tot_bath' => '1',
'state' => 'UT',
'home_type' => 'Single Family',
'zip' => '84777',
'city' => 'Annabella',
'listnum' => '415684',
'price' => '63900',
'sch_highsch' => 'South Sevier',
'address' => ' N ANNABELLA RD ',
'sch_intermed' => 'South Sevier',
'tot_sqft' => '2392'
};
Also if there is a / in the text it gets cut off after that, so it will say Manufact/ instead of Manufact/Modular in the field, or http:// instead of the full URL. Any ideas on that one too?
I guess the other thing to do is just check the database if it comes up with a match and then if it doesn't just create the file like normal.
Anyone come across similar problems?
-Michael Jensen