DBIx::Class - Related Tables

Wallace Reis reis.wallace at gmail.com
Tue Oct 7 01:48:52 BST 2008


On Mon, Oct 6, 2008 at 5:59 PM, Dave Cross <dave at dave.org.uk> wrote:
> Given a distribution object, I want to find the highest version for
> which we have a successful build (or, to find out that there hasn't been
> a successful build).

my $main_build = $dist->builds->search_rs({
        'status' => 'success'
}, {
        'select' => [{ 'MAX' => 'version' }],
        'as'       => ['max_version'],
        'rows'   => '1'
})->single;

print $main_build->get_column('max_version');

(...)

or

my $main_build = $dist->builds->search_rs({
        'status' => 'success'
}, {
        'order_by' => 'version DESC',
        'rows'        => '1'
})->single;

print $main_build->version;

-- 
wallace reis/wreis


More information about the london.pm mailing list