Well. I'm getting the error
Attempt to free unreferenced scalar: SV 0x316cc3c, Perl interpreter: 0 +x240a4bc a t server.pl line 67.
in my server code. Never seen this before. What scares me is the Perl interpreter part. Any ideas?
#!/usr/bin/perl -w use strict; use IO::Socket; use File::Slurp; use threads; use threads::shared; use XML::LibXML; my $subscribe:shared = 0; my $socket=new IO::Socket::INET->new(PeerPort=>12345,Proto=>'udp',Peer +Addr=>'localhost'); print "This is a test Sending Server\n"; my $capxml = read_file("C:\\Users\\deadpickle\\Desktop\\UAS\\GRRUVI_1. +60\\test xml\\capabilities.xml"); my $recv = threads->new(\&recvxml); my $send = threads->new(\&sendxml); while(1){ } sub sendxml{ my $socket=new IO::Socket::INET->new(PeerPort=>12345,Proto=>'udp', +PeerAddr=>'localhost'); while (1) { #send capabilities every 10 seconds $socket->send($capxml); print "Sending Capabilities\n"; sleep 10; } } sub recvxml{ my $xml; my $kid; my $socket=new IO::Socket::INET->new(LocalPort=>56789,Proto=>'udp' +); while(1) { print "Waiting for message\n"; $socket->recv($xml,3000); print "Recieved Message: $xml\n"; # Parse Message my $parser = XML::LibXML->new; $parser->recover(1); my $doc = $parser->parse_string($xml); my $element = $doc->getDocumentElement; my $elname = $element -> getName(); if ($elname eq 'StreamSubscribe') { my @cap = $element -> childNodes(); foreach $kid(@cap) { $elname = $kid -> getName(); if ($elname eq 'System') { my @syscap = $element -> childNodes(); foreach $kid(@syscap) { $elname = $kid -> getName(); if ($elname eq 'Stream') { my $stream = $kid->textContent; $subscribe = 1 if ($stream eq 'Telemetry') +; $subscribe = 2 if ($stream eq 'Flight Plan +'); } } } } } print "Subscribed to Telemetry\n" if $subscribe == 1; print "Subscribed to Flight Plan\n" if $subscribe == 2; } }

In reply to Attempt to free unreferenced scalar by deadpickle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.