in reply to DBIx::Class creating get_* and set_* methods

http://search.cpan.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/Class/Row.pm#get_column
http://search.cpan.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/Class/Row.pm#set_column
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:
>Never use get_column and set_column directly unless you know what the side-effects are. They don't work the same way as using the accessors. Inflation is skipped, resultsets are not returned for relationships, etc.

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
  • Comment on Re: DBIx::Class creating get_* and set_* methods