Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of IlyaM (2933)

Monday December 01, 2003
10:30 AM

Yet another go addict

[ #16096 ]

If you never played go do not click this link, you still can be saved from this drug :)

Just hacked this simple script to poll for my turns to move on To my taste the script is a bit ugly but it works.


use strict;
use warnings;

my $go = DragonGoServer->new;


while(1) {
    sleep 480;

package DragonGoServer;

use base qw(WWW::Mechanize);

sub redirect_ok { 1 }

sub login {
    my $self = shift;
    my ($login, $password) = @_;

    $self->submit_form(form_name => 'loginform',
                       fields    => { userid => $login,
                                      passwd => $password });

sub read_status {
    my $self = shift;


    if($self->content =~ /Your turn to move in the following games/) {
        print "Your turn to move in the following games:\n";

        my $re = qr!game\.php\?gid= (\d+)
                    userinfo\.php\?uid=\d+ .*? <font.*?> (.*?) </font>

        my $content = $self->content;

        while($content =~ /\G[\s\S]*?$re/g) {
            print "Game #$1, player '$2'\n";

        print "\n"

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.