DBIx::Cookbook::Recipe::Searching::specific_columns - retrieving specific columns
Output the results of the query
SELECT first_name, last_name FROM actor
Sample Usage:
shell> ${orm}_cmd specific_columns # orm = dbic, skinny, rose, etc
package DBIx::Cookbook::DBIC::Command::specific_columns; use Moose; extends qw(MooseX::App::Cmd::Command); use Data::Dump; sub execute { my ($self, $opt, $args) = @_; my $where = {}; my $attr = { columns => [qw(first_name last_name)] }; my $rs = $self->app->schema->resultset('Actor')->search($where, $attr); my $row = $rs->first; my %data = $row->get_columns; warn Data::Dump::dump(\%data); } 1;
To install DBIx::Cookbook, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Cookbook
CPAN shell
perl -MCPAN -e shell install DBIx::Cookbook
For more information on module installation, please visit the detailed CPAN module installation guide.