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)
How to access CGI_lite form data in perl package
ninickname
Hello,
TeamSite 6.5 on W2k...
I'm using a PERL package to collect various functions and constants that are being used at different places, like inside a presentation template or through a custom menu item call.
I have trouble accessing the CGI_lite {form} data inside that package. (Reason is, I would like to read out the area_path or branch_name or something else that indicates were the user is right now, while this package is executed.)
Including the CGI_lite and declaring the object is the same as in other perl scripts, but It seems as soon as I try $cgi->parse_data();, the whole perl package crashes.
I'm not that much of a perl expert, has anybody an idea what's the problem here?
Find more posts tagged with
Comments
Adam Stoller
I think you need to provide more context.
A perl module designed to run within a custom menu item CGI script may not be correctly designed for use within a command-line-oriented PT script.
A DCT [cgi]callout script has a significantly different environment than a DCT inline script, and they're both rather different that which exists for FormAPI code.
The code you write needs to be designed for whatever environment(s) it is going to be used within. Do not expect code written for one environment to necessarilly run correctly in another environment.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
ninickname
fish, thanks for the answer.
No worries about the different environments; Well this module contains very generic functionality; some functions for string parsing, output to logging files, etc. (of course no FormAPI-Scripting...).
Unfortunately, at this point I do not have the flexibility of seperating for different environments since this needs to be implemented in an existing structure (including templates, that I have no permission to change), so I need to try everything with what I have, which is this single perl module that needs somehow the ability to get the current branch/workarea name. (BTW the module's function are exceptionally called through TeamSite GUI functions' scripts (menu items, PTs).)
So what's wrong with the cgi-form variables?
My experiment is running from a custom menu item calling an external script, in which all the cgi-form variables are available (sort of like the example show env vars script). The script includes the mentioned perl module, but it seems *inside* that module the whole cgi-form environment is *not* available through the common code:
use TeamSite::CGI_lite;
$cgi = TeamSite::CGI_lite->new();
$cgi->parse_data(); <----- crashes here
Adam Stoller
The PTs are run via iwgen or iwpt_compile.ipl - both of which are command-line oriented programs and neither of which will pass along CGI form information to the PT.
In the PT however - you can get branch and workarea information by looking at the DCR that is being processed (look at the documentation for iw_perl on
http://your-ts-server/iw/help/tst/pt
)
I believe parse_data() is expecting to see certain information in the environment fields (like QUERY_STRING or something like that) - so you might be able to conditionalize the code in your module based on environment information as to whether to process things in a CGI or command-line manner.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com