Please login or register.

Login with username, password and session length
 

News:

Latest updates at DangerousPrototypes.com.


Author Topic: Twatch perl lib - beta  (Read 487 times)

philalex

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Twatch perl lib - beta
« on: November 25, 2009, 02:06:28 PM »
Hi all,
you can download and test the beta version of the twatch perl lib  at https://launchpad.net/twatch. Ideas, tests, bug reports would be appreciated

Phil.

philalex

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Twatch perl lib - beta
« Reply #1 on: November 26, 2009, 02:01:47 PM »
Hi,

you can download lib and the demo from this url:
http://bazaar.launchpad.net/~alexandre-philippe/twatch/trunk/files


ian

  • Crew
  • Hero Member
  • *****
  • Posts: 2861
  • Karma: +61/-0
    • View Profile
Re: Twatch perl lib - beta
« Reply #2 on: November 27, 2009, 02:35:41 AM »
Thanks for the direct link, I had a hard time finding it. This is an awesome script, thanks for sharing it. I posted it up, and added it to the #twatch manual.

Great work!

lme

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Twatch perl lib - beta
« Reply #3 on: November 27, 2009, 10:42:31 AM »
Cool thing! Now we only need a scroll function for long text... :)

philalex

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Twatch perl lib - beta
« Reply #4 on: November 28, 2009, 03:26:49 PM »
Hi,

you can find at the same url a scroll library (beta version) and a demo.
http://bazaar.launchpad.net/~alexandre-philippe/twatch/trunk/files


@ian thank for the twatch, it's really a fun toy :)

Phil.

lme

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Twatch perl lib - beta
« Reply #5 on: November 29, 2009, 08:19:04 AM »
Nice! :)

Here's my solution (added to your TWatch.pm):

Code: [Select]
sub scrollLine
{
        my ($self, $text, $row, $col) = @_;
        my $msg = $text;
        my $i = 0;

        $row=1 if(!defined($row) || $row > $self->{_NBROW} || $row < 1);
        $col=1 if(!defined($col) || $col > $self->{_NBCOL} || $col < 1);

        my $sock = $self->{_SOCKET};
        while (($col + length($text)-$i) > $self->{_NBCOL}) {
                $msg = substr($text, $i++, ($self->{_NBCOL}-$col)+1);
                print $sock chr(0xFE),chr(0x47),chr($col),chr($row);
                print $sock $msg;
                usleep(300000);
        }
        usleep(SLEEP);
}

But it was only a first try...