Included below are some examples of hand-coded PERL u0026amp; C++ code created.
*** PERL PAGER INSTANT MESSENGER ROUTINE + USER INTERFACE |
||||||||||||||||||||||
#!/usr/sbin/perl5 # cgi-snpppage require “ccse-lib.pl”; # Parse input into associative array ‘in’. if (!(u0026amp;ReadParse(*in))) { ($pin,$junk) = split (/ /, $in{“pagerid”}, 2); # Make sure that all the required parameters were supplied. if ($in{“msg”} eq “”) { if ($pin eq “”) { if ($in{“host”} eq “”) { # construct message string. $pagetext = $in{“msg”} . ” [” . $in{“name”} . “]”; require “snpplib.pl”; # subroutine to catch any SNPP failure. sub fail { # send message to paging server. u0026amp;snpp’open($in{“host”}) || u0026amp;fail; # return HTML form to caller. print u0026amp;PrintHeader; |
||||||||||||||||||||||
** PERL LOGIN SCRIPT – INTEGRATING JAVASCRIPT, HTML u0026amp; TEXT FILE FOR USER LOGIN ACCESS | ||||||||||||||||||||||
#!/usr/bin/perl
print “Content-type: text/htmlnn”; # Get input for the first time. # Get back button include. # Will die if password is no good. # Read test file # Write test header # Print hidden data u0026amp; test footer. ############### ######################## read(STDIN, $buffer, $ENV{‘CONTENT_LENGTH’}); ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; print “<body bgcolor=”ffffff”>”; ################## open (BACK,”../back.jav”) || print “Can’t open back button.”; ######################## open (LIST,”./passwd.txt”) || print “Can’t open password file.”; $_ =~ tr/A-Z/a-z/; $pass = $FORM{‘password’}; $correct_pass = 0; open (PASS,”>./passwd.txt”) || print “<p>Someone else is accessing the password file; please try re-submitting.<p><a href=”JavaScript:history.go(-1);”>(back)</a>”; for ($i = 0; $i <= $#passwd; $i++) { split(‘:’, $passwd[$i]); if (@_[7] =~ /n/) { chop (@_[7]); # if (@_[6] eq $pass u0026amp;u0026amp; @_[6] eq $pchek) { if (@_[6] eq $pass) { $correct_pass = 1; $authorization = 1; push (@pinfo, @_); } if (@_[7] == 0) { open (T,”>>./expired”); } flock(PASS, 8); $message = “<body bgcolor=”ffffff”><center><p><h2>You have entered an invalid password.</h2><p><h3>Please go <a href=”JavaScript:history.go(-1);”>back</a> and re-enter your password.”; print $message; if ($authorization != 1) { print “<p><h2>You are not authorized to take a test.<p><a href=”JavaScript:history.go(-1);”>(back)</a>”; ################## open (TEST,”../tests/@pinfo[0].txt”) || print “Can’t open test file.”; ##################### print “<HEAD><META HTTP-EQUIV=”Content-language” CONTENT=”en”><META HTTP-EQUIV=”Pragma” CONTENT=”no-cache”>n”; } ####### open (TIME,”../timerSript.jav”) || print “Can’t open timer file.”; ####### open (VALID,”../valScript.jav”) || print “Can’t open validate file.”; ####### open (TSTAMP,”../tStamp.jav”) || print “Can’t open time stamp file.”; ####### open (POST,”../post.jav”) || print “Can’t open post file.”; ##################### print “@testdata”; open (FORM,”../form.jav”) || print “Can’t open form file.”; } Text File: 496935:dante:vlt:111223333:9500:dante@ccse.net:dante:48 |
||||||||||||||||||||||
*** PHONEBOOK APP | ||||||||||||||||||||||
// A simple file maintenance program which // can add or update entries // #include <fstream.h> #include <ctype.h>struct PhoneList { char name[31]; char phone[21]; }; // Function prototypes void main() if (!phone) // If phone file has not been opened while (1) // Do forever switch (toupper(answer)) // Allow single test cout << “What is the name? “; phone.seekg(0,ios::end); // Move to end of file void Update(fstreamu0026amp; phone) cout << “Enter entry number :” ; // Find record cout << count << “: ” // Confirm entry phone.seekg(size*(count – 1),ios::beg); // Find it again void List(fstreamu0026amp; phone) cout << “NametNumber” << endl; |
||||||||||||||||||||||
*** C++ – INFORMATION LOOKUP APP | ||||||||||||||||||||||
// A simple in-memory property database program. Through a menu, // the user decides if he or she wants to see a property // database on the screen or search for a specific property. #include <iostream.h> #include <string.h> // For strcmp() void DisplayMenu(); // Eight properties maximum due to next constant void main() switch (ans) return; |