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)
External Task not cooperating
myr
I have a workflow that points to an external task that generates a DCR and then saves the generated html to another directory. We have two different DCTs so I need to save the generated html from each one to different folders.
I have tried to add the following if...else statement to my script to save any DCR with the "News" value to the "Current" directory, but it keeps failing. The script runs fine with just the third line, but saves all the html files to the "Current" directory.
my $keyword = News;
if ($dcr =~ m/($keyword)/) {
my $generatedFile_dir = "$areapath/Current/";
} else {
my $generatedFile_dir = "$areapath/";
}
Thanks for any suggestions/ideas.
Find more posts tagged with
Comments
Migrateduser
Line 1 does not have quotes around 'News'. Did you paste it right or is that your code?
Current Environments:
(1) TS 6.5 on W2K3 (x2 - diff. imp.)
(3) Vignette V7 Portal on Solaris 9
Adam Stoller
First - I'm not sure you're providing enough context.
Second - I think you're missing quotes on this line:
my $keyword =
"
News
"
;
(
and what's mentioned in the next post -- sigh - must have been too distracted watching Wimbledon to have noticed
)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Edited by ghoti on 06/30/05 08:05 AM (server time).
jbonifaci
I'm guessing you are then trying to use $generatedFile_dir after your if/else statement? I would recommend reading a few perl books to get familiar with the basics. You are declaring this variable locally within your if/else, it no longer exists after the if/else has completed. You need to declare it within the scope that it is needed. If you want to use it after the if, you'll need to declare it outside the if.
~Jeff
myr
Jeff,
Thanks for your suggestion. I was trying to use $generatedFile_dir after the if/else statement, so I moved it within the scope where it's needed and now the script works.
if ($dcr_path =~ m/("News")/) {
my $generatedFile_dir = "$areapath/Current/";
my $ofile = "$generatedFile_dir$dcr_name.shtml";
my $task_cmd="$iwhome/bin/iwpt_compile.ipl -pt $pt -iw_pt-dcr $dcr_path -ofile $ofile";
debug("Gen command: $task_cmd");
`$task_cmd`;
} else {
my $generatedFile_dir = "$areapath/";
my $ofile = "$generatedFile_dir$dcr_name.shtml";
my $task_cmd="$iwhome/bin/iwpt_compile.ipl -pt $pt -iw_pt-dcr $dcr_path -ofile $ofile";
debug("Gen command: $task_cmd");
`$task_cmd`;
}