I'm searching a way to
chgrp in perl. I found chown, but it needs numerical IDs. I'm developing using Windows (yes thats odd because the target is linux) - so I tried the following code:
#!/usr/bin/perl
use strict;
use warnings;
my $group = 'users';
my @folder = qw ( worksheets correspondence );
&chgrp($group, \@folder);
sub chgrp {
my ($group, $folder) = @_;
eval { system( "chgrp $group @$folder" ) };
warn $@ if $@;
}
It works as expected - on a Windows-system it just warns that there is no chgrp-command. Is there a better way to do this? I searched on CPAN for 'chgrp' but I found nothing.