
Filehandle operations
Instead of chown/chmod, use fchown/fchmod, which operate on filehandles, instead of file names.
#!/usr/bin/perl -w
use strict;
use POSIX;
require "syscall.ph";
...
open NEWFILE, ">$file";
print NEWFILE @someinformation;
syscall( &SYS_fchown, fileno(NEWFILE), -1, $WEB_GID) or die;
syscall( &SYS_fchmod, fileno(NEWFILE), 0640) or die;
close NEWFILE;
Copyright 2003, Bri Hatch of Onsight, Inc.
Presented at SPUG, 2003.
Presentation created using vim and MagicPoint.