I would agree with dragonchild, but for a different reason.

The doc for Net::MySQL reads:

This module implements network protocol between server and client of MySQL, thus you don't need external MySQL client library like libmysqlclient for this module to work. It means this module enables you to connect to MySQL server from some operation systems which MySQL is not ported. How nifty!
But if DBI is available, because it is more "usual", the principle of least surprise says to use that.

I can't comment on why your Net::MySQL code doesn't work as expected. It certainly seems okay. You might try logging in the mysql client and trying

mysql> show full processlist; +----+-------+----------------+------+---------+------+-------+------- +----------------+ | Id | User | Host | db | Command | Time | State | Info + | +----+-------+----------------+------+---------+------+-------+------- +----------------+ | 1 | woody | localhost:2244 | to9 | Query | 0 | NULL | show fu +ll processlist | +----+-------+----------------+------+---------+------+-------+------- +----------------+ 1 row in set (0.10 sec)
to see what the server is doing when it hangs. Also, I'd add a bunch of or die $dbh->errstr() to the $dbh->prepare and $sth->execute statements, just to get a feel for what could be going wrong.

In reply to Re^2: MySQL doesn't work with perl by WoodyWeaver
in thread MySQL doesn't work with perl by srfrogster

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.