Linux-Utils
view release on metacpan or search on metacpan
#!perl
use Test::More;
use Modern::Perl;
use Data::Printer alias => 'pdump';
use Util::Medley::File;
use Util::Medley::Spawn;
use English;
use Linux::Utils::YUM;
###################################################
my $file = Util::Medley::File->new;
my $yum = Linux::Utils::YUM->new;
ok($yum);
SKIP: {
my $yumPath = $file->which('yum');
skip "can't find yum exe" if !$yumPath;
doRepoList($yum);
doList($yum);
}
SKIP: {
my $repoqueryPath = $file->which('repoquery');
skip "can't find repoquery exe" if !$repoqueryPath;
doRepoList($yum);
}
done_testing;
###################################################
sub doList {
my $yum = shift;
my $repoList = $yum->repoList;
foreach my $repo (@$repoList) {
my $list = doListByRepo( $yum, $repo );
if ($list and @$list > 0) {
last; # don't need to test all repos
}
}
}
sub userCanSudoNoPasswd {
if ( $UID == 0 ) {
return 1;
}
my $spawn = Util::Medley::Spawn->new;
my @cmd = ( "sudo", "-n", "true" );
my ( $stdout, $stderr, $exit ) =
$spawn->capture( cmd => \@cmd, wantArrayRef => 1 );
if ( !$exit ) {
return 1;
}
( run in 3.406 seconds using v1.01-cache-2.11-cpan-98e64b0badf )