Lchown(3pm)

πŸ’– Lchown(3pm) πŸ’–

okay bestie, welcome to the Lchown era β€” it's a User Contributed Perl Documentation page and it's literally here to let you call the lchown(2) system call straight from Perl. No C, no wrappers, just vibes ✨


🌸 NAME 🌸

Lchown</purgle> β€” use the lchown(2) system call from Perl 🫢


πŸŽ€ SYNOPSIS πŸŽ€

okay so here's the three ways you can show up to this party πŸ’…

use Lchown;

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

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

or, if you want the availability flag too πŸ‘‘

use Lchown qw(lchown LCHOWN_AVAILABLE);

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

...

or, if you're feeling feral and want to import absolutely nothing πŸ™ˆ

use Lchown ();

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

πŸ¦‹ DESCRIPTION πŸ¦‹

It gives you a perl interface to the lchown() system call β€” on platforms that support it. That's it, that's the whole thing, and it eats every single time πŸ’–


✨ DEFAULT EXPORTS ✨

These symbols come through by default, no asking required 🎁

  • lchown(LIST) β€” It's giving chown builtin energy, but it uses the lchown() system call instead, so symlinks do NOT get followed πŸš«πŸ”—. Returns the number of files it succesfully changed.
⚠️ Heads up, bestie: on systems without the lchown() system call, lchown always returns undef and sets errno to ENOSYS (Function not implemented). It will not work. It cannot work. Periodt. πŸ’€

πŸ’œ ADDITIONAL EXPORTS πŸ’œ

These are available for export but they are not exported by default β€” you gotta ask nicely 🌈

  • LCHOWN_AVAILABLE() β€” Returns true on platforms that have the lchown() system call, and false on platforms that don't. It's literally a vibe check for your OS πŸ‘‘βœ¨

πŸ‘€ SEE ALSO πŸ‘€

i.e. go read the perlfunc chown entry and the lchown(2) manpage, iykyk 🧚


πŸ“ AUTHOR πŸ“

Nick Cleaton <nick@cleaton.net> β€” main character, honestly 🫢


Copyright 2003-2009 Nick Cleaton, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🌸


and that's the whole page, bestie β€” go lchown something (or don't, if your platform said no) πŸŽ€πŸ¦‹

sign-off szn: this beautiful thing is perl v5.42.3, dated 2026-08-19, and it answers to the name Lchown(3pm) βœ¨πŸ’–

πŸ“¦ where this page comes from