Reputation: 19
I am trying to make a Perl script with arguments that can be executable via a web page. Can someone help me with getting started with the apache and the configurations for that? I've tried for multiple hours but nothing seems to work. I'm using Apache 2.4.29
Upvotes: 0
Views: 198
Reputation: 2221
An option to solve this still using perl is creating a small TCP service running in localhost in the server where you can send your parameters, and then you just configure a reverse proxy in apache to that port.
Example:
use strict;
use warnings;
use IO::Socket;
my $port = 9999;
my $server_socket = IO::Socket::INET->new(
LocalPort => $port,
Listen => SOMAXCONN,
Proto => 'tcp',
Reuse => 1)
or die "Cannot open socket: $!";
print "Server listening on port $port\n";
while ( my $client_socket = $server_socket->accept() ) {
my $client_host = $client_socket->sockhost();
run_your_stuff();
$client_socket->close();
}
sub run_your_stuff{
print "Executing something...\n";
system("ping google.es");
# system("perl your_oder_script.pl");
}
Upvotes: 1