Lchown - use the lchown(2) system call from Perl


Lchown documentation Contained in the Lchown distribution.

Index


Code Index:

NAME

Top

Lchown - use the lchown(2) system call from Perl

SYNOPSIS

Top

  use Lchown;

  lchown $uid, $gid, 'foo' or die "lchown: $!";

  my $count = lchown $uid, $gid, @filenames;

  # or

  use Lchown qw(lchown LCHOWN_AVAILABLE);

  warn "this system lacks the lchown system call\n" unless LCHOWN_AVAILABLE;

  ...

  # or

  use Lchown ();

  warn "this won't work\n" unless Lchown::LCHOWN_AVAILABLE;
  Lchown::lchown $uid, $gid, 'foo' or die "lchown: $!";

DESCRIPTION

Top

Provides a perl interface to the lchown() system call, on platforms that support it.

DEFAULT EXPORTS

Top

The following symbols are exported be default:

lchown (LIST)

Like the chown builtin, but using the lchown() system call so that symlinks will not be followed. Returns the number of files successfully changed.

On systems without the lchown() system call, lchown always returns undef and sets errno to ENOSYS (Function not implemented).

ADDITIONAL EXPORTS

Top

The following symbols are available for export but are not exported by default:

LCHOWN_AVAILABLE ()

Returns true on platforms with the lchown() system call, and false on platforms without.

SEE ALSO

Top

chown in perlfunc, lchown(2)

AUTHOR

Top

Nick Cleaton <nick@cleaton.net>

COPYRIGHT AND LICENSE

Top


Lchown documentation Contained in the Lchown distribution.

package Lchown;
use strict;
use warnings;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);

require Exporter;

@ISA = qw(Exporter);
@EXPORT    = qw(lchown);
@EXPORT_OK = qw(lchown LCHOWN_AVAILABLE);

$VERSION = '1.01';

require XSLoader;
XSLoader::load('Lchown', $VERSION);

sub LCHOWN_AVAILABLE () {
    defined lchown(0,0) ? 1 : 0;
}

1;

__END__