function to get dcrpath in perl for interwoven teamsite

sub getDcrPath{
    debug("getDCRPATH CALLED");
    my $currentDcrName=shift;
       debug("dcr path: $currentDcrName");
    $currentDcrName=~ s/(.*WORKAREA\/)(.*?\/)/$1$2/;
    my $workareaName=$2;
    $workareaName=~s/\///g;
    #my $dcrPath="$iwmount/default/main/$branchName/$subBranchName/WORKAREA/$workareaName/templatedata/content/Fragments/data/";
    debug("WORKAREA ".$workareaName."==".$currentDcrName);
    return $workareaName;
}
hi friends here iam sharing a subroutine for reading a datacapture template in interwoven teamsite using perl script. hope this subroutine will help your requirement.


sub readDatacapture
{   

    debug("ENTERING READ DATACAPTURE FUNCTION");
    my $dctFile = shift;
   
    open INPUT, "<$dctFile";
    my @output_string = ;
    close INPUT;
    #debug("\n\n");
    foreach my $line(@output_string) {
       
        if ( $line =~ /.*command.*/ ) {

            #grab just the command itself
            my @fields2 = split /=/, $line;
            my $inlineCmd = @fields2[$#fields2] ;
            $inlineCmd =~ s/\/\>//; #strip off trailing tag
            $inlineCmd =~ s/\"//g; #strip off quotes

            #print "XXX" . $inlineCmd . "XXX\n";
            my @Results = `$inlineCmd 2>&1`;
            my $Result = join ('', @Results);
            chomp ($Result);   

            #remove the double substitution tags, since it maybe a normal inline that has substitution on it
            $Result =~ s/\//;
            $Result =~ s/\<\/substitution\>//;

            #remove xml declaration that would normally come across an inline
            $Result =~ s/\<\?xml.*\>?//;

            #Now substitute result for inline command
            print $Result;
            #debug("The result of $inlineCmd ");
            #debug("$Result");
           
           
        }
        else
        {   
            #print " IN ELSE ========== > $line\n";
            print $line;
            #debug("$line");
           
           
        }
    }
    #debug("\n\n");
    debug("EXITING READ DATACAPTURE FUNCTIONNNNNNN");
}