Dezi-Bot

 view release on metacpan or  search on metacpan

lib/Dezi/Bot/Utils.pm  view on Meta::CPAN

Takes same I<args> as DBIx::InsertHash->update() 
but will make educated guess at whether to insert
or update the data.

Returns the row id if insert() was called, 
otherwise returns hash ref of the updated
row.

=cut

sub update_or_insert {
    my ( $dbix, $data, $vars, $where, $table, $dbh ) = @_;

    # object defaults
    if ( ref $dbix ) {
        $where ||= $dbix->where;
        $table ||= $dbix->table;
        $dbh   ||= $dbix->dbh;
    }
    my $up = $dbix->update( $data, $vars, $where, $table, $dbh );
    unless ( $up > 0 ) {

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.628 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )