Net::U...ervice(3pm)
π Net::UPnP::Service β the Perl extension for UPnP, bestie edition π
okay so you found Net::UPnP::Service(3pm) in the User Contributed Perl Documentation and you're like "what is this" β don't worry, I got you. This whole package is the object that represents a UPnP service. That's it, that's the vibe. β¨
πΈ NAME πΈ
Net::UPnP::Service β a Perl extension for UPnP. iconic, honestly.
π¦ SYNOPSIS π¦
here's the whole lil' journey, copied exactly so you can literally paste it and go:
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++;
}
(yes $actrion_out_arg is spelled like that in the source, and yes we are keeping it exactly, no cap π«Ά)
π DESCRIPTION π
The package is used a object of UPnP service. π
So basically: you've got a service on some UPnP device out there in the network wild, and this object is your little handle on it. Your main character entry point, fr fr.
π METHODS π
getdevice β get the device
$description = $service->getdevice();
Get the parent device of the service. Your service's mom, basically. π
getdevicedescription β get the service description of the device description
$description = $service->getdevicedescription(
name => $name # undef
);
Get the service description of the device description. β¨
The function returns the all description when the name parameter is not specified, otherwise return a value the specified name. So: no name β you get everything, name β you get just that one thing. lowkey perfect.
getservicetype β get the service type
$service_type = $service->getservicetype();
Get the service type. π¦
getserviceid β get the service id
$service_id = $service->getserviceid();
Get the service id. π
postaction β post a action control
$action_res = $service->postcontrol($action_name, \%action_arg);
Post a action control to the device, and return Net::UPnP::ActionResponse. π₯
β οΈ okay listen: the method was renamed from postcontrol(), but the old name is deprecated. so likeβ¦ use the new one, bestie, don't be out here calling the deprecated name. π
postquery β post a query control
$query_res = $service->postcontrol($var_name);
Post a query control to the device, and return Net::UPnP::QueryResponse. π
π« SEE ALSO π«
Net::UPnP::ActionResponse
go read that one next, iykyk. π
π AUTHOR π
Satoshi Konno <skonno@cybergarage.org>
CyberGarage <http://www.cybergarage.org>
π§ COPYRIGHT AND LICENSE π§
Copyright (C) 2005 by Satoshi Konno
It may be used, redistributed, and/or modified under the terms of BSD License. slay.
and that's the whole page, bestie!! π this one's from perl v5.36.0, dated 2022-12-06, and it lives under Net::U...ervice(3pm) in the User Contributed Perl Documentation β mwah, go forth and browse those ContentDirectory titles. π«Άβ¨πΈ
π¦ where this page comes from
- debian bookworm: libnet-upnp-perl 1.4.6-2 Β· BSD-3
- debian trixie: libnet-upnp-perl 1.4.6-2 Β· BSD-3
- ubuntu noble: libnet-upnp-perl 1.4.6-2 Β· BSD-3
- ubuntu resolute: libnet-upnp-perl 1.4.6-2 Β· BSD-3
- ubuntu stonking: libnet-upnp-perl 1.4.6-2 Β· BSD-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms