Changeset 262


Ignore:
Timestamp:
07/24/09 17:02:27 (15 years ago)
Author:
nanardon
Message:
  • allow to run command after commit success (postcommit=...)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases.pm

    r257 r262  
    66use LATMOS::Accounts::Bases::Objects; 
    77use LATMOS::Accounts::Log; 
     8use LATMOS::Accounts::Utils qw(exec_command); 
    89 
    910our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 
     
    4344    $base->{_type} = lc($pclass); 
    4445    $base->{_label} = $options{label}; 
     46    $base->{_options} = { %options }; 
    4547    $base->{defattr} = $options{defattr}; 
    4648    la_log(LA_DEBUG, 'Instanciate base %s (%s)', ($options{label} || 'N/A'), $pclass); 
     
    278280    if ($self->can('_commit')) { 
    279281        la_log(LA_DEBUG, 'Commiting data'); 
    280         return $self->_commit; 
     282        if (!(my $res = $self->_commit)) { 
     283            return $res; 
     284        } 
     285        if ($self->{options}{postcommit}) { 
     286            return exec_command($self->{options}{postcommit}, $self->{options}); 
     287        } 
     288        return 1; 
    281289    } else { 
    282290        return 1; 
Note: See TracChangeset for help on using the changeset viewer.