DBIx::Cookbook::Recipe::Searching::sql_lhs - SQL on the LHS of a comparison
Output the results of the query
SELECT * FROM payment WHERE YEAR(payment_date) = 2006 AND amount < 2.50
Sample Usage:
shell> ${orm}_cmd sql_lhs # orm = dbic, skinny, rose, etc
package DBIx::Cookbook::DBIC::Command::sql_lhs; use Moose; extends qw(MooseX::App::Cmd::Command); sub execute { my ($self, $opt, $args) = @_; my $rs = do { my $where = { 'YEAR(payment_date)' => 2006, amount => { '<' => 2.50 } }; my $attr = {}; $self->app->schema->resultset('Payment')->search($where, $attr); }; while (my $row = $rs->next) { use Data::Dumper; my %data = $row->get_columns; warn Dumper(\%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.