Perl6-Doc

 view release on metacpan or  search on metacpan

share/Synopsis/S16-io.pod  view on Meta::CPAN

The global variable $*CWD is a Path object with certain special properties, 
mainly:

 * It must check whether the path exists before changing its value
 * It can only be assigned an absolute path; if you want to make relative 
   changes, use the Array interface

$*CWD is specific to the current thread, unlike C<< %*ENVZ<><PATH> >> or the
native getcwd/chdir path, which are both usually process-wide.

The variable is used in at least these cases:

 * When a Path object is created, if the string it is given is not an
   absolute path, then $*CWD is prepended to it.
 * When a subprocess is executed, it is executed with the current
   thread's $*CWD as its working directory.

=head1 Name Services

=head2 User role

    role User {
        has $username; # Username (some descendants(?) may want to implement a real $name)
        has $id;  # User ID
        has $dir; # Home directory for files
    }

=over

=item new

    method User new($Username?, $UID?) {...}

Creates a new User object, fetching the information either by username or user ID.

=item write

    method write() {...}

Tries to write the current User object to the user database.  This may well fail.

=item Str

When converted to a Str, returns $username.

=item Num

When converted to a Num, returns $uid.

=back

=head2 OS::Unix::User role

    role OS::Unix::User does User {
        has $password;
        has $gid;
        has $gecos;
        has $shell;
    }

All the information is naturally fetched from the system via getpwuid, getpwnam, or the
like.

=head2 Group role

    role Group {
        has $name;
        has $id;
        has @members;
    }

=over

=item new

    method Group new(:$Name, :$ID);

=item write

    method write();

Tries to write the group entry into the system group database.

=back

=head2 OS::Unix::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
    }

=head1 Additions

Please post errors and feedback to perl6-language.  If you are making
a general laundry list, please separate messages by topic.

=cut

=for vim:set expandtab sw=4:



( run in 3.639 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )