Menu

bug?

Help
paulwvanc
2005-07-31
2013-03-22
  • paulwvanc

    paulwvanc - 2005-07-31

    Hi

    I've just installed gmediaserver from:
    http://www.nongnu.org/gmediaserver/

    I am first doing a recovery test, and "perl upnp" exits with error:
    Can't use string ("") as a subroutine ref while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.7/UPnP/ControlPoint.pm line 830.

    Here is the code (trivial modification of the example):
    use UPnP::ControlPoint;

    my $cp = UPnP::ControlPoint->new;
    my $search = $cp->searchByType("urn:schemas-upnp-org:device:MediaServer:1", &callback);
    $cp->handle;

    sub callback {
      my ($search, $device, $action) = @_;

      if ($action eq 'deviceAdded') {
        print("Device: " . $device->friendlyName . " added. Device contains:\n");
        for my $service ($device->services) {
          print("\tService: " . $service->serviceType . "\n");
        }
      }
      elsif ($action eq 'deviceRemoved') {
        print("Device: " . $device->friendlyName . " removed\n");
      }
    }

    Thanks

     
    • Vidur Apparao

      Vidur Apparao - 2005-09-26

      Sorry for the incredibly late response. The callback passed to UPnP::ControlPoint::searchByType should be a code reference i.e.

      my $search = $cp->searchByType("urn:schemas-upnp-org:device:MediaServer:1", \&callback);

      You forgot the \ before &callback.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.