::::::::::::::
a.pl
::::::::::::::
#!/usr/bin/perl

#################################################################
#  FILE NAME:    a.pl
#  DESCRIPTION:  CGI script to output some HTML from web server.
#  AUTHOR/DATE:  B.A.Martin:  2013/04/01
#  REVISIONS:    0.1: (3410) Add image and second paragraph.
#################################################################

use strict;
use CGI qw/:standard :newtag/;
print header;				# html format is now permitted to output.


print "<HTML><BODY BGCOLOR=#FFCCCC>Hello, World!";
print "<IMG SRC=../../works.gif ALIGN=RIGHT>";
print "<P>This page was created on the web server.";












::::::::::::::
b.pl
::::::::::::::
#!/usr/bin/perl

#################################################################
#  FILE NAME:    b.pl
my $file="b.pl";
#  DESCRIPTION:  CGI script (without header function)
#  AUTHOR/DATE:  B.A.Martin:  2013/04/05
#  REVISIONS:    
my $ver="0.2";
###     0.2     bam:2013/410    Show version in title (using substitution).
#################################################################

use strict;
use CGI qw/:standard :newtag/;

print "Content-type:text/html\r\n\r\n";    # html format is now permitted to output.

print '<html>';
print '<head>';
print "<title>Hello Word - First CGI Program [$ver]</title>\n";
# Double-quote allows substitution.

print '</head>';
print '<body BGCOLOR=#FFCC99>';
print '<h2>Hello Word! This is my first CGI program</h2>';
print '</body>';
print '</html>';

print "<H1 ALIGN=CENTER> Hello, World! </H1>\n";
print "This page was created on the web server.\n";
::::::::::::::
c.pl
::::::::::::::
#!/usr/bin/perl

########################################################################
### FILE NAME:  c.pl
my $file="c.pl";
### AUTHOR:     B.A.Martin
### PURPOSE:    Display from files:  head.html and tail.html 
### Versions:
my $ver="0.1";
###	0.1	bam:2012/12/01
###	0.0	bam:  (was update.pl)
#########################################################################

use strict;
use CGI qw/:standard :newtag/;

print header;				# html format is now permitted to output.
html();



######## PATHS & FILENAMES ########
my $pwd=        `pwd`;
my $ppwd=       `cd ..; pwd`;                           # Parent directory.

#### Set prefix to path. ####
my $path = "";
my $prepath = "../../";

my $head = $prepath . $path . "head.html";
my $tail = $prepath . $path . "tail.html";


#### Useful strings. ####
my $Q =		'"'; 
my $NL =	"\n"; 
my $TAB=	"	";


### Main processing
# 

	print "<head><title> $file [$ver] </title></head>\n";
	print "<body bgcolor=#CCFFFF TEXT=#330033>\n";

        &show( $head );

	print "<HR><P> This is some text from the Perl script.<HR>\n";

        &show( $tail );

	print "<HR><U>These files were displayed:</U><UL>\n";
	print "<LI>head=$head";
	print "<LI>tail=$tail";
	print "</UL>\n";
	print "<HR>\n";

exit;


################################# show.pl
sub show( $f )			# Print contents of an HTML file.
{
	my $f = @_[0];
        open(F,"$f") or return 0;
        while(<F>){
			print; 
        }
        close(F);
}





























::::::::::::::
d.pl
::::::::::::::
#!/usr/bin/perl

########################################################################
### FILE NAME:  d.pl
my $file="d.pl";
### AUTHOR:     B.A.Martin
### PURPOSE:    Date & time - append timestamp to a file.
### Versions:
my $ver="0.1";
###	0.1	bam:2012/12/01
#########################################################################

use strict;
use CGI qw/:standard :newtag/;
my $args="$0 $1 $2 $3 $4 $5 $6 $7";

print header;				# html format is now permitted to output.
html();


######## PATHS & FILENAMES ########
my $pwd=        `pwd`;
my $ppwd=       `cd ..; pwd`;                           # Parent directory.
my $sub=        `cd ../..; basename \`pwd\` `;  chop $sub;

#### Set prefix to path. ####
my $path = "";
my $prepath = "../../";


#### Useful strings. ####
my $Q =		'"'; 
my $NL =	"\n"; 
my $TAB=	"	";
my $NBSP=	" ";
my $SP4=	"    "; 
my $stamp=	$^T; 				# Timestamp.



### Main processing
# 

	print "<head><title> $file [$ver] </title></head>\n";
	print "<body bgcolor=#CCFFFF TEXT=#330033>\n";

	print "<P> Timestamp:  $stamp";
	print "<P><U> Write the timestamp to a file:  kilroy.html  </I>(in your folder).</I></U>";



