http://www.perlmonks.org?node_id=996497

I've been bouncing some ideas around after reading these: Tao::DBI::st, DBIx::bind_param_inline, Method::Signatures, Devel::Declare, DBI recipes#Binding columns and fetching
SELECT $dbh, ":name, :email from ... where DIAPER=?", 'soft and absorbant' { print "$name < $email >\n"; }
SELECT $dbh, " :name, :email from ... where DIAPER LIKE ? ", 'soft and absorbant' { print "$name < $email >\n"; }
SELECT $dbh, ":name, :email from ... where DIAPER=?", 'soft and absorbant' { print "$name < $email >\n"; }
SELECT $dbh, " :name, :email from ... where DIAPER LIKE ? ", 'soft and absorbant' { print "$name < $email >\n"; }
$dbh->SELECT ":name, :email from ... where DIAPER=?", 'soft and absorbant' { print "$name < $email >\n"; }
$dbh->SELECT " :name, :email from ... where DIAPER LIKE ? ", 'soft and absorbant' { print "$name < $email >\n"; }
$dbh->SELECT( ":name, :email from ... where DIAPER=?", 'soft and absorbant', sub { print "$name < $email >\n"; });
$dbh->SELECT( " :name, :email from ... where DIAPER LIKE ? ", 'soft and absorbant', sub { print "$name < $email >\n"; } );
for my $quality ( 'soft', 'absorbant' ){ SELECT ":rec{name}, :rec{email} from ... where DIAPER=?", $quality + { print "$rec{name} < $rec{email} >\n"; } }
Say these are lines 2 3 4 5 6 in file foo.pl
for my $quality ( 'soft', 'absorbant' ){ SELECT ":{name}, :{email} from ... where DIAPER=?", $quality { print "$rec{name} < $rec{email} >\n"; } }
So through some Devel::Declare type magic that becomes
{ my %rec = ( name => undef, email => undef, ); # line 3 foo.pl my $sth = $dbh->prepare( "SELECT name, email from ... where DIAPER +=?" ); # line 3 foo.pl $sth->execute( $quality ); $sth->bind_col(1, \$rec{name}); $sth->bind_col(2, \$rec{email}); while( $sth->fetchrow_arrayref ){ # line 4 foo.pl print "$rec{name} < $rec{email} >\n"; } } # line 7 foo.pl

But my thinking isn't clear, any ideas?