Bash-Completion

 view release on metacpan or  search on metacpan

t/tlib/Test/BashCompletionTestUtils.pm  view on Meta::CPAN

package    ## Hide from PAUSE
  Test::BashCompletionTestUtils;

use strict;
use warnings;
use File::Temp;
use File::Spec::Functions 'catfile';
use Config;
use parent 'Exporter';

our @EXPORT = qw( create_test_cmds );


sub create_test_cmds {
  my %results;

  my $bin_dir = $results{tempdir} = File::Temp->newdir;
  $results{path} = join($Config{path_sep}, $bin_dir, $ENV{PATH});

  for my $cmd (@_) {
    my $path = catfile($bin_dir->dirname, $cmd);
    open(my $fh, '>', $path);
    next unless $fh && chmod(0755, $path);
    $results{cmd}{$cmd} = {path => $path, fh => $fh};
  }

  return \%results;
}

1;



( run in 1.394 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )