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)
inline iw_workarea is blank
wmh
Someone please tell me why this is coming up blank in an inline ipl:
my $wa=$ENV{IW_WORKAREA};
TS 6.0.0 Build 25262
Solaris
Find more posts tagged with
Comments
Adam Stoller
Under normal circumstances it shouldn't be coming up blank.
Perhaps you can show a snippet of your DCT where you are calling your script - and - post the script itself so we can see how you are trying to access the environment variable within context?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
wmh
Here is the DCT Section:
<container name="SubMenu" min="0" max="10">
<label>Sub Level 2 Menu item</label>
<item name="SubMenu2_Item">
<label>Sub level 2 Item Name</label>
<select>
<inline command="/iw-home/iw-perl/bin/iwperl /local/apps/iw-home/httpd/iw-bin/intranet/website/navigation_options.ipl"/>
</select>
</item>
</container>
Here is a section of the ipl:
my $xml="<option/>\n";
my $wa=$ENV{IW_WORKAREA};
# $wa="/default/main/intranet/Microsite/WORKAREA/all";
my $dirtoget = $wa."/templatedata/site/Pages/data";
opendir(IMD, $dirtoget) || die("Cannot open directory $dirtoget");
@thefiles=
readdir(IMD);
closedir(IMD);
If I set the $wa, the inline works fine. If I use the $ENV, $wa comes back blank.
Adam Stoller
First, if you're on Unix (which you seem to be) you don't need to preface the inline command with "/iw-home/iw-perl/bin/iwperl" -- but I don't believe that should cause a problem.
Second - try changing $ENV{IW_WORKAREA} to $ENV{"IW_WORKAREA"} -- see if that helps.
Third, if the above didn't help - put some debugging code into your script:
if (open(OUT, ">/tmp/dbg.txt")){
print OUT "$_ => $ENV{$_}\n" foreach(sort(keys(%ENV)));
close(OUT);
}
and show us what comes back.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
wmh
I have tried it with both quotes and without.
The dbg.txt file was created, but it's empty.
Just to make sure I placed text wrappers around the key sort. The dbg file reads:
ENV Keys:
end output
Adam Stoller
Hmm - very strange.
My guess is we're overlooking some simple but important aspect of the code - but in the interest of time, I suggest you contact Support to get them started on looking into this while others here, no doubt, will also give the information some perusal.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
jbonifaci
Can you please attach your entire script? There may be something someone might notice in the rest of the script, even though you don't think it is relevant.
wmh
Here is the entire script:
#!/local/apps/iw-home/iw-perl/bin/iwperl
use File::Basename;
use Time::CTime;
use TeamSite:
CRparser;
use TeamSite::XMLparser;
use TeamSite::XMLnode;
my $parser = TeamSite:
CRparser->new();
if (open(OUT, ">/iw-home/tmp/dbg.txt")){
print OUT "ENV Keys:\n";
print OUT "$_ => $ENV{$_}\n" foreach(sort(keys(%ENV)));
print OUT "end output\n";
close(OUT);
}
my $xml="<option/>\n";
my $wa=$ENV{"IW_WORKAREA"};
# $wa="/default/main/intranet/Microsite/WORKAREA/all";
my $dirtoget = $wa."/templatedata/site/Pages/data";
opendir(IMD, $dirtoget) || die("Cannot open directory $dirtoget");
@thefiles=
readdir(IMD);
closedir(IMD);
foreach $file (
@thefiles)
{
open (DCR,$dirtoget."/".$file) || die ("Can not open DCR");
while (<DCR>) {
$dcr .= $_;
}
close DCR;
my $dcr_root = $parser->parse($dcr, 'document');
if (!defined $dcr_root) {
}
else {
my $title=$dcr_root->value('Title');
$xml .= "<option value='$title' label='$title'/>\n";
}
$dcr ='';
}
my $line="<?xml version='1.0' encoding='UTF-8'?><substitution>$xml</substitution>";
print $line;
# <?xml version='1.0' encoding='UTF-8'?>
# <substitution>$xml</substitution>
# EOF
jbonifaci
Well, nothing jumps out at me. Have you tried removing everything from your inline except the lines that are outputting the environment variables?
I also noticed you are using 6.0. Any plans to upgrade to 6.1? Probably not related, but I'm sure with 6.1 and both SP's, it will help eliminate some other issues you'll run into.
Oh, and just out curiosity, you aren't invoking the inline in some abnormal way, are you? You didn't mention anything, so I assume not, but just curious.
Adam Stoller
I'll further the suggestion - try removing all the other code - especially all the 'use' pragmas and see if the debugging code you inserted starts showing up information.
It's possible (though seemingly unlikely) that one of the modules being included is somehow mucking with the environment information.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
gzevin
to follo up on jbonifaci's question - how do you call your inline? from command line or when opening a DCT?
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
wmh
The inline command is posted above.
wmh
I tested removing all use command, no luck..
wmh
Latest test:
Error:
Details...
com.interwoven.ui.formspub.datacapture.dct.InlineCallout$InlineCalloutException: Cannot open directory /templatedata/site/Pages/data at /local/apps/iw-home/httpd/iw-bin/intranet/website/navigation_options.ipl line 16.
total inline script:
#!/local/apps/iw-home/iw-perl/bin/iwperl
if (open(OUT, ">/iw-home/tmp/dbg.txt")){
print OUT "ENV Keys:\n";
print OUT "$_ => $ENV{$_}\n" foreach(sort(keys(%ENV)));
print OUT "end output\n";
close(OUT);
}
my $xml="<option/>\n";
my $wa=$ENV{IW_WORKAREA};
# $wa="/default/main/intranet/Microsite/WORKAREA/all";
my $dirtoget = $wa."/templatedata/site/Pages/data";
opendir(IMD, $dirtoget) || die("Cannot open directory $dirtoget");
@thefiles=
readdir(IMD);
closedir(IMD);
------------------------
db.txt file:
ENV Keys:
end output
I guess it's time to call support
Adam Stoller
Do you have read/write access to the templatedata directory tree structure for this DCT?
- specifically, what are the permissions on .../templatedata/site/Pages/data in the workarea in which you are operating?
Do you have "iwui" listed in your master.uid file ?(lots of weird things can happen if you don't)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com