Package: buffycli
Version: 0.1-1
Severity: wishlist

Following is the log of an irc conversation about a better way to do the
looping & waiting for user input:

12:08 <mugwump> the man page has a minimal loop for readline-style input:
http://search.cpan.org/~rcaputo/POE-1.003/lib/POE/Wheel/ReadLine.pm
12:08 <mugwump> and it has a bind_key method
12:09 <Mjollnir`> hm
12:09 <Mjollnir`> would you use a combination of that and term::screen ?
12:09 <Mjollnir`> or just that one
12:09 <mugwump> well, you could turn your loop into that
12:10 <mugwump> the POE::Kernel->run is the same as your while (1)
12:10 <Mjollnir`> ya
12:10 <Mjollnir`> it needs to timeout and refresh every n seconds with
noinput as well though
12:10 <mugwump> right, so there's a timer module
12:11 <mugwump> actually a method; POE::Kernel->alarm
12:11 <mugwump> you'd make a method that you want to be called
periodically, and add that to the "states" (think state machine)
12:12 <Mjollnir`> inline_states=> {
12:12 <Mjollnir`>       _start => \&setup_console,
12:12 <Mjollnir`>       got_user_input => \&handle_user_input,
12:12 <Mjollnir`>     }
12:12 <Mjollnir`> would also take a periodically do this anyway, function ?
12:12 <Mjollnir`> as well ?
12:12 <mugwump> yeah basically just throw a "refresh" or something in there
12:12 <Mjollnir`> where is the list of what 
12:12 <Mjollnir`> oh nevermind
12:12 <Mjollnir`> POE::Session will tell me
12:13 <mugwump> and to run the sub-process, you can use POE::Wheel::Run
12:14 <mugwump> I'd bet the program wouldn't be that much longer even with
all that, and you've just added one dep, on libpoe-perl
12:14 <Mjollnir`> dep doesn't matter
12:14 <Mjollnir`> it's packaged
12:16 <Mjollnir`> setup_console sets up the events and then poe::session
maps them to their handlers
12:16 <Mjollnir`> and I can see
12:16 <Mjollnir`>       InputEvent => 'got_user_input'
12:17 <Mjollnir`> but surely a regular refresh isn't an input event
12:17 <Mjollnir`> really teh regular refresh event is just a timeout
12:18 <Mjollnir`> if it waits so long for user input and it doesn't come,
do the refresh and start waiting again
12:18 <mugwump> right.  so, you make an alarm for it, save the ID of the
alarm in the heap ($_[HEAP]) and in the "refresh" event, clear the alarm if
one's set and make a new alarm
12:19 <mugwump> note $_[HEAP] is a hashref, so eg $_[HEAP]{refresh_alarm}
12:19 <mugwump> then bind ctrl+l to the refresh event 




-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-2-vserver-686 (SMP w/2 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages buffycli depends on:
ii  libbuffy-perl                0.5         Perl wrapper for the libbuffy libr
ii  libtext-formattable-perl     1.01-2      Format text tables
ii  libtie-ixhash-perl           1.21-2      ordered associative arrays for Per
ii  perl                         5.10.0-11.1 Larry Wall's Practical Extraction 

buffycli recommends no packages.

Versions of packages buffycli suggests:
ii  mutt                          1.5.18-2   text-based mailreader supporting M
ii  offlineimap                   6.0.0      IMAP/Maildir synchronization and r

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to