From d8dbe191247c9ccf30f1c07538a6da526736f9f5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 26 Jun 2009 20:46:27 -0500 Subject: change in_menu to 'location' which also tracks sessions --- lib/Net/Termcast.pm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/Net/Termcast.pm b/lib/Net/Termcast.pm index eb115bb..f5eb8d8 100644 --- a/lib/Net/Termcast.pm +++ b/lib/Net/Termcast.pm @@ -29,10 +29,10 @@ has cols => ( default => 80, ); -has in_menu => ( +has location => ( is => 'rw', - isa => 'Bool', - default => 0, + isa => 'Str', + default => 'menu', init_arg => undef, ); @@ -82,7 +82,6 @@ has _sock => ( sub BUILD { my $self = shift; - $self->in_menu(1); $self->_get_menu; } @@ -96,10 +95,10 @@ sub select_session { my $self = shift; my ($session) = @_; return unless exists $self->sessions->{$session}; - $self->_sock->send('q', 0) if $self->in_menu; + $self->_sock->send('q', 0) unless $self->location eq 'menu'; $self->_sock->send($session, 0); $self->_get_screen; - $self->in_menu(0); + $self->location($session); } # XXX: these two should use color at some point @@ -123,7 +122,7 @@ sub _get_screen { sub _get_menu { my $self = shift; - return unless $self->in_menu; + return unless $self->location eq 'menu'; $self->_get_screen; $self->_parse_menu; } -- cgit v1.2.3-54-g00ecf