in reply to DBIx::Class creating get_* and set_* methods
my $rs = $schema->resultset('User')->search({});
if ( $rs ) {
for ( $rs->all ) {
print $rs->get_column('username'), "\n";
# either
$rs->set_column('username', 'Bobo The Clown');
$rs->update;
# or $rs->update({ username => 'Bobo The Clown' });
}
}
jrockway says on perlmonks:If you want inflation:
http://search.cpan.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/Class/Row.pm#get_inflated_columns
http://search.cpan.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/Class/Row.pm#set_inflated_columns
or
http://search.cpan.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/Class/Row.pm#update
When your field name is the same as a Row method name, e.g. "delete", I guess you pretty much have to use get_column() or get_inflated_columns() ?
Regards, Peter
|
|---|