
=pod

=head1 NAME

DBIx::Cookbook::Recipe::Searching::predefined_search - predefined searches

=head1 DESCRIPTION

As a function of the options C<rows> and C<page>, 
output the results of the query

  SELECT * FROM actor ORDER BY last_name

The C<rows> option specifies how many rows per page. The C<page> option 
specifies which page of the resultset to start with. For example, if there 
are 20 rows in the resultset and C<rows> has been set to 4, then there will 
be 5 pages. The C<pages> option will specify from which page results should
be listed, with any number from 1 to 5 being acceptable.

Sample Usage:

  shell> ${orm}_cmd predefined_search  # orm = dbic, skinny, rose, etc

=head1 RECIPES

=head2 DBIx::Class

    package DBIx::Cookbook::DBIC::Command::predefined_search;
    use Moose;
    extends qw(MooseX::App::Cmd::Command);
    
    use Data::Dump;
    
    has 'starts_with' => (
    	       traits => [qw(Getopt)],
    	       isa => "Str",
    	       is  => "rw",
    	       documentation => "first letter(s) that country starts with"
    	      );
    
    has 'max_id' => (
    	       traits => [qw(Getopt)],
    	       isa => "Int",
    	       is  => "rw",
    	       documentation => "maximum acceptable id"
    	      );
    
    sub execute {
      my ($self, $opt, $args) = @_;
    
      my $rs = $self->app->schema->resultset('Country')->search_country
        ($opt->{starts_with}, $opt->{max_id});
    
    
      while (my $row = $rs->next) {
          use Data::Dump qw(dump);
          my %data = $row->get_columns;
          warn dump(\%data);
        }
    
    
    }
    
    1;

