Hi,Is there any way I can ignore whitespace in DCT title using perl reg expressions?When I set EAS to html page, it's displaying blank text. ex:TeamSite/Metadata/Title: I find /x modifier to ignore whitespaces. but not sure how to use it.Can any one assist me on this.Thanks,kumar
You need to provide a bit more context and detail to your question. Are you setting the EAs via the GUI or from the command line?What value is being provided in the Title field of the metadata capture GUI, or - on the command line - show the complete command line used ?What is the context in which you are trying to ignore white-space?What is the reason you are trying to ignore white-space?What is the actual code you are currently using to try to ignore white-space?
[php]...[/php], [html]...[/html],
[code]...[/code]
I'm trying to set EAs via GUI. I wrote a code in TPL. here is the piece of code.
[html]<br> use Date::Manip;<br> use TeamSite::Config;<br> my $iwhome = TeamSite::Config::iwgethome();<br> sub trim {<br> my $s = $_[0];<br> chomp($s); # get rid of \n<br> $s =~ s/^\s+//; # remove leading spaces<br> $s =~ s/\s+$//; # remove trailing spaces<br> return $s;<br> }<br> #End For Sub trim<br><br> my $title = trim(iwpt_dcr_value( 'dcr.press_release.title' ));<br> my $output = iwpt_get_ofile_name();<br>before end of the "/iw_pt" I try to invoke EAs.<br> `$iwhome/bin/iwextattr -s TeamSite/Metadata/Title=$title $output`; <br> `$iwhome/bin/iwextattr -s TeamSite/Metadata/Descrip=description $output`;<br>[/html]After I click on "generate" button in DCR. the page successfully generates but the properties doesn't show "Title(TeamSite/Metadata/Title)" metadata but displaying "description(TeamSite/Metadata/Descrip)".This is because, Title field contains white spaces Ex: "one two". here i'm trying to ignore the spaces between first and second character while generating EAs.hope this code snippet will give you idea what i'm trying to do.
`$iwhome/bin/iwextattr -s "TeamSite/Metadata/Title=$title" $output`;
sub trim { (my $result = $_) =~ s/(^\s*|[\s\n]*$)//gsm; return $result;}
Please learn how to use Preview Post to fix the formatting of your posts by properly using the directives like: [php]...[/php], [html]...[/html], and [code]...[/code].These two sentences seem to contradict one another - you are not setting the EAs via the GUI, you are attempting to set the EAs via code embedded within a PT. Okay, moving on (reformatting the posted ode)You need to put the entire parameter within double-quotes:`$iwhome/bin/iwextattr -s "TeamSite/Metadata/Title=$title" $output`; Note also that your trim subroutine could be simplified:sub trim { (my $result = $_) =~ s/(^\s*|[\s\n]*$)//gsm; return $result;}Hope the above helps.
I tried the above instructions but no luck. here is the screen shot of EAs after i did the changes according to your previous comments. can you please suggest me why Title metadata is blank?Thanks,kumar
Do you understand the basic concept of debugging with your development?Have you tried outputting the title value before and after you set it as EA? Have you tried to grab the result / output of executing the iwextattr command? Perhaps there was an error in executing that command? Try and log that output.Try some/all of these and perhaps that'll point you in the right direction.HTH!