Changeset 255
- Timestamp:
- 06/22/09 03:19:38 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts.pm
r192 r255 8 8 use LATMOS::Accounts::Synchro; 9 9 use LATMOS::Accounts::SynchAccess; 10 use LATMOS::Accounts::Log; 10 11 11 12 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 13 14 =head1 NAME 15 16 LATMOS::Accounts - Core module for LATMOS account management tools 17 18 =head1 DESCRITPTION 19 20 =cut 21 22 =head1 FUNCTION 23 24 =head2 new($configfile) 25 26 Instanciate a new LATMOS::Accounts object. 27 28 $configfile if defined is the Config::IniFiles formatted file to use, 29 default to F</etc/latmos-account.ini>. 30 31 =cut 12 32 13 33 sub new { … … 23 43 bless($self, $class) 24 44 } 45 46 =head2 list_bases 47 48 Return the base list found in config file 49 50 =cut 51 52 sub list_bases { 53 my ($self) = @_; 54 grep { 55 !m/^_.*_$/ && 56 !m/^sync:/ 57 } $self->Sections 58 } 59 60 =head2 base($basename) 61 62 Return a L<LATMOS::Accounts::Base> object over base named $basename 63 defined in the config file. 64 65 The base is loaded by this function. 66 67 =cut 25 68 26 69 sub base { … … 30 73 $self->load_base($section) ? $self->{_bases}{$section} : undef; 31 74 } 75 76 =head2 default_base_name 77 78 Return the default base name according config file 79 80 =cut 81 82 sub default_base_name { 83 my ($self) = @_; 84 $self->val('_default_', 'base', ($self->list_bases)[0]); 85 } 86 87 =head2 default_base 88 89 Return a L<LATMOS::Accounts::Base> object over the default base according 90 configuration file. 91 92 =cut 32 93 33 94 sub default_base { … … 54 115 ); 55 116 my $base = LATMOS::Accounts::Bases->new($type, %params, label => $section) or do { 56 warn "Cannot instanciate base $section ($type)";117 la_log(LA_WARN, "Cannot instanciate base $section ($type)"); 57 118 return; 58 119 }; … … 61 122 } 62 123 63 sub default_base_name {64 my ($self) = @_;65 $self->val('_default_', 'base', ($self->list_bases)[0]);66 }67 68 124 sub default_synchro_name { 69 125 my ($self) = @_; 70 126 $self->val('_default_', 'sync'); 71 }72 73 sub list_bases {74 my ($self) = @_;75 grep {76 !m/^_.*_$/ &&77 !m/^sync:/78 } $self->Sections79 127 } 80 128 … … 88 136 foreach ($self->list_bases) { 89 137 $self->load_base($_) or do { 90 warn "Cannot load base $_\n";138 la_log(LA_ERR, "Cannot load base $_"); 91 139 return 0; 92 140 }; … … 159 207 160 208 __END__ 161 # Below is stub documentation for your module. You'd better edit it!162 163 =head1 NAME164 165 LATMOS::Accounts - Perl extension for blah blah blah166 167 =head1 SYNOPSIS168 169 use LATMOS::Accounts;170 blah blah blah171 172 =head1 DESCRIPTION173 174 Stub documentation for LATMOS::Accounts, created by h2xs. It looks like the175 author of the extension was negligent enough to leave the stub176 unedited.177 178 Blah blah blah.179 180 =head2 EXPORT181 182 None by default.183 184 185 209 186 210 =head1 SEE ALSO 187 211 188 Mention other useful documentation such as the documentation of189 related modules or operating system documentation (such as man pages190 in UNIX), or any relevant external documentation such as RFCs or191 standards.192 193 If you have a mailing list set up for your module, mention it here.194 195 If you have a web site set up for your module, mention it here.196 197 212 =head1 AUTHOR 198 213 199 Thauvin Olivier, E<lt>olivier.thauvin@latmos ipsl.frE<gt>214 Thauvin Olivier, E<lt>olivier.thauvin@latmos.ipsl.frE<gt> 200 215 201 216 =head1 COPYRIGHT AND LICENSE … … 207 222 at your option, any later version of Perl 5 you may have available. 208 223 209 210 =cut 224 =cut
Note: See TracChangeset
for help on using the changeset viewer.