BSD::Resource has had a get_rlimits() sub for a while to return
a hashref to non-Inline::C users. So favor using that after
`require' rather than a string eval which can't be checked for
syntax-only errors.
my $rlim = [];
foreach my $l (@RLIMITS) {
my $v = $opt->{$l} // next;
- my $r = $RLIMITS{$l} //
- eval "require BSD::Resource; BSD::Resource::$l();" //
- do {
+ my $r = $RLIMITS{$l} // eval {
+ require BSD::Resource;
+ my $rl = BSD::Resource::get_rlimits();
+ @RLIMITS{@RLIMITS} = @$rl{@RLIMITS};
+ $RLIMITS{$l};
+ } // do {
warn "$l undefined by BSD::Resource: $@\n";
next;
};