Author: wayland Date: 2009-02-27 13:32:32 +0100 (Fri, 27 Feb 2009) New Revision: 25622
Modified: docs/Perl6/Spec/S16-io.pod docs/Perl6/Spec/S29-functions.pod Log: Replaced iterators with NameServices role, based on an idea of ruoso++ (although I doubt he wants credit for some of the things I've done with his ideas :) ) Modified: docs/Perl6/Spec/S16-io.pod =================================================================== --- docs/Perl6/Spec/S16-io.pod 2009-02-27 12:06:57 UTC (rev 25621) +++ docs/Perl6/Spec/S16-io.pod 2009-02-27 12:32:32 UTC (rev 25622) @@ -3,7 +3,7 @@ =head1 Title -DRAFT: Synopsis 16: IO / User / Group +DRAFT: Synopsis 16: IO / Name Services =head1 Version @@ -73,8 +73,23 @@ S32-setting-library/IO.pod. The main functions used are listed in S29 with references to S32-setting-library/IO.pod. -=head1 Users and Groups +=head1 Name Services +=head NameServices role + +The NameServices role has a bunch of functions that between them will return the whole +Name Services database between them, as lists of objects. The lists are specifically +intended to be lazy. + +role NameServices { + method List of User users() {...} # getpwent, setpwent, endpwent + method List of Group groups() {...} # getgrent, setgrent, endgrent + method List of Service services() {...} # getservent, setservent, endservent + method List of Protocol protocols() {...} # getprotoent, setprotoent, endprotoent + method List of Network networks() {...} # getnetent, setnetent, endnetent + method List of Host hosts() {...} # gethostent, sethostent, endhostent +} + =head2 User role role User { @@ -115,13 +130,6 @@ All the information is naturally fetched from the system via getpwuid, getpwnam, or the like. -=head2 UserIterator role - -role UserIterator does Iterator {...} - -In the Unix implementation, this deals with getpwent, setpwent, and endpwent. Basically, -it returns a User object with each iteration. - =head2 Group role role Group { @@ -140,13 +148,6 @@ Tries to write the group entry into the system group database. -=head2 GroupIterator role - -role GroupIterator does Iterator {...} - -In the Unix implementation, this deals with getgrent, setgrent, and endgrent. Basically, -it returns a Group object with each iteration. - =head1 Additions Please post errors and feedback to perl6-language. If you are making Modified: docs/Perl6/Spec/S29-functions.pod =================================================================== --- docs/Perl6/Spec/S29-functions.pod 2009-02-27 12:06:57 UTC (rev 25621) +++ docs/Perl6/Spec/S29-functions.pod 2009-02-27 12:32:32 UTC (rev 25622) @@ -777,9 +777,9 @@ See .pairs() method, above. -=item endpwent, endgrent +=item endpwent, endgrent, endservent, endprotoent, endnetent, endhostent -The UserIterator and GroupIterator roles in S16 cover most of these. +The NameServices role in S16 covers most of these. =item format, formline @@ -789,9 +789,9 @@ The User and Group roles in S16 cover most of these. -=item getpwent, getgrent +=item getpwent, getgrent, getservent, getnetent, gethostent -The UserIterator and GroupIterator roles in S16 cover most of these. +The NameServices role in S16 covers most of these. =item length() @@ -841,9 +841,9 @@ See IPC::SysV; -=item setpwent, setgrent +=item setpwent, setgrent, setservent, setprotoent, setnetent, sethostent -The UserIterator and GroupIterator roles in S16 cover most of these. +The NameServices role in S16 covers most of these. =item shmctl, shmget, shmread, shmwrite @@ -926,34 +926,18 @@ getservbyname getservbyport - getservent - setservent - endservent - --Protocol getprotobyname getprotobynumber - getprotoent - setprotoent - endprotoent - --Network getnetbyaddr getnetbyname - getnetent - setnetent - endnetent - --Host gethostbyaddr gethostbyname - gethostent - sethostent - endhostent - =item Flow control break