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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.