App::HTTPThis can advertise your local web server on your network so other devices can find it without you having to tell them an IP address and port.
This document explains the what, the how, and the how do I check it’s working?
So when people say “Bonjour” (or “Rendezvous”, “mDNS”, “ZeroConf”, “Avahi”), they’re usually talking about the same family of technologies: advertise a service on the local network and let clients discover it automatically.
When you start http_this with a name, it can publish a
service of type:
$ http_this --name MyService .
_http._tcp on the local domainThat means other machines on the same network that speak mDNS/DNS‑SD can discover something like:
MyService_http._tcp172.24.198.3:7007(Exact details depend on your network and how many interfaces you have.)
http_this?Start the server and publish it via mDNS/DNS‑SD:
http_this --name MyService
--name is the service instance name that other
devices will see.--name, the server will still run, but it
will not advertise itself over mDNS.Publishing is implemented via Net::Rendezvous::Publish.
You will also need an appropriate backend module for your platform, typically:
Net::Rendezvous::Publish::Backend::Avahi (common on
Linux)In other words:
http_this does):
Net::Rendezvous::Publish + a
Net::Rendezvous::Publish::Backend::*.If you’re on Linux with Avahi installed, you can browse all advertised services:
avahi-browse -at
You should see entries like:
MyService)_http._tcp)local)To filter to HTTP services only:
avahi-browse -rt _http._tcp
On many platforms there are “Bonjour browser” apps that show advertised services. These are handy for a quick sanity check.
(Any mDNS/DNS‑SD browser should work — you’re just looking for
_http._tcp with the instance name you chose.)
To discover services from Perl, use Net::Bonjour.
Net::Bonjour can browse and resolve services to host/port information.
A minimal example (adapted from the Net::Bonjour documentation):
use strict;
use warnings;
use Net::Bonjour;
my $browser = Net::Bonjour->new('http');
$browser->discover;
for my $service ($browser->services) {
$service->resolve;
next unless $service->name; # defensive
printf "%s %s:%s\n",
$service->name,
($service->addresses)[0] // 'unknown',
$service->port // 'unknown';
}
If you started:
http_this --name MyService
…you should see output that includes something like:
MyService 172.24.198.3:7007
MyService means the advertisement is
happening.MyService entries, you’re likely
seeing multiple network interfaces.I don’t see anything in my browser
--name.Net::Rendezvous::Publish + backend).It shows up, but I can’t connect
What should I tell users to connect to?
http://<address>:<port>/.(If you find anything unclear or you have platform-specific notes to add, please open an issue or PR.)