Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
use strict
Millie
Hello
I've used perl for some time - though I'm quite new to Teamsite. Ordinarily, when I write perl scripts, at the top of the file I always include the following:
use strict;
use warnings;
Now, yesterday I had a **** of a problem trying to debug a presentation template - just kept falling over. In the end I tracked it down to having included 'use strict;' . Presumably, what were warnings were promoted to errors during the generation process and hence the failure. The warnings didn't appear to be anything associated with any perl code in <iw_perl> tags that I'd included in the template e.g.
Variable "$_iw_tmp_" is not imported at (eval 47) line 105.
$_iw_tmp_ appears to be a variable that is used to build up the generated file .
So my question is, should I be able to 'use strict' in presentation templates without any issue?
Find more posts tagged with
Comments
RonaldV
Millie,
I like you. Using 'strict' is, imho, the
only
way to code perl.
However, the nutters (sorry to say) at Iwov-templating have coded their internal templating code such that if you use 'strict' in a tpl-template it will break. Even if you add a line in the header of you tpl like 'my $_temp_;'-something it will break on some other 'non-strict' issue.
If you want to do some debugging yourself try ising the iwpt_compile.ipl script (see tpl-manuals).
Maybe somebody from Iwov can explain why they have coded their perl-code in a non-strict way?
Cheers, Ronald
Millie
Ronald,
I suspected that this was the case. Ho hum!
Maybe I should encase my perl code with
<iw_perl>
use strict;
# my perl code
no strict;
</iw_perl>
Unfortunately, I don't have regular access to the server upon which teamsite is installed - so what I've taken to doing is writing a Logging module that allows me to log messages to a 'presentation-log' file. I then have a cgi script that allows me to tail the log file. Its a bit of a round-the-houses approach but it saves me from hassling the adminstrators to provide a remote desktop connection. This has provided additional benefits of allowing me to log actions from with FormAPI to a 'datacapture-log' file too.
Cheers
RonaldV
No strict? I did not know that options but I think I will start to use it from now onwards. :-)
For running iwpt_compile I have written a cgi that compiles & executes a tpl-file (with the first dcr it can find) in order to output an compilation errors.
Your trick of logging is valuable as well but it will not show you any compilation errors. And these can be very nasty in teamsite since the only message you will get through the TS-gui is this:
Preview And Generate Error
:
Could not process template: Y:\default\main\mybranch\WORKAREA\Ronald\templatedata\htdocs\page\presentation\aspx.tpl
:\default\main\mybranch\WORKAREA\Ronald\templatedata\htdocs\page\presentation\aspx.tpl
Very helpfull, huh?
The cgi basicly executes these 3 commands and pipes the output to the cgi-output:
[PHP]my
@cmds
= ("iwperl $iwhome\\bin\\iwpt_compile.ipl -pt $tpl -ocode $ocode -iw_include-location $area -iw_pt-dcr $dcr 2>&1 |",
"iwprv -s $ocode 2>&1 |",
"iwperl $ocode -iw_pt-dcr $dcr -iw_include-location $area 2>&1 |");
[/PHP]
Cheers, Ronald
gzevin
presentation template and scrict cannot work together. Jon ****, with all my great respect for him, did some dirty code there
Millie
I like the CGI that compiles a template - I've considered doing that in the past - but what's iwprv?
What I may do instead is override perl's 'die' and 'warn' functions with my own.
So when the perl script fails compilation, my version of 'die' is called. My version can then log compilation errors to the same 'presentation-log' as mentioned before. I've done this kind of stuff before for CGI-scripts - which is all this is I suppose!
gzevin - thanks for confirming
Cheers
RonaldV
Millie,
iwprv is a teamsite command-line-tool that will mark the file as private. E.g. it will not be submitted and not show up in 'List Modified'.
https://support.interwoven.com/library/manuals/teamsite/html/650/TS/ts.clt.win/03_devTools54.html#wp769088
Ronald