diff options
| author | fukachan <fukachan> | 2001-12-24 07:40:55 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-12-24 07:40:55 +0000 |
| commit | 09daa35160a012328aef1fe60017dcc98c9f696b (patch) | |
| tree | d216c1988fbf37534c20e3d9493fceb4fb423a59 | |
| parent | 0b7a915175bb0130e9916bd764a62f9542f47cdf (diff) | |
| download | fml8-09daa35160a012328aef1fe60017dcc98c9f696b.tar.gz fml8-09daa35160a012328aef1fe60017dcc98c9f696b.tar.bz2 fml8-09daa35160a012328aef1fe60017dcc98c9f696b.zip | |
update documents, comments
| -rw-r--r-- | fml/lib/IO/Adapter.pm | 59 | ||||
| -rw-r--r-- | fml/lib/IO/Adapter/Array.pm | 32 | ||||
| -rw-r--r-- | fml/lib/IO/Adapter/DBI.pm | 40 | ||||
| -rw-r--r-- | fml/lib/IO/Adapter/File.pm | 65 | ||||
| -rw-r--r-- | fml/lib/IO/Adapter/LDAP.pm | 33 | ||||
| -rw-r--r-- | fml/lib/IO/Adapter/MySQL.pm | 21 | ||||
| -rw-r--r-- | fml/lib/IO/Adapter/NIS.pm | 8 | ||||
| -rw-r--r-- | fml/lib/IO/Adapter/SQL/toymodel.pm | 48 | ||||
| -rw-r--r-- | fml/lib/IO/Adapter/UnixGroup.pm | 7 |
9 files changed, 242 insertions, 71 deletions
diff --git a/fml/lib/IO/Adapter.pm b/fml/lib/IO/Adapter.pm index 1294a937..9bb28531 100644 --- a/fml/lib/IO/Adapter.pm +++ b/fml/lib/IO/Adapter.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Adapter.pm,v 1.9 2001/09/17 11:59:23 fukachan Exp $ +# $FML: Adapter.pm,v 1.10 2001/12/22 09:21:12 fukachan Exp $ # package IO::Adapter; @@ -109,10 +109,10 @@ the constructor. The first argument is a map decribed above. # Descriptions: a constructor, which prepare IO operations for the # given $map -# Arguments: $self $map $args +# Arguments: OBJ($self) STR($map) HASH_REF($args) # Side Effects: @ISA is modified # load and import sub-class -# Return Value: object +# Return Value: OBJ sub new { my ($self, $map, $args) = @_; @@ -189,12 +189,13 @@ C<open()> is a dummy function in other maps now. =cut + # Descriptions: open IO, each request is forwraded to each sub-class -# Arguments: $self $flag +# Arguments: OBJ($self) STR($flag) # $flag is the same as open()'s flag for file: map but # "r" only for other maps. # Side Effects: none -# Return Value: file handle +# Return Value: HANDLE sub open { my ($self, $flag) = @_; @@ -222,9 +223,15 @@ sub open create a file if not exists. This method is avaialble for file: type. +It is dummy for maps other than file: type. =cut + +# Descriptions: create a file if not exists. +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: create $map if needed or possible +# Return Value: none sub touch { my ($self) = @_; @@ -266,9 +273,9 @@ an alias of C<get_next_value()> now. # Descriptions: aliases for convenience # request is forwarded to get_next_value() method. -# Arguments: $self +# Arguments: OBJ($self) # Side Effects: none -# Return Value: none +# Return Value: STR sub get_member { my ($self) = @_; $self->get_next_value;} sub get_active { my ($self) = @_; $self->get_next_value;} sub get_recipient { my ($self) = @_; $self->get_next_value;} @@ -289,10 +296,10 @@ replace lines which matches $regexp with $value. =cut -# Descriptions: -# Arguments: $self $address -# Side Effects: -# Return Value: none +# Descriptions: add $address to the current map +# Arguments: OBJ($self) STR($address) +# Side Effects: modify map content +# Return Value: same as add() sub add { my ($self, $address) = @_; @@ -307,10 +314,10 @@ sub add } -# Descriptions: -# Arguments: $self $address -# Side Effects: -# Return Value: none +# Descriptions: delete $address from the current map +# Arguments: OBJ($self) STR($regexp) +# Side Effects: moidfy map content +# Return Value: same as delete() sub delete { my ($self, $regexp) = @_; @@ -325,10 +332,10 @@ sub delete } -# Descriptions: -# Arguments: $self $regexp $value -# Side Effects: -# Return Value: none +# Descriptions: replace $value for key matching $regexp +# Arguments: OBJ($self) STR($regexp) STR($value) +# Side Effects: modify map content +# Return Value: replace() sub replace { my ($self, $regexp, $value) = @_; @@ -359,6 +366,11 @@ If you specify C<all>, you get the result(s) as ARRAY REFERENCE. =cut + +# Descriptions: search method +# Arguments: OBJ($self) STR($regexp) HASH_REF($args) +# Side Effects: none +# Return Value: STR or ARRAY_REF sub find { my ($self, $regexp, $args) = @_; @@ -404,7 +416,7 @@ sub find # Descriptions: destructor # request is forwarded to close() method. -# Arguments: $self $args +# Arguments: OBJ($self) # Side Effects: object is undef'ed. # Return Value: none sub DESTROY @@ -418,8 +430,15 @@ sub DESTROY =head2 C<AUTOLOAD(@varargs)> +hook extension for map dependent methods + =cut + +# Descriptions: hook extension for map dependent methods +# Arguments: OBJ($self) ARRAY(@varargs) +# Side Effects: depend on loaded module +# Return Value: depend on loaded module sub AUTOLOAD { my ($self, @varargs) = @_; diff --git a/fml/lib/IO/Adapter/Array.pm b/fml/lib/IO/Adapter/Array.pm index faa0923e..741850bb 100644 --- a/fml/lib/IO/Adapter/Array.pm +++ b/fml/lib/IO/Adapter/Array.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Array.pm,v 1.19 2001/05/30 14:35:10 fukachan Exp $ +# $FML: Array.pm,v 1.20 2001/12/22 09:21:12 fukachan Exp $ # package IO::Adapter::Array; @@ -16,7 +16,7 @@ use IO::Adapter::ErrorStatus qw(error_set error error_clear); =head1 NAME -IO::Adapter::Array - IO emulation for the ARRAY +IO::Adapter::Array - base class for IO emulation for the ARRAY =head1 SYNOPSIS @@ -41,9 +41,9 @@ constructor. =cut # Descriptions: constructor -# Arguments: $self +# Arguments: OBJ($self) # Side Effects: none -# Return Value: object +# Return Value: OBJ sub new { my ($self) = @_; @@ -70,13 +70,13 @@ $flag is "r" only (read only) now. =cut # Descriptions: open() emulation -# Arguments: $self $args +# Arguments: OBJ($self) HASH_REF($args) # $args = { # flag => $flag # _array_reference => ARRAY_REFERENCE # } # Side Effects: malloc @elements array -# Return Value: ARRAY REFERENCE +# Return Value: ARRAY_REF sub open { my ($self, $args) = @_; @@ -109,14 +109,18 @@ return the next element of the array =cut + # Descriptions: forwarded to get_next_value() +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: increment the counter in the object +# Return Value: STR(the next element) sub getline { get_next_value(@_);} # Descriptions: return the next element of the array -# Arguments: $self $args +# Arguments: OBJ($self) HASH_REF($args) # Side Effects: increment the counter in the object -# Return Value: the next element +# Return Value: STR(the next element) sub get_next_value { my ($self, $args) = @_; @@ -138,9 +142,9 @@ set the current position to $pos -th element. # Descriptions: return the current position in the array, that is, # which element in the array -# Arguments: $self +# Arguments: OBJ($self) # Side Effects: none -# Return Value: the current number of element +# Return Value: NUM(the current number of element) sub getpos { my ($self) = @_; @@ -149,10 +153,10 @@ sub getpos # Descriptions: set the postion in the array -# Arguments: $self $pos +# Arguments: OBJ($self) NUM($pos) # $pos is the integer number. # Side Effects: reset counter in the object -# Return Value: update position +# Return Value: NUM(update position) sub setpos { my ($self, $pos) = @_; @@ -172,7 +176,7 @@ end of IO operation. It is a dummy. =cut # Descriptions: whether end of the array is not now -# Arguments: $self +# Arguments: OJB($self) # Side Effects: none # Return Value: 1 or 0. # return 1 if the element reaches the end of the array. @@ -184,7 +188,7 @@ sub eof # Descriptions: close() is a fake. -# Arguments: $self +# Arguments: OBJ($self) # Side Effects: none # Return Value: none sub close diff --git a/fml/lib/IO/Adapter/DBI.pm b/fml/lib/IO/Adapter/DBI.pm index 1e75cc47..7cf320db 100644 --- a/fml/lib/IO/Adapter/DBI.pm +++ b/fml/lib/IO/Adapter/DBI.pm @@ -3,7 +3,7 @@ # Copyright (C) 2000,2001 Ken'ichi Fukamachi # All rights reserved. # -# $FML: DBI.pm,v 1.8 2001/09/17 11:35:21 fukachan Exp $ +# $FML: DBI.pm,v 1.9 2001/12/22 09:21:12 fukachan Exp $ # package IO::Adapter::DBI; @@ -37,6 +37,10 @@ prepare C<dsn>. =cut +# Descriptions: prepare DSN for DBI +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: none +# Return Value: STR sub make_dsn { my ($self, $args) = @_; @@ -59,6 +63,10 @@ execute sql query. =cut +# Descriptions: execute query for DBI +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: none +# Return Value: STR sub execute { my ($self, $args) = @_; @@ -100,10 +108,10 @@ close connection to SQL server specified by C<dsn>. =cut -# Descriptions: -# Arguments: $self $args -# Side Effects: -# Return Value: none +# Descriptions: open DBI map +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: create DB? handle +# Return Value: HANDLE (DB? handle) sub open { my ($self, $args) = @_; @@ -136,9 +144,9 @@ sub open } -# Descriptions: -# Arguments: $self $args -# Side Effects: +# Descriptions: delete DBI map +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: delete DB? handle # Return Value: none sub close { @@ -164,6 +172,10 @@ same as C<getline()> now. =cut +# Descriptions: get from DBI map +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: none +# Return Value: STR sub getline { my ($self, $args) = @_; @@ -171,6 +183,10 @@ sub getline } +# Descriptions: get from DBI map +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: none +# Return Value: STR sub get_next_value { my ($self, $args) = @_; @@ -210,6 +226,11 @@ sub get_next_value =cut + +# Descriptions: replace value +# Arguments: OBJ($self) STR($regexp) STR($value) +# Side Effects: update map +# Return Value: none sub replace { my ($self, $regexp, $value) = @_; @@ -232,9 +253,6 @@ sub replace } -=cut - - =head1 AUTHOR Ken'ichi Fukamachi diff --git a/fml/lib/IO/Adapter/File.pm b/fml/lib/IO/Adapter/File.pm index c60ab53a..a6e8eba2 100644 --- a/fml/lib/IO/Adapter/File.pm +++ b/fml/lib/IO/Adapter/File.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: File.pm,v 1.24 2001/08/26 05:52:08 fukachan Exp $ +# $FML: File.pm,v 1.25 2001/12/22 09:21:13 fukachan Exp $ # package IO::Adapter::File; @@ -56,6 +56,10 @@ standard constructor. =cut +# Descriptions: standard constructor. +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: OBJ sub new { my ($self) = @_; @@ -74,6 +78,10 @@ C<flag> is the mode of open(). =cut +# Descriptions: open map +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: file opened +# Return Value: HANDLE sub open { my ($self, $args) = @_; @@ -90,9 +98,9 @@ sub open # Descriptions: open file in "read only" mode -# Arguments: $self $args +# Arguments: OBJ($self) HASH_REF($args) # Side Effects: file is opened for read -# Return Value: file descriptor +# Return Value: HANDLE sub _read_open { my ($self, $args) = @_; @@ -112,6 +120,10 @@ sub _read_open } +# Descriptions: open file in "read/write" mode +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: file is opened for read +# Return Value: HANDLE sub _rw_open { my ($self, $args) = @_; @@ -132,9 +144,14 @@ create a file if not exists. =cut + +# Descriptions: touch (create a file if needed) +# Arguments: OBJ($self) +# Side Effects: create a file +# Return Value: same as close() sub touch { - my ($self, $flag) = @_; + my ($self) = @_; my $file = $self->{_file}; use IO::File; @@ -163,6 +180,10 @@ This is used in C<fml5>. =cut +# Descriptions: get string for new line +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: STR sub getline { my ($self) = @_; @@ -171,6 +192,11 @@ sub getline } +# Descriptions: get string for new line after +# clean up for fml +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: STR sub get_next_value { my ($self) = @_; @@ -214,6 +240,10 @@ set the position in the opened file. =cut +# Descriptions: return current postion in file descriptor +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: NUM sub getpos { my ($self) = @_; @@ -222,6 +252,10 @@ sub getpos } +# Descriptions: reset postion in file descriptor +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: NUM sub setpos { my ($self, $pos) = @_; @@ -241,6 +275,10 @@ close the opended file. =cut +# Descriptions: EOF or not +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: same as eof() sub eof { my ($self) = @_; @@ -249,6 +287,10 @@ sub eof } +# Descriptions: close map +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: same as close() sub close { my ($self) = @_; @@ -262,6 +304,11 @@ add (append) $address to this map. =cut + +# Descriptions: add $addr into map +# Arguments: OBJ($self) STR($addr) +# Side Effects: update map +# Return Value: same as close() sub add { my ($self, $addr) = @_; @@ -294,6 +341,11 @@ delete lines which matches $regexp from this map. =cut + +# Descriptions: delete address(es) matching $reexp from map +# Arguments: OBJ($self) STR($regexp) +# Side Effects: update map +# Return Value: same as close() sub delete { my ($self, $regexp) = @_; @@ -325,6 +377,11 @@ replace lines which matches $regexp with $value. =cut + +# Descriptions: replace address(es) matching $reexp with $value +# Arguments: OBJ($self) STR($regexp) STR($value) +# Side Effects: update map +# Return Value: same as close() sub replace { my ($self, $regexp, $value) = @_; diff --git a/fml/lib/IO/Adapter/LDAP.pm b/fml/lib/IO/Adapter/LDAP.pm index 099f4f27..aca67a00 100644 --- a/fml/lib/IO/Adapter/LDAP.pm +++ b/fml/lib/IO/Adapter/LDAP.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: LDAP.pm,v 1.9 2001/12/16 14:06:40 fukachan Exp $ +# $FML: LDAP.pm,v 1.10 2001/12/22 09:21:13 fukachan Exp $ # package IO::Adapter::LDAP; @@ -13,18 +13,9 @@ use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; -sub new -{ - my ($self) = @_; - my ($type) = ref($self) || $self; - my $me = {}; - return bless $me, $type; -} - - -##### -##### This is just a dummy yet now. -##### +##### ##### +##### This is just a dummy yet now. ##### +##### ##### =head1 NAME @@ -39,6 +30,22 @@ not yet implemented not yet +=cut + + +# Descriptions: standard constructor +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: OBJ +sub new +{ + my ($self) = @_; + my ($type) = ref($self) || $self; + my $me = {}; + return bless $me, $type; +} + + =head1 AUTHOR Ken'ichi Fukamachi diff --git a/fml/lib/IO/Adapter/MySQL.pm b/fml/lib/IO/Adapter/MySQL.pm index 3ecb0d49..1a5bc529 100644 --- a/fml/lib/IO/Adapter/MySQL.pm +++ b/fml/lib/IO/Adapter/MySQL.pm @@ -3,7 +3,7 @@ # Copyright (C) 2000,2001 Ken'ichi Fukamachi # All rights reserved. # -# $FML: MySQL.pm,v 1.16 2001/09/17 11:35:21 fukachan Exp $ +# $FML: MySQL.pm,v 1.17 2001/12/22 09:21:13 fukachan Exp $ # @@ -48,6 +48,7 @@ IO::Adapter::MySQL - interface to talk with a MySQL server This module is a top level driver to talk with a MySQL server in SQL (Structured Query Language). +This module inherits C<IO::Adapter::DBI> class. The model dependent SQL statement is expected to be holded in C<IO::Adapter::SQL::> modules. @@ -57,7 +58,6 @@ new($args). It is expected to provdie C<add()>, C<delete()> and C<get_next_value()> method. - =head1 METHODS =head2 C<configure($me, $args)> @@ -68,6 +68,11 @@ customizatoins and functions. =cut + +# Descriptions: initialize MySQL specific configuration +# Arguments: OBJ($self) HASH_REF($me) HASH_REF($args) +# Side Effects: none +# Return Value: none sub configure { my ($self, $me, $args) = @_; @@ -117,6 +122,10 @@ After re-opening, we moved to the specified $pos. =cut +# Descriptions: set position in database handle +# Arguments: OBJ($self) NUM($pos) +# Side Effects: none +# Return Value: none sub setpos { my ($self, $pos) = @_; @@ -145,6 +154,10 @@ sub setpos =cut +# Descriptions: get position in database handle +# Arguments: OBJ($self) NUM($pos) +# Side Effects: none +# Return Value: NUM sub getpos { my ($self) = @_; @@ -157,6 +170,10 @@ sub getpos =cut +# Descriptions: EOF or not? +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: 1 or 0 sub eof { my ($self) = @_; diff --git a/fml/lib/IO/Adapter/NIS.pm b/fml/lib/IO/Adapter/NIS.pm index 3c71f0f4..2ba2acd8 100644 --- a/fml/lib/IO/Adapter/NIS.pm +++ b/fml/lib/IO/Adapter/NIS.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: NIS.pm,v 1.15 2001/05/30 14:35:11 fukachan Exp $ +# $FML: NIS.pm,v 1.16 2001/12/22 09:21:13 fukachan Exp $ # package IO::Adapter::NIS; @@ -41,6 +41,7 @@ C<CAUTION: this map is read only>. =head1 METHODS +This class inherits C<IO::Adapter::Array>. See L<IO::Adapter::Array>. =head2 C<configure($obj)> @@ -49,6 +50,11 @@ Configure $obj for array IO emulation. =cut + +# Descriptions: initialize NIS specific configuration +# Arguments: OBJ($self) HASH_REF($me) +# Side Effects: none +# Return Value: ARRAY_REF sub configure { my ($self, $me) = @_; diff --git a/fml/lib/IO/Adapter/SQL/toymodel.pm b/fml/lib/IO/Adapter/SQL/toymodel.pm index 1f52f135..48379336 100644 --- a/fml/lib/IO/Adapter/SQL/toymodel.pm +++ b/fml/lib/IO/Adapter/SQL/toymodel.pm @@ -3,7 +3,7 @@ # Copyright (C) 2000,2001 Ken'ichi Fukamachi # All rights reserved. # -# $FML: toymodel.pm,v 1.4 2001/09/17 11:31:51 fukachan Exp $ +# $FML: toymodel.pm,v 1.5 2001/12/22 09:21:13 fukachan Exp $ # @@ -32,6 +32,11 @@ model. =cut +# Descriptions: add $addr +# create an SQL query and exetute it +# Arguments: OBJ($self) STR($addr) +# Side Effects: update DB via SQL +# Return Value: STR sub add { my ($self, $addr) = @_; @@ -46,6 +51,11 @@ sub add } +# Descriptions: delete $addr +# create an SQL query and exetute it +# Arguments: OBJ($self) STR($addr) +# Side Effects: update DB via SQL +# Return Value: STR sub delete { my ($self, $addr) = @_; @@ -60,6 +70,11 @@ sub delete } +# Descriptions: get one entry from DBMS +# create an SQL query and exetute it +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: update DB via SQL +# Return Value: STR sub fetch_all { my ($self, $args) = @_; @@ -71,6 +86,11 @@ sub fetch_all } +# Descriptions: search, md = map dependent +# create an SQL query and exetute it +# Arguments: OBJ($self) STR($regexp) HASH_REF($args) +# Side Effects: update DB via SQL +# Return Value: STR or ARRAY_REF sub md_find { my ($self, $regexp, $args) = @_; @@ -115,7 +135,7 @@ sub md_find } -# Descriptions: +# Descriptions: build SQL statement, (not execute but build SQL string only) # # $args = { # query => 'add', @@ -126,9 +146,9 @@ sub md_find # }, # } # -# Arguments: $self $args -# Side Effects: -# Return Value: none +# Arguments: OBJ($self) HASH_REF($args) +# Side Effects: none +# Return Value: STR(SQL statement) sub _build_sql_query { my ($self, $args) = @_; @@ -158,4 +178,22 @@ sub _build_sql_query } +=head1 AUTHOR + +Ken'ichi Fukamchi + +=head1 COPYRIGHT + +Copyright (C) 2001 Ken'ichi Fukamchi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +IO::Adapter appeared in fml5 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + 1; diff --git a/fml/lib/IO/Adapter/UnixGroup.pm b/fml/lib/IO/Adapter/UnixGroup.pm index b3a25300..13c2c4e1 100644 --- a/fml/lib/IO/Adapter/UnixGroup.pm +++ b/fml/lib/IO/Adapter/UnixGroup.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: UnixGroup.pm,v 1.13 2001/05/30 14:35:11 fukachan Exp $ +# $FML: UnixGroup.pm,v 1.14 2001/12/22 09:21:13 fukachan Exp $ # package IO::Adapter::UnixGroup; @@ -38,6 +38,7 @@ IO::Adapter::UnixGroup - IO wrapper to read /etc/group =head1 DESCRIPTION See L<IO::Adapter::Array> for more details. +It inherits C<IO::Adapter::Array> class. C<CAUTION: this map is read only>. @@ -50,6 +51,10 @@ Configure object for array IO operation. =cut +# Descriptions: initialize /etc/group specific configuration +# Arguments: OBJ($self) HASH_REF($me) +# Side Effects: none +# Return Value: ARRAY_REF sub configure { my ($self, $me) = @_; |
