in reply to Devel::Profiler and dprofpp Garbled profile

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

Replies are listed 'Best First'.
Re: Re: Devel::Profiler and dprofpp Garbled profile
by jaa (Friar) on Mar 26, 2004 at 09:55 UTC
    My little test dprofpp scambler produces a 133 line tmon.out. Here is the section of tmon.out that causes dprofpp a problem:
    @ 10 0 0
    & 14 DBI::st execute
    + 14
    @ 0 0 2
    - 14
    + 11
    - 11
    & 15 DBI::st fetchrow_hashref
    + 15
    & 16 DBD::_::st fetchrow_hashref
    * 16
    & 17 DBI::st fetch
    * 17
    - 17
    & 18 DBI::st FETCH
    * 18        << here is the line dprofdd complains about
    - 18
    + 11
    - 11
    
    Interestingly, the three lines for sub 18 appear to be the same as the three lines for sub 17. Unfortunately, I dont really understand the tmon.out '*' mark enought to know if the first occurance is ok and the second is faulty. If I change the '*' mark to a '+' mark, dprofpp has no problems.

    I am leaning towards a dprofpp bug?

    Regards,

    Jeff