5 use System::Introspector::Probe::Sudoers;
7 my $dir = "$FindBin::Bin/sudoers-data";
10 system("mkdir $dir/bar_host");
12 my $start = write_file('sudoers',
15 "#include $dir/foo_%h",
16 "#includedir $dir/bar_%h",
19 my $foo_file = write_file('foo_host',
22 my $bar_file = write_file("bar_host/baz",
26 my $probe = System::Introspector::Probe::Sudoers->new(
27 sudoers_file => $start,
31 ok((my $data = $probe->gather), 'received data');
33 my $inc = "#include $dir/foo_\%h\n#includedir $dir/bar_\%h\n";
35 $start => { body => "foo bar\nbaz qux\n$inc" },
36 $foo_file => { body => "in foo\n" },
37 $bar_file => { body => "in bar file\n" },
40 system("rm $_") for $start, $foo_file, $bar_file;
41 system("rmdir $dir/bar_host");
46 my ($file, @lines) = @_;
47 my $path = "$FindBin::Bin/sudoers-data/$file";
48 open my $fh, '>', $path or die "Unable to write $path: $!\n";
49 print $fh map "$_\n", @lines;