http://qs321.pair.com?node_id=285603


in reply to Another meek DBI question

coyotlgw,

This seems strange to me. I pick these parts out of your code

use strict; $sth->bind_columns( undef, \$uname, \$fname, \$fgroup, \$dmod, \$accts + );
I don't see you declaring any of these varibles with 'my'.
my ($uname,$fname,$fgroup,$dmod,$accts);
Update: Removed a section based on chromatic's comments. Give that a whirl, and see what happens

Kristofer Hoch

Si vos can lego is, vos es super erudio

Replies are listed 'Best First'.
Re: Re: Another meek DBI question
by chromatic (Archbishop) on Aug 21, 2003 at 22:31 UTC
    Secondly, the call to bind_columns is a bit off. This is supposed to be an array (see DBI docs)

    No, it's supposed to be a list. It could only be an array if bind_columns were prototyped to expect an array. Even if it were, it wouldn't work, as it's a method call, and those ignore prototypes.

    Besides all that, your code will be off by one, as a reference to undef doesn't look like undef or a hash reference. I wouldn't be surprised if your code threw "couldn't modify constant item" errors.

Re: Re: Another meek DBI question
by blokhead (Monsignor) on Aug 21, 2003 at 22:28 UTC
    Secondly, the call to bind_columns is a bit off. This is supposed to be an array (see DBI docs)
    my $rv = sth->bind_columns(\(undef,$uname,$fname,$fgroup,$dmod,$accts) + );
    Er... It's supposed to be a list. And taking a reference to a list (like you have done) makes a list of references (see perlref). So what you wrote was equivalent to what the original poster wrote, except your first argument is a ref to undef instead of undef itself.
    ## from perlref @list = (\$a, \@b, \%c); @list = \($a, @b, %c); # same thing!
    You'll notice in the DBI docs that any use of bind_columns with an actual named array uses the form \( @array ) -- which also makes a list of references, and not an array reference. It's different than [ @array ] and \@array.

    blokhead