Hi,
I am trying to change my directory to a clearcase vob and run some clearcase commands in that directory. I am unable to change my directory as it
complains there is no such directory (But the directory exists :(). Can some one tell me what am I doing wrong?
Here is the code:
#!/usr/bin/perl
use strict;
use warnings;
use Cwd;
use Tie::File;
use Fcntl;
#Variable Declaration
my $request="no";
my $dir=getcwd;
my $md_dir='';
my @files="";
my $vp_file="vp_file";
my $view_tag = $ENV{'VIEW_TAG'};
my @data;
print "\n\n Checking to see if you have any checkout files...\n ";
if ( -z "/$view_tag/app_hwt/3126" || ! -e "/$view_tag/app_hwt/3126" )
{
$md_dir='medium_duty';
}
else
{
$md_dir='3126';
}
#####################################
#HERE IS WHERE ITS GIVING ME THE ERROR
#####################################
system ("cd /$view_tag/lib_engine/hwt");
system("cleartool lsco -cview -r -s > /$view_tag/lib_engine/hwt/co_fi
+le");
system ("cd /$view_tag/app_hwt/$md_dir");
system("cleartool lsco -cview -r -s >> /$view_tag/lib_engine/hwt/co_f
+ile");
if ( ! -z "/$view_tag/lib_engine/hwt/co_file" )
{
print "\n ***You have check out files.*** ";
print " Please either check them in or out before running thi
+s program again. \n";
print " Do you want to list chkout files y/n? [deflt no]: ";
chomp($request = <>);
if ( $request =~ /[Yy]/ )
{
print "\n";
open(FILE, "/$view_tag/lib_engine/hwt/$co_file") || die "Cann
+ot open co_file: $!\n";
print "\n";
}
unlink "/$view_tag/lib_engine/hwt/co_file";
die("$!");
}
else
{
print "\n\n Now Checking to see if you have any view private fil
+es...\n ";
if ( ! -e "/$view_tag/lib_engine/hwt/co_file" )
{
unlink "/$view_tag/lib_engine/hwt/co_file";
}
`cleartool lsprivate -other -s > vp_temp`;
my $temp_file="vp_temp";
open(FILE,"vp_temp") || die "Cannot open vp_temp:$!\n";
close(FILE);
open(OUTPUT,">>vp_file");
tie (@data,'Tie::File',$temp_file, mode=>O_RDWR) or die "Can't tie
+ to $temp_file:$^E\n";
(tied @data)->defer;
foreach(@data)
{
# see ex.pl
@files=grep(/\.c$/ || /\.h$/ || /\.a32$/ || /\.cfg$/ || /^Make
+file_\..*$/ ,@data);
}
print OUTPUT @files;
unlink "vp_temp";
if ( ! -z "vp_file" )
{
print "\n You have view private files: \n ";
open(FILE, "vp_file") || die "Cannot open vp_file: $!\n";
print " \n\n ";
unlink "vp_file";
}
else
{
print "\n Good Job! You have no view private files... \n\n ";
if ( ! -e "vp_file" )
{
unlink "vp_file";
}
}
}
Thanks in advance
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.