[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] where to put subroutines



[The script in question is running on "Server" which runs MacHTTP 2.2.2 and
serves the terminal over TCP/IP via ethernet.   I am trying to learn Perl
in a probably overly-ambitious effort to implement an office intranet-based
phone call logging and info retrieval system - patient instruction scripts,
over the counter drug dosages, etc -  for my nurses.  And OBTW, another
test cgi runs fine in this mode over the network.]

The specific question is where best to put the many subroutines I am going
to want to use for now.  (I know ultimately I will put them into a library
or module, but I am trying to get the specific hardware/software setup to
run these scripts so that debugging each addition is easier.)

When I call the script below from the browser (IE4.5) on the terminal, I get

	# Undefined subroutine &main::mime called.
	File 'Server:MacHTTP 2.2.2:MacHTTP Software &
	 	Docs:Nurses:cgi-bin:phone.acgi'; Line 6



Here is the problem script, properly saved from MacPerl as a cgi script
named "phone.acgi"

	#!perl -w

	require "";
# no problems known here; resides at
# MacPerl Ÿ:lib:subparseform.lib

	&Parse_Form; 		#copied from E. Castro's book

	&mime;			#here is the little lost subroutine

	&header;

	#hoping I could get some response to prove it was functional
	print "$ENV{'REQUEST_METHOD'}\n";

	&footer;


And the admittedly trivial practice subroutines (stored of course as
separate files "mime" "header" "footer")

	sub mime {
		print "Content-type: text/html\n\n";
		}

	sub header {
		print "<html><head><title>Test Page</title>
		<STYLE> BODY { font-family: Arial; font-size: 9pt }
		</STYLE></head>\n";
		print "<body>\n";
		}

	sub footer {
		print "</body></html>";
		}


Directory structure is

	/Nurses/PedsNET/
	/Nurses/cgi-bin/


Putting the subs in /Nurses/cgi-bin/ doesn't work, nor does placing them in
a separate sub-directory /Nurses/cgi-bin/lib/



The html side looks pretty innocuous so far:

<HTML>
	<HEAD>
	<TITLE>Phone Log</TITLE>
	</HEAD>
<BODY>
	<P>Phone Log
	<FORM METHOD="POST"
ACTION="http://10.0.0.1:80/Nurses/cgi-bin/phone.acgi">
	<P>Parent First Name:<BR>
	<INPUT TYPE="TEXT" SIZE=40 NAME="PAR_FIRST_NAME">
	<P>Parent Last Name:<BR>
	<INPUT TYPE="TEXT" SIZE=40 NAME="PAR_LAST_NAME">
	<INPUT TYPE=SUBMIT VALUE="SUBMIT">
	<INPUT TYPE=RESET VALUE="CLEAR">
	</FORM>
</BODY>
</HTML>



If it is helpful, at the suggestion of Rich Morin, I saved

foreach $inc (@INC) {
  print "$inc\n";
}

as runtime and ran it.  I got this output:

	Server:MacHTTP 2.2.2:MacHTTP Software & Docs:Nurses:cgi-bin:lib:
	Server:MacHTTP 2.2.2:MacHTTP Software & Docs:Nurses:cgi-bin:lib:
	:
	Dev:Pseudo


So that is where I am.  Getting a bald spot scratching my head.   Any thoughts?

Jeff Hull

----------------------------------------------------
          Jeffrey W. Hull, M.D., F.A.A.P.
           1215 7th Street SE, Suite 210
             Decatur, AL   35601-3309
             mailto:jwhull@drhull.com
              http://www.drhull.com
----------------------------------------------------



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org