#### Now, write the timestamp to a file.
my $kilroy = $prepath . $path . "kilroy.html";
`touch $kilroy`;
`echo "Kilroy was here: " >> $kilroy`;
`echo "$stamp" >> $kilroy`;
`echo "<BR>\n" >> $kilroy`;

#### Display the file.
print "+++++\n";
print "<TABLE ALIGN=CENTER CELLPADDING=8 BORDER=4 BGCOLOR=#FFFFCC><TR><TD>\n";
&show( "../../kilroy.html" );
print "</TABLE>\n";

#### Link to TOP anchor.
print "<HR>";
print "<BR><A HREF=$Q#TOP$Q> TOP </A>\n";

exit;



########  The following subroutines are from the Tripodics Library. ########
#### Copyright 1996-2002 by Tripodics, All Rights Reserved.             ####
#### Tripodics Computing Service, POBox 456 Middle Island, NY 11953     ####
#+++   (Nonexclusive usage granted to PhDsigns, Bay Shore, NY.)     +++#
############################################################################

################################# show.pl
sub show( $f )			# Print contents of an HTML file.
{
	my $f = @_[0];
        open(F,"$f") or return 0;
        while(<F>){
			print; 
        }
        close(F);
}


sub timestamp
{
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = gmtime();
	$stamp=  sprintf( "20%02d%02d%02dT%02d%02d%02d$%6d", 
		$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
}

sub datetime( s )
{
	my $s = @_[0];
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = localtime($s);
	#print "< my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = $s;<BR>" ;
	#--	my $result=  sprintf( "20%02d-%02d-%02d %02d:%02d:%02d.$%6d", 
		#--	$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
$sec %= 60;
	my $result=  sprintf( "20%02d/%02d/%02d %02d:%02d:%02d", 
		$year % 100, $month+1, $day, $hour, $min, $sec );
	return $result;
}

sub saydie( $msg )
{
	my $msg = @_[0];
	print $msg;
	die;
}

##############################  End of bamlib.inc  #############################






























::::::::::::::
e.pl
::::::::::::::
#!/usr/bin/perl

########################################################################
### FILE NAME:  e.pl
my $file="e.pl";
### AUTHOR:     B.A.Martin
### PURPOSE:    Get inputs from a form.
### Versions:
my $ver="0.1";
###	0.1	bam:2012/12/01
#########################################################################

use strict;
use CGI qw/:standard :newtag/;
my $args="$0 $1 $2 $3 $4 $5 $6 $7";

print header;				# html format is now permitted to output.
html();


######## PATHS & FILENAMES ########
my $pwd=        `pwd`;
my $ppwd=       `cd ..; pwd`;                           # Parent directory.
my $sub=        `cd ../..; basename \`pwd\` `;  chop $sub;

#### Set prefix to path. ####
my $path = "";
my $prepath = "../";


#### Useful strings. ####
my $Q =		'"'; 
my $NL =	"\n"; 
my $TAB=	"	";
my $NBSP=	" ";
my $SP4=	"    "; 
my $stamp=	$^T; 				# Timestamp.



### Main processing
# 

	print "<head><title> $file [$ver] </title></head>\n";
	print "<body bgcolor=#FFFFCC TEXT=#003333>\n";


print "<U>INPUTS:</U><UL>";

### Get parameters from html form.
#
my %in_para;
foreach (param()){
       	$in_para{$_} = join " ", param($_);
	# Multiple-values (checkbox) joined with blanks.
	print "<LI> $_ = $in_para{$_} \n";
} 

print "</UL><HR>";

my $who=  $in_para{FN};
print "<H1 ALIGN=CENTER> Hello, $who </H1>";


#### Check the telephone number
my $t=  $in_para{TEL};
print "Your telephone number is:  $t \n";

if ($t =~ "631") { print "<P><I>(I think you live in Suffolk County!)</I>\n"; }
if ($t =~ "516") { print "<P><I>(I think you live in Nassau County!)</I>\n"; }
if ($t =~ "212"  ||  $t =~ "347") { print "<P><FONT COLOR=RED>(I think you live in New York City.)</FONT>\n"; }

if ($t =~ "415") { print "<P ALIGN=RIGHT>Do you know the way to San Jose???? \n"; }


#### Zip code.
my $z=  $in_para{ZIP};
if ($z >= 11000 && $z <= 11999 ) { print "<P><I>Long Island zip:  11xxx  </I>\n"; }


print "<P ALIGN=CENTER><A HREF=${Q}e.html$Q> Return to form. </A>\n";



#### Link to TOP anchor.
print "<HR>";
print "<BR><A HREF=$Q#TOP$Q> TOP </A>\n";

exit;



########  The following subroutines are from the Tripodics Library. ########
#### Copyright 1996-2002 by Tripodics, All Rights Reserved.             ####
#### Tripodics Computing Service, POBox 456 Middle Island, NY 11953     ####
#+++   (Nonexclusive usage granted to PhDsigns, Bay Shore, NY.)     +++#
############################################################################

################################# show.pl
sub show( $f )			# Print contents of an HTML file.
{
	my $f = @_[0];
        open(F,"$f") or return 0;
        while(<F>){
			print; 
        }
        close(F);
}


sub timestamp
{
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = gmtime();
	$stamp=  sprintf( "20%02d%02d%02dT%02d%02d%02d$%6d", 
		$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
}

sub datetime( s )
{
	my $s = @_[0];
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = localtime($s);
	#print "< my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = $s;<BR>" ;
	#--	my $result=  sprintf( "20%02d-%02d-%02d %02d:%02d:%02d.$%6d", 
		#--	$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
$sec %= 60;
	my $result=  sprintf( "20%02d/%02d/%02d %02d:%02d:%02d", 
		$year % 100, $month+1, $day, $hour, $min, $sec );
	return $result;
}

sub saydie( $msg )
{
	my $msg = @_[0];
	print $msg;
	die;
}

##############################  End of bamlib.inc  #############################
























































::::::::::::::
f.pl
::::::::::::::
#!/usr/bin/perl

########################################################################
### FILE NAME:  f.pl
my $file="f.pl";
### AUTHOR:     B.A.Martin
### PURPOSE:    Get inputs from a form.
### Versions:
my $ver="0.1";
###	0.1	bam:2012/12/01
#########################################################################

use strict;
use CGI qw/:standard :newtag/;
my $args="$0 $1 $2 $3 $4 $5 $6 $7";

print header;				# html format is now permitted to output.
html();


######## PATHS & FILENAMES ########
my $pwd=        `pwd`;
my $ppwd=       `cd ..; pwd`;                           # Parent directory.
my $sub=        `cd ../..; basename \`pwd\` `;  chop $sub;

#### Set prefix to path. ####
my $path = "";
my $prepath = "../";


#### Useful strings. ####
my $Q =		'"'; 
my $NL =	"\n"; 
my $TAB=	"	";
my $NBSP=	" ";
my $SP4=	"    "; 
my $stamp=	$^T; 				# Timestamp.



### Main processing
# 

	print "<head><title> $file [$ver] </title></head>\n";
	print "<body bgcolor=#FFCC99 TEXT=#330033>\n";


print "<U>INPUTS:</U><UL>";

### Get parameters from html form.
#
my %in_para;
foreach (param()){
       	$in_para{$_} = join " ", param($_);
	# Multiple-values (checkbox) joined with blanks.
	print "<LI> $_ = $in_para{$_} \n";
} 

print "</UL><HR>";

my $who=  $in_para{FN};
print "<H1 ALIGN=CENTER> Hello, $who </H1>";


#### Check the telephone number
my $t=  $in_para{TEL};
print "Your telephone number is:  $t \n";

if ($t =~ "631") { print "<P><I>(I think you live in Suffolk County!)</I>\n"; }
if ($t =~ "516") { print "<P><I>(I think you live in Nassau County!)</I>\n"; }
if ($t =~ "212"  ||  $t =~ "347") { print "<P><FONT COLOR=RED>(I think you live in New York City.)</FONT>\n"; }

if ($t =~ "415") { print "<P ALIGN=RIGHT>Do you know the way to San Jose???? \n"; }


#### Zip code.
my $z=  $in_para{ZIP};
if ($z >= 11000 && $z <= 11999 ) { print "<P><I>Long Island zip:  11xxx  </I>\n"; }


print "<P ALIGN=CENTER><A HREF=${Q}f.html$Q> Return to form. </A>\n";



#### Link to TOP anchor.
print "<HR>";
print "<BR><A HREF=$Q#TOP$Q> TOP </A>\n";

exit;



########  The following subroutines are from the Tripodics Library. ########
#### Copyright 1996-2002 by Tripodics, All Rights Reserved.             ####
#### Tripodics Computing Service, POBox 456 Middle Island, NY 11953     ####
#+++   (Nonexclusive usage granted to PhDsigns, Bay Shore, NY.)     +++#
############################################################################

################################# show.pl
sub show( $f )			# Print contents of an HTML file.
{
	my $f = @_[0];
        open(F,"$f") or return 0;
        while(<F>){
			print; 
        }
        close(F);
}


sub timestamp
{
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = gmtime();
	$stamp=  sprintf( "20%02d%02d%02dT%02d%02d%02d$%6d", 
		$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
}

sub datetime( s )
{
	my $s = @_[0];
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = localtime($s);
	#print "< my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = $s;<BR>" ;
	#--	my $result=  sprintf( "20%02d-%02d-%02d %02d:%02d:%02d.$%6d", 
		#--	$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
$sec %= 60;
	my $result=  sprintf( "20%02d/%02d/%02d %02d:%02d:%02d", 
		$year % 100, $month+1, $day, $hour, $min, $sec );
	return $result;
}

sub saydie( $msg )
{
	my $msg = @_[0];
	print $msg;
	die;
}

##############################  End of bamlib.inc  #############################
























































::::::::::::::
g.pl
::::::::::::::
#!/usr/bin/perl

########################################################################
### FILE NAME:  g.pl
my $file="e\g.pl";
### AUTHOR:     B.A.Martin
### PURPOSE:    Get inputs from a form.
### Versions:
my $ver="0.1";
###	0.1	bam:2012/12/01
#########################################################################

use strict;
use CGI qw/:standard :newtag/;
my $args="$0 $1 $2 $3 $4 $5 $6 $7";

print header;				# html format is now permitted to output.
html();


######## PATHS & FILENAMES ########
my $pwd=        `pwd`;
my $ppwd=       `cd ..; pwd`;                           # Parent directory.
my $sub=        `cd ../..; basename \`pwd\` `;  chop $sub;

#### Set prefix to path. ####
my $path = "";
my $prepath = "../";


#### Useful strings. ####
my $Q =		'"'; 
my $NL =	"\n"; 
my $TAB=	"	";
my $NBSP=	" ";
my $SP4=	"    "; 
my $stamp=	$^T; 				# Timestamp.



### Main processing
# 


### Get parameters from html form.
#
my %in_para;
foreach (param()){
       	$in_para{$_} = join " ", param($_);
	# Multiple-values (checkbox) joined with blanks.
	#--	print "<LI> $_ = $in_para{$_} \n";
} 




my $bg=  $in_para{BG};

	print "<head><title> $file [$ver] </title></head>\n";
	print "<body bgcolor=#$bg TEXT=#330033>\n";





my %area= { 631, "Suffolk", 516, "Nassau" }.

print "</UL><HR>";

my $who=  $in_para{FN};
my $whowho=  $in_para{LN};
print "<H1 ALIGN=CENTER> Hello, $who $whowho</H1>";


#### Check the telephone number
my $t=  $in_para{TEL};
print "Your telephone number is:  $t \n";

my $where = "UNKNOWN";

if ($t =~ /^631/ ) { $where=  "Suffolk"; }
if ($t =~ /^516/) { $where=  "Nassau"; }
$where=  "Queens" if $t =~ /^718/   ;

if ($t =~ /^212/  ||  $t =~ /^347/ ) { $where=  "New York" ;}

print "<P> You live in ${where} county . \n"; 



#### Zip code.
my $z=  $in_para{ZIP};
if ($z >= 11000 && $z <= 11999 ) { print "<P><I>Long Island zip:  11xxx  </I>\n"; }


print "<P ALIGN=CENTER><A HREF=${Q}g.html$Q> Return to form. </A>\n";



#### Link to TOP anchor.
print "<HR>";
print "<BR><A HREF=$Q#TOP$Q> TOP </A>\n";

exit;



########  The following subroutines are from the Tripodics Library. ########
#### Copyright 1996-2002 by Tripodics, All Rights Reserved.             ####
#### Tripodics Computing Service, POBox 456 Middle Island, NY 11953     ####
#+++   (Nonexclusive usage granted to PhDsigns, Bay Shore, NY.)     +++#
############################################################################

################################# show.pl
sub show( $f )			# Print contents of an HTML file.
{
	my $f = @_[0];
        open(F,"$f") or return 0;
        while(<F>){
			print; 
        }
        close(F);
}


sub timestamp
{
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = gmtime();
	$stamp=  sprintf( "20%02d%02d%02dT%02d%02d%02d$%6d", 
		$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
}

sub datetime( s )
{
	my $s = @_[0];
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = localtime($s);
	#print "< my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = $s;<BR>" ;
	#--	my $result=  sprintf( "20%02d-%02d-%02d %02d:%02d:%02d.$%6d", 
		#--	$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
$sec %= 60;
	my $result=  sprintf( "20%02d/%02d/%02d %02d:%02d:%02d", 
		$year % 100, $month+1, $day, $hour, $min, $sec );
	return $result;
}

sub saydie( $msg )
{
	my $msg = @_[0];
	print $msg;
	die;
}

##############################  End of bamlib.inc  #############################




























































::::::::::::::
template.pl
::::::::::::::
#!/usr/bin/perl

########################################################################
### COPYRIGHT:  2005 &copy; Tripodics Computing Services
### FILE NAME:  template.pl
### AUTHOR:     B.A.Martin
### PURPOSE:    Display some HTML
###               head.html and tail.html are also displayed.
### Versions:
my $ver="0.1";
###	0.1	bam:2012/12/01
###	0.0	bam:  (was update.pl)
#########################################################################

use strict;
use CGI qw/:standard :newtag/;
my $args="$0 $1 $2 $3 $4 $5 $6 $7";

print header;				# html format is now permitted to output.
html();


### Get parameters from html form.
#
my %in_para;
foreach (param()){
       	$in_para{$_} = join " ", param($_);
	# Multiple-values (checkbox) joined with blanks.
} 

######## PATHS & FILENAMES ########
my $pwd=        `pwd`;
my $ppwd=       `cd ..; pwd`;                           # Parent directory.
my $sub=        `cd ../..; basename \`pwd\` `;  chop $sub;
#my $course=    'wusb.fm/';
my $course=     `cd ../../../..; basename \`pwd\` `;  chop $course;

my $timestamp;
#--  my $timestamp=  ×tamp;
#--  $timestamp=  ×tamp();

#### Set prefix to path. ####
my $path = "";
my $prepath = "../../";


my $BUG = $in_para{BUG};				# Debugging print.
if ($BUG =~ /^\s*BUG\s*$/) { $BUG = '0'; }
print "(BUG=$BUG)" if $BUG>0;

my $head = $prepath . $path . "head.html";
my $tail = $prepath . $path . "tail.html";


#### Useful strings. ####
my $Q =		'"'; 
my $NL =	"\n"; 
my $TAB=	"	";
my $NBSP=	" ";
my $SP4=	"    "; 
my $stamp=	$^T; 				# Timestamp.


### Main processing
# 

	print "<head><title> a.pl [$ver] </title></head>\n";
	print "<body bgcolor=#CCFFFF TEXT=#330033>\n";
        &show( $head );

	print "<H1 ALIGN=CENTER>";
	print "Hello, world!";
	print "</H1>\n";

	print "<H4 ALIGN=CENTER>";
	print "<BR>head=$head";
	print "<BR>tail=$tail";
	print "</H4>\n";

        &show( "a.html" );

#print "$pwd<BR>";
#print "$args<BR>";

	#--	&showdir( $dirname ) or &saydie("NO SUCH DIR:  $dirname\n");
	print "</TABLE><HR>";

        &show( $tail );
	print "<HR>";
	#--	print "<P><A HREF=$Q/$Q> home page </A>\n";
	print "<BR><A HREF=$Q#TOP$Q> TOP </A>\n";

`echo "Kilroy was here!" > kilroy.html`;
`echo "$timestamp" >> kilroy.html`;
`echo "$timestamp" >> kilroy.html`;

exit;


########  The following subroutines are from the Tripodics Library. ########
#### Copyright 1996-2002 by Tripodics, All Rights Reserved.             ####
#### Tripodics Computing Service, POBox 456 Middle Island, NY 11953     ####
#+++   (Nonexclusive usage granted to PhDsigns, Bay Shore, NY.)     +++#
############################################################################

################################# show.pl
sub show( $f )			# Print contents of an HTML file.
{
	my $f = @_[0];
        open(F,"$f") or return 0;
        while(<F>){
			print; 
        }
        close(F);
}


sub timestamp
{
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = gmtime();
	$stamp=  sprintf( "20%02d%02d%02dT%02d%02d%02d$%6d", 
		$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
}

sub datetime( s )
{
	my $s = @_[0];
	my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = localtime($s);
	#print "< my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $dst) = $s;<BR>" ;
	#--	my $result=  sprintf( "20%02d-%02d-%02d %02d:%02d:%02d.$%6d", 
		#--	$year % 100, $month+1, $day, $hour, $min, $sec, $$ );
$sec %= 60;
	my $result=  sprintf( "20%02d/%02d/%02d %02d:%02d:%02d", 
		$year % 100, $month+1, $day, $hour, $min, $sec );
	return $result;
}

sub saydie( $msg )
{
	my $msg = @_[0];
	print $msg;
	die;
}

##############################  End of bamlib.inc  #############################










