Sidef

 view release on metacpan or  search on metacpan

lib/Sidef.pm  view on Meta::CPAN


        $self->{sidef_config_dir} //= $ENV{SIDEF_CONFIG_DIR}
          || File::Spec->catdir(
                                $ENV{XDG_CONFIG_DIR}
                                  || (
                                         $ENV{HOME}
                                      || $ENV{LOGDIR}
                                      || (
                                          $^O eq 'MSWin32'
                                          ? '\Local Settings\Application Data'
                                          : eval { ((getpwuid($<))[7] || `echo -n ~`) }
                                         )
                                      || File::Spec->curdir()
                                     ),
                                '.config',
                                'sidef'
                               );

        if (not -d $self->{sidef_config_dir}) {
            require File::Path;
            eval { File::Path::make_path($self->{sidef_config_dir}) }

lib/Sidef/Sys/Sys.pm  view on Meta::CPAN

                                    Sidef::Types::String::String->new($quota), Sidef::Types::String::String->new($comment),
                                    Sidef::Types::String::String->new($gcos),  Sidef::Types::String::String->new($shell),
                                   );
}

sub setpwent {
    my ($self) = @_;
    (CORE::setpwent) ? (Sidef::Types::Bool::Bool::TRUE) : (Sidef::Types::Bool::Bool::FALSE);
}

sub getpwuid {
    my ($self, $uid) = @_;
    $self->__GETPW__(CORE::getpwuid($uid));
}

sub getpwnam {
    my ($self, $name) = @_;
    $self->__GETPW__(CORE::getpwnam($name));
}

sub getpwent {
    my ($self) = @_;
    $self->__GETPW__(CORE::getpwent);

lib/Sidef/Sys/Sys.pod  view on Meta::CPAN

    self.getpwnam(name)

Looks up a user by login name. On success, returns an array with fields, in order: C<[name, passwd, uid, gid, quota, comment, gcos]>, followed by the shell, i.e. C<[name, passwd, uid, gid, quota, comment, gcos, shell]>. Note that the home directory i...

    var user = Sys.getpwnam('root')
    say user[0]   # name
    say user[2]   # uid

=cut

=head2 getpwuid

    self.getpwuid(uid)

Looks up a user by numeric user ID. Returns the same array shape as L</getpwnam>, or C<nil> if not found.

    var user = Sys.getpwuid(1000)
    say user[0]   # name

=cut

=head2 getpwent

    self.getpwent

Returns the next entry from the user database as the same array shape as L</getpwnam>, or C<nil> when there are no more entries. Use L</setpwent> to rewind and iterate again.

lib/Sidef/Types/Glob/Dir.pm  view on Meta::CPAN

sub root {
    __PACKAGE__->new(File::Spec->rootdir);
}

sub home {
    my ($self) = @_;

    my $home = $ENV{HOME} || $ENV{LOGDIR};

    if (not $home and $^O ne 'MSWin32') {
        $home = (getpwuid($<))[7];
    }

    $home ? __PACKAGE__->new($home) : do {
        state $x = require File::HomeDir;
        __PACKAGE__->new(File::HomeDir->my_home);
    };
}

sub tmp {
    __PACKAGE__->new(File::Spec->tmpdir);



( run in 1.895 second using v1.01-cache-2.11-cpan-6736b670a1e )