From: pcanterino <> Date: Sun, 1 Aug 2004 11:39:56 +0000 (+0000) Subject: Allow to change the group of a file using the Group ID X-Git-Tag: version_2_0~4 X-Git-Url: https://git.p6c8.net/devedit.git/commitdiff_plain/02321769f658fbe95c046c17f0c5b4de759d282f?ds=sidebyside Allow to change the group of a file using the Group ID (Let's hope nobody will define a group composed only of numbers - let's hope it isn't allowed at all - I should install Linux at home...) --- diff --git a/modules/File/Access.pm b/modules/File/Access.pm index 31ad87d..bc1e37d 100644 --- a/modules/File/Access.pm +++ b/modules/File/Access.pm @@ -7,7 +7,7 @@ package File::Access; # with only one command # # Author: Patrick Canterino -# Last modified: 2004-07-28 +# Last modified: 2004-08-01 # use strict; @@ -40,7 +40,7 @@ use base qw(Exporter); sub chgrp($@) { my ($group,@files) = @_; - my $gid = getgrnam($group); + my $gid = ($group !~ /^\d+$/) ? getgrnam($group): $group; return unless($gid); return chown(-1,$gid,@files);