Hi,
I have a requirement to set the extended attributed with the values that are captured from textarea feild in DCT.
I tried doing this in the folowing way...
passEA( $full_path, { 'MyMetadata' => $Metadata } );
sub passEA {
my ($fileVpath, $eas) = (shift, shift);
my
@eaList = ();
foreach my $key (keys %$eas)
{
my $value = $eas->{$key};
my $ea = qq("$key"="$value");
push(
@eaList, $ea);
}
# set the extended attribute
if(-e $fileVpath)
{
setEA($fileVpath,
@eaList);
}
else
{
next;
}
}
#Setting EA Subroutine#
sub setEA
{
my ($outPage,
@EA) =
@_;
# Section one: The String creation
# Create the temp XML String
my $xmlString = "";
foreach (
@EA){
my $key = $_;
$key =~ s/"(.*)"="(.*)"/$1/;
$key = TeamSite::CGI_lite->escape_html_data($key);/*Error here*/
my $value = $_;
$value =~ s/"(.*)"="(.*)"/$2/;
$value = TeamSite::CGI_lite->escape_html_data($value);/*Error here*/
$xmlString.= "$key$value";
}
$xmlString.= "";
my $sTempXMLFile = "$iwhome/tmp/templating_getEA_$$.xml";
if (open(OUT, ">$sTempXMLFile"))
{
print OUT $xmlString;
close(OUT);
my $iwextattrcmd = "$iwhome/bin/iwextattr -s -x \"$outPage\" $sTempXMLFile";
my $returnedValue = `$iwextattrcmd`;
# Delete the temp XML file
unlink($sTempXMLFile);
}
else
{
# Not able to save the file, this should be logged and reported
debug("Error:dd");
print "error";
}
return;
}
I am also attaching the code snippet of my tpl.
1. I am getting an error while escaping the foreign key characters.using TeamSite::CGI_lite->escape_html_data($value);So, I tried removing that line to test whether the extended attributes are set to the page..
2. The code is working fine.I am getting the output pages.But When I try to list out the extended attributes using iwextattr -l Y:\default\main\dev\WORKAREA\are\products\India.html..
This just gives null output and doesnot list the attributes that are set to that page?
Can some one please suggest where am i going wrong here?