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

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

πŸ’– Net::UPnP::ActionResponse β€” the manual page bestie edition πŸ’–

okay so. you're holding the docs for Net::UPnP::ActionResponse (it's a 3pm Perl manual page, from the User Contributed Perl Documentation collection, if you were wondering why it's giving very "community-made and proud of it"). It's a Perl extension for UPnP. that's it, that's the whole premise. let's get into it 🫢


✨ NAME ✨

Net::UPnP::ActionResponse β€” Perl extension for UPnP. that's the name, that's the gig, no notes πŸ’…


🌸 SYNOPSIS 🌸

here's the whole vibe in code, bestie. copy it, run it, love it:

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);
    unless ($action_res->getstatuscode() == 200) {
            next;
    }
    $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++;
}
ngl this snippet is a whole journey: search the network, skip anything that isn't a MediaServer, grab the ContentDirectory service, post a Browse action, check the status code is 200, then slurp every <dc:title> out of the result with a regex. she ate. πŸ“

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, this package gets used as an object of the action response. that's the description. short, sweet, iconic. πŸ‘‘


πŸ’… METHODS πŸ’…

⭐ getstatuscode β€” get the status code

$status_code = $actionres->getstatuscode();

grab the status code of the SOAP response. that's the whole job and she does it flawlessly ✨

🌈 getargumentlist β€” get the argument list

\%argument_list = $actionres->getargumentlist();

grab the argument list of the SOAP response. returns a hashref, obviously. we love a hashref πŸŽ€


πŸ‘‘ AUTHOR πŸ‘‘

Satoshi Konno β€” skonno@cybergarage.org

CyberGarage β€” http://www.cybergarage.org


Copyright (C) 2005 by Satoshi Konno

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


and that's the page, bestie!! πŸŽ€ this little beauty is perl v5.36.0, dated 2022-12-06, and it lives at Net::U...esponse(3pm). lowkey iconic of it. go forth and Browse βœ¨πŸ¦‹πŸ’–

πŸ“¦ where this page comes from