Home
TeamSite
newbie to cgi
jimE
I need to interface to a database to get page owner and the review cycle and date, then allow the user to tell me if this change affects to cycle or not. if yes then apply cycle to review date and post to database. This all needs to be done after the deploy to production. Any cgi code and tips would be appreciated.
Thanks.
Find more posts tagged with
Comments
Johnny
As these seems like a user interaction requirement, you probably wont be able to use a deploy and run script.
It would have to be kicked off manually... (as a cgi normally would.)
PERL DBI is your database connectivity api.
John
Sydney, Australia
gzevin
John,
this is not quite right. A CGI task could follow the external deploy task, so it does not have to be manual.
Greg Zevin
Interwoven Consultant/Architect
Johnny
Maybe my wording wasnt the greatest.
What I meant is that a CGI task is normally human interacted. While the workflow can progress to a CGI task after the deploy task, there is still a human interaction to start it.
John
Sydney, Australia
jimE
I've written the perl program and it works from a browser but I'm having a problem now converting it to a teamsite cgi. Any help appreciated. see attached program and workflow.
james1
> I've written the perl program and it works from a browser
What does this mean? Are you implying that the Perl program is a CGI program, and that a browser going to the CGI's URL works?
> but I'm having a problem now converting it to a teamsite cgi.
> Any help appreciated. see attached program and workflow.
Just a guess, but this line seems really fishy:
my($jobid, $taskid, $area) = (shift, shift, shift);
That seems like something you'd find in a command-line program, not in a CGI program...?!?
-- James
--
James H Koh
Interwoven Engineering
Migrateduser
Not only that, it's not correct syntax for perl.
This might work better:
my($jobid, $taskid, $area) = shift; shift; shift;
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
laj1
>> my($jobid, $taskid, $area) = shift; shift; shift;
I think you want the parens. The comma operators are going to return a scalar value, but you're assigning to a list.
Is it terribly important to SHIFT?
Can you rewrite to use the array indexes?
Like:
my($jobid, $taskid, $area) =
@_[0
..3];
if you really need to purge the array of the three values you can still:
shift; shift; shift; # and ignore the return values from the shift.
???
What do you think???
Len.
Len Jaffe
My Heart Is A Flower
Migrateduser
I simply would use:
my($jobid, $taskid, $area) =
@_
;
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
laj1
That works for me.
Len Jaffe
My Heart Is A Flower
jimE
The code was written to run on the web server from the browser window shipping javascript to the client, then after the client validates the data the server app will update the database as needed. I'm not sure exactly how to convert this to a cgi app but that's what I'm trying to do.
Johnny
Just a note.
Any parameters that the script uses from the external task are passed in before the implicit workflow parameters.
Meaning that jobid, taskid, area, files are the 4 last parameters.
John
Sydney, Australia
Adam Stoller
CGI scripts do not pass command line parameters. External task scripts do.
CGI scripts are passed form variables and cookies and such, and it is the scripts responsibility to parse them and then use them as needed.
There are quite a few books out there that deal with CGI programming, and a fair amount that deal with Perl CGI programming. I'd recommend spending an afternoon at Borders or Barnes & Nobles and leafing through a few until you find one you like and then buy it.
(I often run into trouble when trying to write CGI scripts that do neat things - especially if I haven't written a CGI script in a while...)
--fish
(Interwoven Senior Technical Consultant)
jimE
how does one pass javascript thru the cgi?
Adam Stoller
I'm not sure what you mean by "passing javascript *through* a cgi"
A CGI script generally performs whatever you tell it to - but most often it generates HTML that is sent to the browser window. The HTML that is generated can include javascript code that is to be used in the rendering and/or processing of the resultant page.
Did that answer your question?
--fish
(Interwoven Senior Technical Consultant)
jimE
could you send an example of the cgi generating html with javascript in it? I keep getting an internal server error.
By removing lines of code I have gotten part of the screen to display but only get part of screen when I uncomment the 3 commented lines, what's wrong with them?
use DBI;
$dataSource = "DBI
racle:bwebtst";
# $dbh = DBI-connect(DataSource,"bwebuser","webmaster") # or
# die "Unable to connect: $DBI::errstr\n" unless (defined $dbh);
Edited by jimE on 12/06/02 02:19 PM (server time).
Adam Stoller
You're talking about javascript and then you're showing code involving DBI - The issues with connecting to DB's within scripts called from workflows or templates has been discussed serveral times in the forums - it generally has to do with environment variables (search and hopefully ye shall find)
I don't have a handy example of CGI code dumping out HTML with javascript in it - but you should be able to simulate it fairly easily - I don't really have time right now - sorry.
--fish
(Interwoven Senior Technical Consultant)