I have a raspberry pi running the latest Raspbian image with apache2 installed. I have a perl script in my /usr/lib/cgi-bin directory that I am using on a local, ad-hoc network without internet access.
Here is my perl file:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
$config=`cat /home/pi/Desktop/AutoPi/AutoPi.config`;
print <<"EOF";
<HTML>
<HEAD>
<TITLE>Hello, world!</TITLE>
</HEAD>
<BODY>
<H1>Hello, world!</H1>
<br><br>
</BODY>
</HTML>
EOF
This works great, and I can use perl system commands, like:
$my_dir=`pwd`;
...and pass them to the webpage that the user sees. This is great. However, I need to be able to have the user click a button and execute code as well.
I am comfortable using perl, and want to keep everything in the perl file if possible. If I can just program a simple button that, upon being pressed, can execute a simple command server side, I can do the rest.
POSTs to your script?