Error message from bind_columns ()

"H.Merijn Brand" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
bind_columns () does

--8<--- DBI.pm # 1866
	my $idx = 0;
	$sth->bind_col(++$idx, shift, $attr) or return
	    while (@_ and $idx < $fields);
-->8---

Which may lead to errors like

Can't DBI::st=HASH(0x402ebac8)->bind_col(1, ARRAY(0x402ebe38),...), need a reference to a scalar at /pro/lib/perl5/site_perl/5.10.1/PA-RISC2.0/DBI.pm line 1867.

something not very useful to the end-user.

I don't know why just adding 'local $Carp::CarpLevel = 1;' there
doesn't help, so I had to do

--8<---
	my $idx = 0;
	while (@_ and $idx < $fields) {
	    use Carp;
	    my $state = eval { local $Carp::CarpLevel = 1;
		$sth->bind_col(++$idx, shift, $attr); };
	    if ($@) {
		$@ =~ s/\s+at\s+\S+\s+line.*//s;
		croak $@;
	    }
	    $state or return
	}
-->8---

to get to

Can't DBI::st=HASH(0x402ec680)->bind_col(1, ARRAY(0x402ec8c0),...), need a reference to a scalar at /pro/tu/bev/local/bin/gvH.pl line 123

which is what makes the end-user much happier. Suggestions?

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.