The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DBIx::Cookbook::Recipe::Searching::fetch_single - fetch a single record

DESCRIPTION

Select a single record from the actor table

Sample Usage:

 shell> ${orm}_cmd fetch_single # where orm is dbic, skinny, rose, etc.

RECIPES

DBIx::Class

    package DBIx::Cookbook::DBIC::Command::fetch_single;
    use Moose;
    extends qw(MooseX::App::Cmd::Command);
    
    use Data::Dump;
    
    sub execute {
      my ($self, $opt, $args) = @_;
    
      my $where = {};
      my $attr = {};
    
      my $rs = $self->app->schema->resultset('Actor')->search($where, $attr);
    
      my $row = $rs->single;
    
      my %data = $row->get_columns;
      warn Data::Dump::dump(\%data);
    
    }
    
    1;