Changeset 3 for LATMOS-Accounts/lib
- Timestamp:
- 02/26/09 05:52:34 (15 years ago)
- Location:
- LATMOS-Accounts/lib/LATMOS
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts.pm
r2 r3 71 71 =head1 AUTHOR 72 72 73 Thauvin Olivier, E<lt>olivier @localdomainE<gt>73 Thauvin Olivier, E<lt>olivier.thauvin.ipsl.fr@localdomainE<gt> 74 74 75 75 =head1 COPYRIGHT AND LICENSE -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases.pm
r2 r3 6 6 use LATMOS::Accounts::Bases::Objects; 7 7 8 our $VERSION = (q$Rev$ =~ /$Rev: (\d+) /)[0]; 8 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 9 10 =head1 NAME 11 12 LATMOS::Accounts::Bases - Base class for account data bases 13 14 =head1 SYNOPSIS 15 16 use LATMOS::Accounts::Bases; 17 my $base = LATMOS::Accounts::Bases->new('type', %options); 18 ... 19 20 =head1 DESCRIPTION 21 22 This module provide basic functions for various account base 23 24 =head1 FUNTIONS 25 26 =cut 27 28 =head2 new($type, %options) 29 30 Return, if success, a new data base account object, $type is 31 account base type, %options to setup the base. 32 33 =cut 9 34 10 35 sub new { … … 17 42 } 18 43 44 =head2 get_object($type, $id) 45 46 Return an object of $type (typically user or group) having identifier 47 $id. 48 49 =cut 50 19 51 sub get_object { 20 52 my ($self, $otype, $id) = @_; … … 23 55 } 24 56 57 =head2 is_transactionnal 25 58 26 # Preloaded methods go here. 59 Return True is the database support commit and rollback 60 61 =cut 62 63 sub is_transactionnal { 64 my ($self) = @_; 65 return($self->can('_rollback') && $self->can('_commit')); 66 } 67 68 =head2 commit 69 70 Save change into the database if change are not done immediately. 71 This should always be called as you don't know when change are applied. 72 73 Return always true if database does not support any transaction. 74 75 The driver should provides a _commit functions to save data. 76 77 =cut 78 79 sub commit { 80 my ($self) = @_; 81 return $self->can('_commit') ? $self->_commit : 1; 82 } 83 84 =head2 rollback 85 86 If database support transaction, rollback changes. Return false 87 if database does not support. 88 89 If supported, driver should provides a _rollback functions 90 91 =cut 92 93 sub rollback { 94 my ($self) = @_; 95 return $self->can('_rollback') ? $self->_commit : 0; 96 } 27 97 28 98 1; 99 29 100 __END__ 30 # Below is stub documentation for your module. You'd better edit it!31 32 =head1 NAME33 34 LATMOS::Accounts::Bases - Perl extension for blah blah blah35 36 =head1 SYNOPSIS37 38 use LATMOS::Accounts::Bases;39 blah blah blah40 41 =head1 DESCRIPTION42 43 Stub documentation for LATMOS::Accounts, created by h2xs. It looks like the44 author of the extension was negligent enough to leave the stub45 unedited.46 47 Blah blah blah.48 49 =head2 EXPORT50 51 None by default.52 53 54 101 55 102 =head1 SEE ALSO 56 103 57 Mention other useful documentation such as the documentation of58 related modules or operating system documentation (such as man pages59 in UNIX), or any relevant external documentation such as RFCs or60 standards.61 62 If you have a mailing list set up for your module, mention it here.63 64 If you have a web site set up for your module, mention it here.65 66 104 =head1 AUTHOR 67 105 68 Thauvin Olivier, E<lt>olivier @localdomainE<gt>106 Thauvin Olivier, E<lt>olivier.thauvin.ipsl.fr.thauvin@latmos.ipsl.fr<gt> 69 107 70 108 =head1 COPYRIGHT AND LICENSE … … 76 114 at your option, any later version of Perl 5 you may have available. 77 115 78 79 116 =cut -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Dummy.pm
r2 r3 4 4 use warnings; 5 5 use base qw(LATMOS::Accounts::Bases); 6 7 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 6 8 7 9 sub new { -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Dummy/User.pm
r2 r3 4 4 use warnings; 5 5 use base qw(LATMOS::Accounts::Bases::Objects); 6 7 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 6 8 7 9 sub new { -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Objects.pm
r2 r3 5 5 use warnings; 6 6 7 our $VERSION = '0.01'; 7 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 8 9 =head1 NAME 10 11 LATMOS::Accounts::Bases::Objects - Base class for account objects 12 13 =head1 SYNOPSIS 14 15 use LATMOS::Accounts::Bases::Objects; 16 LATMOS::Accounts::Bases::Objects->new($base, $type, $id); 17 18 =head1 DESCRIPTION 19 20 =head1 FUNCTIONS 21 22 =cut 23 24 =head2 new($base, $type, $id, ...) 25 26 Return a new object of type $type having unique identifier 27 $id, all remaining arguments are passed to the subclass. 28 29 =cut 8 30 9 31 sub new { 10 my ($class, $base, $otype, $id ) = @_;32 my ($class, $base, $otype, $id, @args) = @_; 11 33 12 34 # finding perl class: … … 15 37 eval "require $pclass;"; 16 38 if ($@) { return } # error message ? 17 my $newobj = "$pclass"->new($base, $id );39 my $newobj = "$pclass"->new($base, $id, @args); 18 40 $newobj->{_base} = $base; 19 41 return $newobj; 20 42 } 21 43 44 =head2 base 45 46 Return the base handle for this object. 47 48 =cut 49 50 sub base { 51 return $_[0]->{_base} 52 } 22 53 23 54 # Preloaded methods go here. … … 26 57 27 58 __END__ 28 # Below is stub documentation for your module. You'd better edit it!29 30 =head1 NAME31 32 LATMOS::Accounts::Bases - Perl extension for blah blah blah33 34 =head1 SYNOPSIS35 36 use LATMOS::Accounts::Bases;37 blah blah blah38 39 =head1 DESCRIPTION40 41 Stub documentation for LATMOS::Accounts, created by h2xs. It looks like the42 author of the extension was negligent enough to leave the stub43 unedited.44 45 Blah blah blah.46 47 =head2 EXPORT48 49 None by default.50 51 52 59 53 60 =head1 SEE ALSO … … 64 71 =head1 AUTHOR 65 72 66 Thauvin Olivier, E<lt>olivier @localdomainE<gt>73 Thauvin Olivier, E<lt>olivier.thauvin.ipsl.fr@localdomainE<gt> 67 74 68 75 =head1 COPYRIGHT AND LICENSE
Note: See TracChangeset
for help on using the changeset viewer.