Changeset 23 for LATMOS-Accounts


Ignore:
Timestamp:
04/10/09 18:48:24 (15 years ago)
Author:
nanardon
Message:
  • more method into core object
File:
1 edited

Legend:

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

    r22 r23  
    2626} 
    2727 
    28 # load or reload a base 
     28# load or a if need base 
    2929sub load_base { 
    3030    my ($self, $section) = @_; 
    31     return ($self->{_bases}{$section} = $self->_load_base($section)) 
     31    return ($self->{_bases}{$section} ||= $self->_load_base($section)) 
    3232        ? 1 
    3333        : 0; 
     
    4040    my %params = map { $_ => ($self->val($section, $_) || undef) } $self->Parameters($section); 
    4141    return LATMOS::Accounts::Bases->new($type, %params); 
     42} 
     43 
     44sub list_bases { 
     45    my ($self) = @_; 
     46    grep { 
     47        $self->val($_, 'type') !~ /^(synchro)$/ 
     48    } $self->Sections 
     49} 
     50 
     51sub load_all_base { 
     52    my ($self) = @_; 
     53    foreach ($self->list_bases) { 
     54        $self->load_base($_) or do { 
     55            warn "Cannot load base $_\n"; 
     56            return 0; 
     57        }; 
     58    } 
     59    1; 
    4260} 
    4361 
Note: See TracChangeset for help on using the changeset viewer.