App-diff_spreadsheets

 view release on metacpan or  search on metacpan

bin/diff_spreadsheets  view on Meta::CPAN


foreach my $key (qw/columns id_columns always_show_columns sheet_names/) {
  next unless $opts{$key};
  @{$opts{$key}} = map{ split/(?<!\\),/ } @{$opts{$key}}
}
$opts{verbose} //= $opts{debug};

if ($opts{output_encoding}) {
  my $crlf = grep(/crlf/, PerlIO::get_layers(*STDOUT)) ? ":crlf" : "";
  my $arg = ":raw${crlf}:encoding($opts{output_encoding})";
  warn ">binmode STDOUT/ERR '$arg'\n" if $opts{debug};
  binmode(\*STDOUT, $arg) or die "binmode $arg : $!";
  binmode(\*STDERR, $arg) or die "binmode $arg : $!";
}
($stdout_encoding) = map{ /encoding\((.+)\)/ ? ($1) : () }
                     PerlIO::get_layers(*STDOUT);

($visible_space, $RArrow) =
    ($stdout_encoding =~ /utf/i)
      ? ("\N{MIDDLE DOT}", "\N{RIGHTWARDS ARROW}\N{HAIR SPACE}")
      : (".",              "-->") ;

our ($hash_func_code, $hashid_func_code, $setup_code_code);

t/t_TestCommon.pm  view on Meta::CPAN


use Carp;
BEGIN{
  confess "Test::More already loaded!" if defined( &Test::More::ok );
  confess "Test2::V0 already loaded!" if defined( &Test2::V0::import );

  # Force UTF-8 (and remove any other encoder) regardless of the
  # environment/terminal.  This allows tests to use capture {...} and check
  # the results independent of the environment, even though printed results
  # may be garbled.
  binmode(STDIN, ":raw:encoding(UTF-8):crlf");
  if ($^O eq "MSWin32") {
    binmode(STDOUT, ":raw:encoding(UTF-8)");
    binmode(STDERR, ":raw:encoding(UTF-8)");
  } else {
    binmode(STDOUT, ":raw:crlf:encoding(UTF-8)");
    binmode(STDERR, ":raw:crlf:encoding(UTF-8)");
  }

  # Disable buffering
  STDERR->autoflush(1);
  STDOUT->autoflush(1);

  # NO!  Momentarily I thought it would be a Good Thing to set a standard
  # terminal width in COLUMNS ignoring the actual terminal.  But some
  # modules test term width autodetect by unsetting COLUMNS and would
  # then get a (possibly) different result.

t/t_TestCommon.pm  view on Meta::CPAN

    return if $^S or !defined($^S);  # executing an eval, or Perl compiler
    my @diemsg = @_;
    my $err=_finish_silent(); warn $err if $err;
    die @diemsg;
  };

  my @OUT_layers = grep{ $_ ne "unix" } PerlIO::get_layers(*STDOUT, output=>1);
  open($orig_stdOUT, ">&", \*STDOUT) or die "dup STDOUT: $!";
  close STDOUT;
  open(STDOUT, ">", \$inmem_stdOUT) or die "redir STDOUT: $!";
  binmode(STDOUT); binmode(STDOUT, ":utf8");

  my @ERR_layers = grep{ $_ ne "unix" } PerlIO::get_layers(*STDERR, output=>1);
  open($orig_stdERR, ">&", \*STDERR) or die "dup STDERR: $!";
  close STDERR;
  open(STDERR, ">", \$inmem_stdERR) or die "redir STDERR: $!";
  binmode(STDERR); binmode(STDERR, ":utf8");
}
sub silent(&) {
  my $wantarray = wantarray;
  my $code = shift;
  _start_silent();
  my @result = do{
    if (defined $wantarray) {
      return( $wantarray ? $code->() : scalar($code->()) );
    }
    $code->();



( run in 0.222 second using v1.01-cache-2.11-cpan-eab888a1d7d )