Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
File Status --
Lal
Hi,
I have a DCR file its state is locked in Teamsite.
Thru IWPERL how can I check the status ie I need to check whether the file status is locked or not
Is there any built in method in IWPERL similar to Flock or so ?
Hope to hear from you
Lal
Find more posts tagged with
Comments
iw_store
Hi,
"istagged " "TRUE or FALSE" "True if the file is locked"
OR
See the Doc ts.650.clt.win.pdf page no 84.
Sanjeev.
Adam Stoller
iw_store's information is correct (I'll assume the page is correct too) - but to more fully answer your question: No - there is no built-in Perl method for determining this, instead, you need to use Perl's ability to run other programs (backticks, qx{...}) to invoke the iwattrib CLT on the file in question, and then parse the output.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Lal
Sanjeev, could you give a simple line of code or an eg
It should be more useful..
Lal
Adam Stoller
You should read the documentation - try out the command - and *then* if you can't figure it out - post your code and explain your problem.
If we just give you the code - you don't learn anywhere near as much as if you figure it out yourself using the tools that you already have at your disposal.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Lal
All,
I tried with these information and we were able to solve the issue.Thanks a lot for ur valuable comments.
Fish, u r a very good Teacher .. Your comments made us do this code..
We solved this with some tricks.So thought to update the code also here.may help some one..
What we did is, we wrote the "System Command "output to a file and read the data from that file and proceed with that.
ie we are not able to assign the output of "System Command " it to a variable ,thinks like there shopuld be some alternatives
Code : *********************************
#!E:\Interwoven/iw-home/iw-perl/bin/iwperl
use TeamSite::Config;
my $path="E:/Interwoven";
my $iwmount = TeamSite::Config::iwgetmount();
my $iwhome = TeamSite::Config::iwgethome();
#my $area = "/default/main/Odyssey/MNL/WORKAREA/news";
my $opendeploycmd = $path . "/iw-home/bin/iwattrib /default/main/Odyssey/PQR/WORKAREA/Releases/templatedata/PRL/PR/data/filename istagged >E:\\Interwoven\\iw-home\\local\\logs\\write.txt";
system("$opendeploycmd");
my $fil = 'E:\Interwoven\iw-home\local\logs\write.txt';
open(FIL,$fil) || die "Can't open FIL: $!\n";;
@deploystatus
= <FIL>;
foreach $art (
@deploystatus)
{
if($art =~ m/FALSE/) {
# Process Code here
}
}
close FIL;
*****************ENDS HERE ***************
Adam Stoller
What we did is, we wrote the "System Command "output to a file and read the data from that file and proceed with that.
ie we are not able to assign the output of "System Command " it to a variable ,thinks like there shopuld be some alternatives
Code : *********************************#!E:\Interwoven/iw-home/iw-perl/bin/iwperl
...
my $opendeploycmd = $path . "/iw-home/bin/iwattrib ... istagged >E:\\Interwoven\\iw-home\\local\\logs\\write.txt";
system("$opendeploycmd");
my $fil = 'E:\Interwoven\iw-home\local\logs\write.txt';
open(FIL,$fil) || die "Can't open FIL: $!\n";;
@deploystatus
= ;
foreach $art (
@deploystatus)
{
if($art =~ m/FALSE/) {
# Process Code here
}
}
close FIL;
Okay - now that you've done the work and understand your code - I'll provide some alternatives to writing the output into a hard-coded file.
1) Rather than hard-coding the filename - consider using the File::Temp module's tempfile() method. This will allow you to have multiple people run the same command concurrently without stepping on each other's toes:
...
use File::Temp qw(tempfile);
...
my($fh, $fname) = tempfile();
close($fh);
# close the file handle, use the filename
my $cmd = "... > $fname";
# It's not an opendeploy command
...
2. Rather than using a temporary file at all, consider using backtics (`...`) or better, qx(...):
...
my $cmd = "... iwattrib ... istagged";
my
@results
= qx($cmd 2>&1);
# 2>&1 redirects STDERR to STDOUT, just in case
foreach my $art (
@results){
if (...) {
...
}
}
3. You could also use the PIPE format of open(), but that wouldn't really be all that applicable in this situation:
...
if (open(PIPE, "$cmd | 2>&1")){
while (<PIPE>){
...
}
}
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Lal
Got ur piece of code..Will try and implement in the next module and will post here..
Lal