I have created a very small program that calls fetchrow_hashref using MySQL that gives dprofpp the heebie-geebies:

#!/usr/local/bin/perl -w use strict; use DBI; use Devel::Profiler; sub logGeneral { print @_,"\n"; }; sub logFatal { logGeneral @_; die }; my $dbhost = 'localhost'; my $dbname = 'mydatabase'; my $dbuser = 'myuser'; my $dbpasswd = 'mypassword'; my $sql = 'select * from mytable'; my $dsn = "DBI:mysql:host=$dbhost;database=$dbname"; my $dbh = DBI->connect($dsn, $dbuser, $dbpasswd, { RaiseError => 0} ) or logFatal "DBI->Connect failed: DSN='$dsn' User='$dbuser' Error='$ +DBI::errstr'"; logGeneral "database opened"; my $sth = $dbh->prepare( $sql ) or logFatal("prepare failed: '$sql'\n ", $dbh->errstr); logGeneral "statement prepared"; my $result = $sth->execute() or logFatal("execute of '$sql' failed\n ", $dbh->errstr); logGeneral "statement executed: result $result"; my $row = $sth->fetchrow_hashref; logGeneral "row fetched:"; logFatal "no columns found" unless $sth->{NAME_lc}; for my $field ( @{$sth->{NAME_lc}} ) { logGeneral sprintf(" %-15s %s", $field, $row->{$field}); }
Can anyone else profile this ok? You just need to slot in your MYSQL db connection details, run the script and then run dprofpp in the same directory.

Thanks a bunch!

Jeff


In reply to Re: Devel::Profiler and dprofpp Garbled profile by jaa
in thread Devel::Profiler and dprofpp Garbled profile by jaa

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.