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

In reply to Re: Re: Class::DBI find_or_create creating when shouldn't by inblosam
in thread Class::DBI find_or_create creating when shouldn't by inblosam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.