ClearCase-Wrapper

 view release on metacpan or  search on metacpan

cleartool.dbg  view on Meta::CPAN

	    } else {
	      $rc = 0;
	    }
	    return $rc; # Completed, successful or not
	}
	# a zero return signals falling back to cleartool
	return $rc if $rc;
    }

    # Either there was no override defined for this command or the override
    # decided to let us finish up by exec-ing the current @ARGV.
    # If we're on Windows we need ClearCase::Argv to avoid the weird
    # behavior of native exec() there. If we're already using ClearCase::Argv
    # we continue to do so, and if any -/foo flags are directed at it
    # we must use it in in order to parse them. But otherwise, so as
    # to not unduly slow down a cmd that isn't being overridden anyway,
    # we skip all that overhead and just exec.
    if ($^O =~ /MSWin32|cygwin/ || defined $Argv::{new} || grep(m%^-/%, @ARGV)) {
	if (grep !m%^-/%, @ARGV) {
	    local $^W = 0;
	    require ClearCase::Argv;
            {
                no warnings qw(redefine);
                *Argv::exec = $diemexec;
            }
            ClearCase::Argv->VERSION(1.43);
	    ClearCase::Argv->attropts;
	    # The -ver flag/cmd is a special case - must be exec-ed.
	    return system('cleartool', @ARGV) if $ARGV[0] =~ /^-ver/i;
	    return ClearCase::Argv->new(@ARGV)->system;
	} else {
	    return system 'cleartool', @ARGV;
	}
    } else {
	if (-d '/opt/rational') {
	    unshift(@ARGV, '/opt/rational/clearcase/bin/cleartool');
	} elsif (-d '/usr/atria') {
	    unshift(@ARGV, '/usr/atria/bin/cleartool');
	} else {
	    unshift(@ARGV, 'cleartool');
	}
	return system(@ARGV);
    }
}
my $status;
if (scalar @ARGV == 1 && $ARGV[0] eq '-status') {
    $status = 1;
    @ARGV = ();
    $| = 1; #autoflush STDOUT
}
if (@ARGV) {
    exit one_cmd;
} else {
    my $rc = 0;
    my $interactive = -t STDIN;
    require Text::ParseWords;
    print "$prog", $status ? $status : '', '> ' if $interactive;
    while (my $line = <>) {
	chomp $line;
	last if $line =~ '^(quit|exit)$';
	local @ARGV = Text::ParseWords::shellwords($line);
	$rc = one_cmd;
	if ($status) {
	    print "Command $status returned status $rc\n";
	    $status++;
	}
	print "$prog", $status?" $status":'', '> ' if $interactive;
    }
    exit $rc;
}



( run in 1.761 second using v1.01-cache-2.11-cpan-63c85eba8c4 )