sqspat has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Returning readable table contents ... not " DBI::st=HASH(0xa0dc0c0) "
  • Download Code

Replies are listed 'Best First'.
Re: Returning readable table contents ... not " DBI::st=HASH(0xa0dc0c0) "
by moritz (Cardinal) on Sep 24, 2009 at 14:22 UTC
    Read the section Outline Usage in the DBI documentation - it explains that after the prepare you also need execute and some fetch operation(s) to obtain the actual data.
    Perl 6 - links to (nearly) everything that is Perl 6.
Re: Returning readable table contents ... not " DBI::st=HASH(0xa0dc0c0) "
by marto (Cardinal) on Sep 24, 2009 at 14:26 UTC

    No need to duplicate questions. I'd suggest you read the DBI documentation, it provides an explanation of how to use it correctly along with example code.

    Martin

Re: Returning readable table contents ... not " DBI::st=HASH(0xa0dc0c0) "
by hippsta (Acolyte) on Sep 24, 2009 at 17:47 UTC
    Basically, you're missing the fetch from the database.
    You need a statement similar to this:

    my @stuff = $sth->fetch_row();

    foreach my $thing (@stuff)
    {
    print "$thing\n";
    }

    ...in between the prepare and disconnect statements.
    Oh, and of course I highly suggest at least reading the man page for the DBI module on cpan.org or what have ya.

    GL! :)

    Respectfully,

    Brother Hippsta
Re: Returning readable table contents ... not " DBI::st=HASH(0xa0dc0c0) "
by Boldra (Curate) on Sep 25, 2009 at 11:43 UTC
    You might get further if you learn about (and recognize) references. Try replacing your final print with the following:
    use Data::Dumper; print Dumper $sth


    - Boldra