Net::U...olPoint(3pm)

πŸ“¦
version 1.4.6 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Net::UPnP::ControlPoint β€” the perl module bestie πŸ’–

okay so this is a page from the User Contributed Perl Documentation, and it's all about Net::UPnP::ControlPoint, a Perl extension for a UPnP control point. yes girl, we're finding devices on the network. slay.


🌸 NAME 🌸

Net::UPnP::ControlPoint β€” Perl extension for UPnP control point. that's the whole vibe. it's the little module that goes out into your LAN and finds your stuff. periodt. 🫢


✨ SYNOPSIS ✨

here's the whole thing, literally copy-paste-able, no cap:

use Net::UPnP::ControlPoint;

my $obj = Net::UPnP::ControlPoint->new();

@dev_list = $obj->search(st =>'upnp:rootdevice', mx => 3);

$devNum= 0;
foreach $dev (@dev_list) {
    $device_type = $dev->getdevicetype();
    if  ($device_type ne 'urn:schemas-upnp-org:device:MediaServer:1') {
        next;
    }
    print "[$devNum] : " . $dev->getfriendlyname() . "\n";
    unless ($dev->getservicebyname('urn:schemas-upnp-org:service:ContentDirectory:1')) {
        next;
    }
    $condir_service = $dev->getservicebyname('urn:schemas-upnp-org:service:ContentDirectory:1');
    unless (defined(condir_service)) {
        next;
    }
    %action_in_arg = (
            'ObjectID' => 0,
            'BrowseFlag' => 'BrowseDirectChildren',
            'Filter' => '*',
            'StartingIndex' => 0,
            'RequestedCount' => 0,
            'SortCriteria' => '',
        );
    $action_res = $condir_service->postcontrol('Browse', \%action_in_arg);
    $actrion_out_arg = $action_res->getargumentlist();
    unless ($actrion_out_arg->{'Result'}) {
        next;
    }
    $result = $actrion_out_arg->{'Result'};
    while ($result =~ m/<dc:title>(.*?)<\/dc:title>/sgi) {
        print "\t$1\n";
    }
    $devNum++;
}

look at her go 😭 she's browsing a MediaServer's ContentDirectory and printing every <dc:title> she finds. main character energy fr fr. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

The package can search UPnP devices in the local network and get the device list of Net::UPnP::Device.

that's it. that's the whole job. she looks around your network, she finds the devices, and she hands you back a list of Net::UPnP::Device objects. iconic. πŸ‘‘


πŸ’– METHODS πŸ’–

new β€” create new Net::UPnP::ControlPoint 🌱

$ctrlPoint = Net::UPnP::ControlPoint();

Creates a new object. Read perldoc perlboot if you don't understand that.

ngl bestie, if the blessed-reference thing is confusing you, that's literally what perlboot is for. go read it. it's giving tutorial. πŸ“š

search β€” search UPnP devices πŸ”

@device_list = $ctrlPoint->search();

@device_list = $ctrlPoint->search(
            [st => $search_target], # 'upnp:rootdevice'
            [mx => $maximum_wait] # 3
            );

Search UPnP devices and return the device list. Please see Net::UPnP::Device too.

so like, call it with no args and it does its thing, or hand it st and mx and it does its thing your way. the st is the search target (like 'upnp:rootdevice') and mx is the maximum wait (like 3). then you get back a list of devices. go look at Net::UPnP::Device for what those objects can do. πŸŽ€


🌈 SEE ALSO 🌈

  • Net::UPnP::Device β€” the whole point of the search, honestly. your devices live there. πŸ¦‹

πŸ‘‘ AUTHOR πŸ‘‘

Satoshi Konno skonno@cybergarage.org

CyberGarage http://www.cybergarage.org

ty for your service king 🫑


Copyright (C) 2005 by Satoshi Konno

It may be used, redistributed, and/or modified under the terms of BSD License.

so like, BSD License terms, bestie. use it, share it, remix it β€” just respect the license, okay? πŸ’œ

and that's the whole page!! this was Net::UPnP::ControlPoint(3pm) from the User Contributed Perl Documentation, rendered with perl v5.36.0, dated 2022-12-06. go find some devices, babe. mwah πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from