Home
TeamSite
Accessing Metadata
deeps79
Hi,
I need to access metadata stored using iwmetadata.cgi for a DCR from a tpl file.
How can this be done?
Can we the iwextattr command for this, how do we call it from the tpl (not command line).
Thanks ,
Deepa
Find more posts tagged with
Comments
gzevin
you call it from within a TPL using either a
system
or backticks (`) from iw_perl section.
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
stefanmaier
Hi,
yes, try to include some perl code in your tpl-files like
<iw_perl><![CDATA[
...
my $dcr = iwpt_get_dcr_name();
my $attrib = `$iwhome/bin/iwextattr.exe -u -g TeamSite/Metadata/YourData \"$dcr\"`;
...
]]></iw_perl>
(it's windows code...)
Greetings
Adam Stoller
As a stylistic note only - I'd recommend:
<iw_pt name="..."/>
<iw_perl>
use TeamSite::Config;
my $iwhome = TeamSite::Config::iwgethome();
my $dcr = iwpt_get_dcr_name();
my $attrib = qx($iwhome/bin/iwextattr -u -g TeamSite/Metadata/YourData "$dcr");
...
</iw_perl>Also note, you should not need to include the .exe on the command being run - Windows / DOS should handle things just fine without it..
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
stefanmaier
Hello,
thanks for the two hints, they make life a little bit easier :-)
The elimination of the .exe has could be unsafe in one point:
Some months ago one of our developers has created two empty files named "iwextattr" and "iwsubmit" in our c:\iw-home\bin-directrory.
This had the consequence, that these two commands could be started from a CMD-shell, but not from an perlscript.
Debugging was annoying...
Greetings
Stefan
gzevin
well, using CDATA is IMO a matter of what one got used to. I still use it
and I find it's easier when I edit the file in a colouring editor.
as far as perl is concerned - it's also always a matter of personal style
actually, it's worth to get even further with this exercise and to write a set of routines that would read the whole set of metadata in a hash using a one-liner .....
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU