[OZAPRS] PERL APRS Stream SPLIT
Andrew Rich
vk4tec at hotmail.com
Wed Oct 1 21:31:27 EST 2003
For those interested in learning more about APRS, here is my latest code
in
PERL.
Splits the APRS stream up into relevant bits, callsign, dest, digis,
payload, email, webpage.
#!/usr/bin/perl
use Net::Telnet;
my $host = "aprs.net.au";
my (@data, $line);
my $t = new Net::Telnet(Timeout=> '5', port => '10153');
$t->errmode('return');
$t->Net::Telnet::open($host);
sleep 5;
print $t "user VK4TEC pass <pass> vers XASTIR \n";
while (<$t>)
{
chop;
$email="";
$webpg="";
if (m/.*\s+([a-zA-Z0-9\+_.-]+)\@([a-zA-Z0-9.-]+)\s+/)
{
$email = $1."@".$2;
}
if (m/http:\/\/([a-zA-Z0-9.-]+)\s+/)
{
$webpg = $1;
}
($callsign, $rest) = split(/>/,$_,2);
($dest, $rest) = split(/,/,$rest,2);
($digis, $payload) = split(/:/,$rest,2);
$payload =~ s/'/\\'/g,$payload;
print
"-------------------------------------------------------------------------
-------------------------------\n";
print "data : $_";
print "calls: $callsign\n";
print "dest : $dest\n";
print "digis: $digis\n";
print "payld: $payload\n";
print "email: $email\n";
print "webpg: $webpg\n";
}
_________________________________________________________________
Chat via SMS. Simply send 'CHAT' to 1889918. More info at
http://ninemsn.com.au/mobilemania/MoChat.asp?blipid=6800
_______________________________________________
ozaprs mailing list
ozaprs at marconi.ics.mq.edu.au
http://marconi.ics.mq.edu.au/cgi-bin/mailman/listinfo/ozaprs
More information about the Ozaprs
mailing list