[Dbix-class] DBIx::Class column list

xyon xyon at indigorobot.com
Sat Mar 8 16:33:32 GMT 2008

Good day everyone,

I have started using DBIx::Class on my latest project, and am really
enjoying it. However, I am stuck at one point: obtaining a list of
columns in a given table. In a different script, I've obtained them by
doing this:

my @data    = $schema->resultset('data')->all;

foreach my $item (@data) {
    foreach my $column ($item->columns) {
        print "\n $column: ";
        print $item->$column;

But have different needs in a separate script. I don't need or want to
select contents within the table, I just want to fetch the column names.
Below is essentially what I want to do (but it obviously doesn't

my @columns	= $schema->resultset('data')->columns;

Is there anyway to accomplish just grabbing a list of columns?

xyon <xyon at indigorobot.com>

More information about the DBIx-Class mailing list