#!/usr/bin/perl print "Content-type: text/html \n\n"; ################################################################## # # THIS PERL SCRIPT IMPLEMENTS A CGI INTERFACE.IT TAKES THE FORM # AS INPUT AND SENDS THE OUTPUT TO THE CLIENT #################################################################### # # # $| = 1; # To flush the buffers print "$ENV{'QUERY_STRING'}"; if ($ENV{"REQUEST_METHOD"} eq 'POST') { read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/,$pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $contents{$name} = $value; } ############################################################################ # This code opens a filename which was entered by the user when filling up # the Project details ################################################################################ ## Expanding the Abbreviations ################################################################################ if ($contents{'PJCAT'} eq 'GAP') { $contents{'PJCAT'}= 'GRANT-IN AID PROJECT' } elsif ( $contents{'PJCAT'} eq 'SSP') { $contents{'PJCAT'}= 'Sponsored Projects' } elsif ($contents{'PJCAT'} eq 'CLP') { $contents{'PJCAT'}= 'Collaborative Project' } elsif ($contents{'PJCAT'} eq 'ILP' ) { $contents{'PJCAT'} = 'Inter-Laboratory Project' } elsif ($contents{'PJCAT'} eq 'MLP' ) { $contents{'PJCAT'}= 'Major Laboratory Project' } elsif ($contents{'PJCAT'} eq 'OLP' ) { $contents{'PJCAT'} = 'Other Laboratory Project' } elsif ($contents{'PJCAT'} eq 'INFRA' ) { $contents{'PJCAT'} = 'Infrastructural Project' } elsif ($contents{'PJCAT'} eq 'WBP') { $contents{'PJCAT'} = 'World Bank Project' } elsif ($contents{'PJCAT'} eq 'BLP') { $contents{'PJCAT'} = 'Bilateral Project'; } if ($contents{'AREA'} eq 'EIA' ) { $contents{'AREA'} = 'Environmental Impact Assessment' } elsif ($contents{'AREA'} eq 'CZM' ) { $contents{'AREA'} = 'Coastal Zone Management' } elsif ($contents{'AREA'} eq 'RS' ) { $contents{'AREA'} = 'Resource Survey' } elsif ($contents{'AREA'} eq 'HRD') { $contents{'AREA'} = 'Harbour Resource Development' } elsif ($contents{'AREA'} eq 'OT' ) { $contents{'AREA'} = 'Ocean Technology' } ############################################################################### # This creates the project Code ############################################################################### $tot = join(" ",$contents{'PJCODE'},$contents{'CODE'}); ############################################################################ # # THE FOLLOWING CODE STORES THE VARIABLES IN A LOG FILE WHICH A DATABASE # WILL LATER USE. THE SEARCH ENGINE IS INCORPORATED IN THE PERL # SCRIPT ITSELF # ############################################################################ # print LOG "$contents{'PJCODE'}\t$contents{'PJTITLE'}\t$contents{'PJKEY'}\t"; # print LOG " $contents{'AREA'}\t$contents{'PJCAT'}\t$contents{'PJSTAT'}\t"; # print LOG " $contents{'SPONSOR'}\t$contents{'COLLABO1'}\t$contents{'COLLABO2'}\t"; # print LOG " $contents{'COLLABO3'}\t$contents{'D_of_comm'}\t$contents{'D_of_COMPL'}"; # print LOG "\t$contents{'cost'}\t$contents{'PROJECT_LEAD'}\t"; # print LOG "$contents{'PROJECT_MEM1'}\t"; # print LOG "$contents{'PROJECT_MEM2'}\t$contents{'PROJECT_MEM2'}\t"; # print LOG "$contents{'PROJECT_MEM3'}\t"; # close (LOG); } ############################################################################ # Create an HTML document on the fly. ################################################################################# open(FP,'>var/www/htdocs/projects/html/abc.html') || die " could not open $contents{'FILENAME'}"; while() { print <<"HTML" ; $contents{'PJTITLE'}

$contents{'PJTITLE'}


PROJECT CODE : $tot

PROJECT TITLE : $contents{'PJTITLE'}

PROJECT KEYWORDS : $contents{'PJKEY'}

AREA OF RESEARCH : $contents{'AREA'}

PROJECT CATEGORY : $contents{'PJCAT'}

PROJECT STATUS : $contents{'PJSTAT'}

SPONSORING AGENCY : $contents{'SPONSOR'}

COLLABORATING AGENCIES :

$contents{'COLLABO1'}

$contents{'COLLABO2'}

$contents{'COLLABO3'}

DATE OF COMMENCEMENT : $contents{'D_of_comm'}

DATE OF COMPLETION : $contents{'D_of_COMPL'}

ESTIMATED TOTAL COST (Rs. in Lakhs): $contents{'COST'}

PROJECT LEADER : $contents{'PROJECT_LEAD'}

PROJECT TEAM

MEMBERS :

$contents{'PROJECT_MEM1'}

$contents{'PROJECT_MEM2'}

$contents{'PROJECT_MEM3'}

$contents{'PROJECT_MEM4'}

$contents{'PROJECT_MEM5'}

$contents{'PROJECT_MEM6'}

$contents{'PROJECT_MEM7'}

$contents{'PROJECT_MEM8'}

OBJECTIVES/SCOPE OF THE PROJECT :

$contents{'OBJECTIVES'}

PRESENT STATUS :

$contents{'PRES_STAT'}

WORK PLAN :

$contents{'WORK_PLAN'}

EXPECTED S & T OUTPUT :

1. Technologies:

$contents{'TEXTC1'}

2. Intellectual Property Rights:

$contents{'TEXTC2'}

3. Socio-economic importance :

$contents{'TEXTC3'}

4. Scientific Importance :

$contents{'TEXTC4'}

5. Proprietory Product Development :

$contents{'TEXTC5'}

HTML }