Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

nerfherder's scratchpad

by nerfherder (Monk)
on Jan 24, 2005 at 10:32 UTC ( #424550=scratchpad: print w/ replies, xml ) Need Help??

#!/usr/bin/perl use strict; #use warnings; #use diagnostics; use CGI; my $query = new CGI; print $query->header(); use IO::Socket::INET; print "<main>"; print "<title> UPS Status </title>"; my $sock = new IO::Socket::INET->new(PeerPort=>20100, Proto=>'udp', PeerAddr=>'207.210.215.108') or die "something we +nt wrong: $! "; my $request = "\xff\xff\xff\xff\x67\x65\x74\x69\x6e\x66\x6f\x20\x78\x7 +8\x78"; $sock->send($request); my $text; $sock->recv($text,235); my ($maxclients, $clients, $gametype, $mapname, $needpass); $text =~ s/\\/ /g; my @data = split(' ', $text); my $count = 0; foreach (@data) { chomp; if ($_ =~ m/sv_maxclients/) { print "<maxclients> $data[($count+1)] </maxclients>"; } if ($_ =~ m/clients/ && !($_ = m/sv_maxclients/)) { print "<players> $data[($count+1)] </players>"; } if ($_ =~ m/gametype/) { print "<gametype> $data[($count+1)] </gametype>"; } if ($_ =~ m/mapname/) { print "<mapname> $data[($count+1)] </mapname>"; } if ($_ =~ m/needpass/) { print "<needpass> $data[($count+1)] </needpass>"; } $count++; } print "</main>";
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-09-20 13:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (159 votes), past polls