[Dbix-class] Can add_column be called on a Row?

Bill Moseley moseley at hank.org
Tue Sep 30 15:00:37 GMT 2014


I'm upgrading DBIC on a project and it's helping to find bugs in our code.

Running tests I found an error ("No such column 'last_saved') and then
found this code:


    my $last_saved_column_data = {
        data_type     => 'timestamp with time zone',
        default_value => 'now()',
        is_nullable   => 1,
        size          => 8,
    };

    foreach ( $users_rs->all ) {

        $_->add_column( 'last_saved' => $last_saved_column_data );
        $_->set_column( 'last_saved' => $column_value );
    }

I assume what the programmer wanted to do there was just add an attribute
"last_saved" to the Users result class.   Or maybe only to those specific
rows returned in that resultset (e.g. as a singleton method
<http://search.cpan.org/dist/MooseX-SingletonMethod/lib/MooseX/SingletonMethod.pm>
).

Apparently that was working in the past.   Was that ever a supported
behavior?


-- 
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20140930/3d3f576f/attachment.htm>


More information about the DBIx-Class mailing list