August 19 2020 | Perl 7: An Opinionated Introduction | Back Next |
Sometimes the warning needs to be taken seriously ...
... meaning the code needs to be rewritten to eliminate the cause for the warning
$ cat heed-syntax-warning.t use Test::More;
SKIP: { # try to add a group as supplementary group my $root_uid = 0; skip "uid!=0", 1 if $< != $root_uid and $> != $root_uid; my @groups = split ' ', $); my @sup_group; setgrent; while(my @ent = getgrent) { next if grep { $_ == $ent[2] } @groups; @sup_group = @ent; last; } endgrent; skip "No group found we could add as a supplementary group", 1 if (!@sup_group); $) = "$) @sup_group[2]"; my $ok = grep { $_ == $sup_group[2] } split ' ', $); ok $ok, "Group `$sup_group[0]' added as supplementary group"; }
done_testing;
Home Last TOC | Copyright © 2020 James E Keenan | Back Next |