Changeset 32

Show
Ignore:
Timestamp:
03/01/07 21:44:14 (3 years ago)
Author:
eevee
Message:

Fixed: vee_stop wasn't eating the first parameter and that generally fucked things up.
Added a DBIC::ResultSet?->is_empty method so I don't have to keep playing with first/reset or doing an extra db call for count.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • veekun/trunk/lib/Vee.pm

    r21 r32  
    5353__PACKAGE__->setup; 
    5454 
    55 __PACKAGE__->model('DBIC')->storage->dbh->disconnect; 
     55{ 
     56    no strict 'refs'; 
     57 
     58    # I find myself doing this a lot and it's a bit cumbersome 
     59    *{'DBIx::Class::ResultSet::is_empty'} = sub { 
     60        my ($self) = @_; 
     61        my $first = $self->first; 
     62        $self->reset; 
     63        return not $first; 
     64    }; 
     65} 
    5666 
    5767=head1 METHODS 
     
    158168 
    159169sub vee_stop { 
    160     my ($self, $msg) = @_; 
     170    my $self = shift; 
    161171    my $s = $self->stash; 
    162172    my @msgs = $self->_final_solution(@_);