binary_luigi binary_luigi - 2 years ago 79
Perl Question

How can you modify a DBIx::Class::Row in place?

Using DBIx::Class::ResultSet is it possible to make changes to the results in memory as attempted below?

my @results = $self->search(...);

for my $result (@results) {
my $row = {$result->get_columns};
$row->{fieldname} = 'something else';

return @results;

Answer Source

A column accessor is generated by DBIx::Class for every column you define. It can be used both as a reader

my $value = $row->columnname;

and as a writer

$row->columnname('new value');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download