Sidef

 view release on metacpan or  search on metacpan

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

        my ($self) = @_;
        Sidef::Types::Glob::Stat->stat("$self", $self);
    }

    sub lstat {
        ref($_[0]) || shift(@_);
        my ($self) = @_;
        Sidef::Types::Glob::Stat->lstat("$self", $self);
    }

    sub chown {
        ref($_[0]) || shift(@_);
        my ($self, $uid, $gid) = @_;
        CORE::chown($uid, $gid, "$self")
          ? (Sidef::Types::Bool::Bool::TRUE)
          : (Sidef::Types::Bool::Bool::FALSE);
    }

    sub chmod {
        ref($_[0]) || shift(@_);
        my ($self, $permission) = @_;
        CORE::chmod($permission, "$self")
          ? (Sidef::Types::Bool::Bool::TRUE)
          : (Sidef::Types::Bool::Bool::FALSE);

lib/Sidef/Types/Glob/File.pod  view on Meta::CPAN

Changes the file's permission bits. The permission can be specified as an octal number or a string.

    var file = File("script.sh")
    file.chmod(0755)                # rwxr-xr-x
    file.chmod("644")               # rw-r--r--

Returns C<true> on success, C<false> otherwise.

=cut

=head2 chown

    file.chown(uid, gid)

Changes the owner and group of the file. Both C<uid> (user ID) and C<gid> (group ID) must be provided as numeric values.

    var file = File("data.txt")
    file.chown(1000, 1000)          # Change owner and group

Returns C<true> on success, C<false> otherwise. May require elevated privileges.

=cut

=head2 compare

    file.compare(other_file)

Compares the contents of two files byte-by-byte. Returns C<0> if files are identical, C<-1> if the first file is less than the second, C<1> if greater, or C<nil> on error.



( run in 0.476 second using v1.01-cache-2.11-cpan-5511b514fd6 )