siddheshsawant has asked for the wisdom of the Perl Monks concerning the following question:
Hello folks !!!
I wrote a HTML page as follows
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-12 +52"> <title>PowerPath Test Automation Infrastructure</title> </head> <body> <h2>PPTAI Test Report Page</h2> <form action="/cgi-bin/post.cgi" method="POST"> <!--Your Name: <input type="text" name="name"><br>--> <!--Email Address: <input type="text" name="email"><br>--> <!--Result Type--> <!-- Result Type: <select name="result_type"> <option value="result_type">Test Staus chart</option> <option value="result_type">Test Result(Pass/Fail)</option> <option value="result_type">Nightly Result Summary</option> <option value="result_type">Triage Report</option> </select></br></br> --> <!--Type of --> Platform: <select name="pp_branch"> <option value="AIX">AIX Trunk</option> <option value="HPUX">HP-UX Trunk</option> <option value="LINUX">LINUX Trunk</option> <option value="PP_53X_LINUX">LINUX PP_53X_HOTFIX</option> <option value=" PP_53X_SOLARIS">Solaris PP_53X</option> <option value="SOLARIS">Solaris Trunk</option> <option value="WINDOWS">WINDOWS Trunk</option> </select></br> <!-- Controller --> <select name="controller"> <option value="lcla 238(dev)">lcla 238(dev)</option> </select> <!-- Start & End Date--> From(yyyy-mm-dd) :<input type="text" name="start_date" /> To(yyyy-mm-dd) :<input type="text" name="end_date" /> </n> <input type="submit" value="Send"> </form> </body> </html>
I wants to store the user input value in hash reference as shown below and I want to pass the input to the function of API.pm a module defiend somewhere else...And then I wants to print the consecutive info mentioned with print.The cgi code is as follows
#!/usr/bin/perl -w use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); #use strict; use lib "/view/sawans1_Ndb_0037_work/vobs/pp/pptai/api/NightlyDB"; use API; print header; print start_html("Thank You"); #print h2("Thank You"); #print "Hello folks !!!"; my $input; #STORING INPUT VALUES IN HASH NAMED $input. $input->{pp_branch} = param('pp_branch'); $input->{controller} = param('controller'); $input->{start_date} = param('start_date'); $input->{end_date} = param('end_date'); my $test_run_list_ref = API::get_test_run($input); #--------------------------------------------------------------------- +---------- # test Test Run calls #--------------------------------------------------------------------- +---------- #Calling a function defined in API.pm my $test_run_list_ref = API::get_test_run($input); my $counter = 0; foreach my $tr_obj (@$test_run_list_ref) { print"---------- Test Run Attributes ---------\n"; $counter++; print ":Counter:".$counter; print ":Database ID:".$tr_obj->id; print "\n"; print ":NIghtly Web ID: "; print $tr_obj->nightly_web_id(); print "\n"; print":Test Controller:"; print $tr_obj->test_controller(); print "\n"; print ":Start Date:"; print $tr_obj->start_date(); print "\n"; print ":End Date:"; print $tr_obj->start_date_only(); print "\n"; print ":Minutes Elapsed:"; print $tr_obj->elapsed_minutes(); print "\n"; print":A link to the log :" ; print $tr_obj->log_link(); print "\n\n"; print"-------End of Test Run Attributes------\n"; # In the class DIagram the powerpath_branch() is not available # in the TestRun class so it is inge=herited through TestRunSpecif +ication's module # i.e specification print"-------Test Run Specifications------"; print"\n"; print":Powerpath Branch Name:"; print $tr_obj->specification->powerpath_branch(); print "\n"; print":Powerpath Host Name:"; print $tr_obj->specification->host_name(); print"\n"; print":Powerpath Build Type:"; print $tr_obj->specification->powerpath_build_type(); print"\n"; print":Powerpath array type:"; $tr_obj->specification->array_type(); print"\n"; print":Package Name:"; print $tr_obj->specification->package(); print"\n"; print"------End of TestRun Specifications ------\n\n"; print"------Test Run Status ----------\n"; print ": "; print "# PASSED: "; print $tr_obj->number_of_passed(); print "\n"; print "# FAILED: "; print $tr_obj->number_of_failed(); print "\n"; print "# UNRESOLVED: "; print $tr_obj->number_of_unresolved(); print "\n"; print "# NOT EXPOSED: "; print $tr_obj->number_of_not_exposed(); print "\n"; print"------End of Test Run Status------\n\n"; print"------Test Suite Run List---------\n"; print":User Scenario Name:\n"; print "# Total Number of user scenarios: "; print $tr_obj->number_of_user_scenarios()."\n"; #To get XML type report #print $tr_obj->get_xml(); print "\n" } print end_html;
When I click on submitt buton of html page I redirect to the CGI script and I get a blank page as an output...How to get a desire output in this case? Where I am making mistake??
Thanks in advance !!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A question about CGI-Perl
by cdarke (Prior) on Mar 04, 2010 at 20:39 UTC | |
|
Re: A question about CGI-Perl
by hangon (Deacon) on Mar 05, 2010 at 06:17 UTC |