Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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?
choroba only has used Moo from the htree
[1nickt]: Pardonm?
[choroba]: three
[choroba]: I mean I haven't used DBIx::Class nor M:S, only Moo
[1nickt]: Haha, I was learning about Linux filesystem trees trying to understand how Moo fits.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2017-11-24 13:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (349 votes). Check out past polls.

    Notices?