Hello, I have the following perl script that works in command line: #!/usr/bin/perl use Net::DNS; my $res = Net::DNS::Resolver->new; my $query = $res->search("www.openbsd.org");
if ($query) { foreach my $rr ($query->answer) { next unless $rr->type eq "A"; print $rr->address, "\n"; } } else { warn "query failed: ", $res->errorstring, "\n"; # ./dns.pl 142.244.12.42 But I want the result to be accessed by web users. I looked at this article http://www.undeadly.org/cgi?action=article&sid=20080805194342 I installed mod_perl # mod_perl-enable Added this line (sites don't talk about it, but I think it should be here) AddHandler cgi-script .pl and had my virtual host configured <VirtualHost *> ServerAdmin mikyde...@yahoo.fr DocumentRoot /htdocs ServerName 192.168.1.1 PerlModule Apache::PerlRun <Location /cgi/> SetHandler perl-script PerlHandler Apache::PerlRun PerlRequire /var/www/htdocs/cgi/startup.pl Options ExecCGI PerlSendHeader On allow from all </Location> ErrorDocument 404 /404.html ErrorLog logs/192.168.1.1-error_log CustomLog logs/192.168.1.1-access_log common </VirtualHost> I configured the startup.pl file to load the Net::DNS library # cat /var/www/htdocs/cgi/startup.pl use Net::DNS (); use Net::DNS::RR::A (); 1; And restarted Apache The last bit that I'm missing is where should I put my dns.pl file I tried in /var/www/htdocs/cgi/ but when I access http://192.168.1.1/cgi/dns.pl I have a blank page In theory when Apache is started it loads Net::DNS so that dns.pl can use it. I don't think I'm far from the solution but I'm stuck here. Does anyone have an idea how can I make it work ?