Acme::UPnP - Cheap UPnP Port Mapping (IGD)
use Acme::UPnP;
my $mapper = Acme::UPnP->new( );
# Discovery
if ( $mapper->discover_device( ) ) {
say 'Found router: ' . $mapper->upnp_device->getfriendlyname( );
# Map a port
$mapper->map_port( 8080, 8080, 'TCP', 'My Silly App' );
}
# Clean up on exit
$mapper->unmap_port( 8080, 'TCP' );Acme::UPnP provides a high-level, easy-to-use interface for the UPnP Internet Gateway Device (IGD) protocol. It
automates the complex task of requesting port forwarding from residential routers, which is often required for
peer-to-peer applications and local servers to be accessible from the internet.
Scans the local network for UPnP-capable gateway devices. Returns true if a device was successfully identified.
Requests a new port mapping.
-
$protocol: 'TCP' or 'UDP'. -
$description: A label for the router's mapping table. - Triggers
map_successormap_failedevents.
Removes an existing port mapping.
Queries the router for its public WAN IP address.
Returns boolean indicating if the required Net::UPnP dependency is installed.
Sanko Robinson sanko@cpan.org
Copyright (C) 2026 by Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.