blob: 0aa966f8c89d2e1fe4ca67bf2d436c5b5f418bf3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package Local::Rex::Util;
use 5.028;
use strict;
use warnings;
use parent 'Exporter';
use Rex -feature => ['1.4'];
our @EXPORT = qw( as as_me );
sub as ($&) {
can_run "sudo" or die "wanted to execute as $_[0] but no sudo on PATH!";
sudo { user => $_[0], command => $_[1]};
}
sub as_me (&) {
my $me = get("me") || "spwhitton";
as($me, \&{$_[0]});
}
1;
|