1package Lchown;
2use strict;
3use warnings;
4use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
5
6require Exporter;
7
8@ISA = qw(Exporter);
9@EXPORT    = qw(lchown);
10@EXPORT_OK = qw(lchown LCHOWN_AVAILABLE);
11
12$VERSION = '1.01';
13
14require XSLoader;
15XSLoader::load('Lchown', $VERSION);
16
17sub LCHOWN_AVAILABLE () {
18    defined lchown(0,0) ? 1 : 0;
19}
20
211;
22
23__END__
24
25=head1 NAME
26
27Lchown - use the lchown(2) system call from Perl
28
29=head1 SYNOPSIS
30
31  use Lchown;
32
33  lchown $uid, $gid, 'foo' or die "lchown: $!";
34
35  my $count = lchown $uid, $gid, @filenames;
36
37  # or
38
39  use Lchown qw(lchown LCHOWN_AVAILABLE);
40
41  warn "this system lacks the lchown system call\n" unless LCHOWN_AVAILABLE;
42
43  ...
44
45  # or
46
47  use Lchown ();
48
49  warn "this won't work\n" unless Lchown::LCHOWN_AVAILABLE;
50  Lchown::lchown $uid, $gid, 'foo' or die "lchown: $!";
51
52=head1 DESCRIPTION
53
54Provides a perl interface to the C<lchown()> system call, on platforms that
55support it.
56
57=head1 DEFAULT EXPORTS
58
59The following symbols are exported be default:
60
61=over
62
63=item lchown (LIST)
64
65Like the C<chown> builtin, but using the C<lchown()> system call so that
66symlinks will not be followed.  Returns the number of files successfully
67changed.
68
69On systems without the C<lchown()> system call, C<lchown> always returns
70C<undef> and sets C<errno> to C<ENOSYS> (Function not implemented).
71
72=back
73
74=head1 ADDITIONAL EXPORTS
75
76The following symbols are available for export but are not exported by
77default:
78
79=over
80
81=item LCHOWN_AVAILABLE ()
82
83Returns true on platforms with the C<lchown()> system call, and false on
84platforms without.
85
86=back
87
88=head1 SEE ALSO
89
90L<perlfunc/chown>, L<lchown(2)>
91
92=head1 AUTHOR
93
94Nick Cleaton E<lt>nick@cleaton.netE<gt>
95
96=head1 COPYRIGHT AND LICENSE
97
98Copyright 2003-2009 Nick Cleaton, all rights reserved.
99
100This program is free software; you can redistribute it and/or modify it under
101the same terms as Perl itself.
102
103=cut
104