Query: term::visual
OS: debian
Section: 3pm
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
Visual(3pm) User Contributed Perl Documentation Visual(3pm)NAMETerm::Visual - split-terminal user interfaceSYNOPSIS#!/usr/bin/perl -w use strict; use Term::Visual; my $vt = Term::Visual->new( Alias => "interface", Errlevel => 0 ); $vt->set_palette( mycolor => "magenta on black", thiscolor => "green on black" ); my $window_id = $vt->create_window( Window_Name => "foo", Status => { 0 => { format => "template for status line 1", fields => [qw( foo bar )] }, 1 => { format => "template for status line 2", fields => [ qw( biz baz ) ] }, }, Buffer_Size => 1000, History_Size => 50, Input_Prompt => "[foo] ", # Set the input prompt for the input line. Use_Title => 0, # Don't use a titlebar Use_Status => 0, # Don't use a statusbar Title => "Title of foo" ); POE::Session->create (inline_states => { _start => &start_handler, got_term_input => &term_input_handler, } ); sub start_handler { my $kernel = $_[KERNEL]; # Tell the terminal to send me input as "got_term_input". $kernel->post( interface => send_me_input => "got_term_input" ); $vt->set_status_field( $window_id, bar => $value ); $vt->set_input_prompt($window_id, "$"); $vt->print( $window_id, "my Window ID is $window_id" ); } sub term_input_handler { my ($kernel, $heap, $input, $exception) = @_[KERNEL, HEAP, ARG0, ARG1]; # Got an exception. These are interrupt (^C) or quit (^). if (defined $exception) { warn "got exception: $exception"; exit; } $vt->print($window_id, $input); } # Only use delete_window if using multiple windows. $vt->delete_window( $window_id ); $vt->shutdown;DESCRIPTIONTerm::Visual is a "visual" terminal interface for curses applications. It provides the split-screen interface you may have seen in console based IRC and MUD clients. Term::Visual uses the POE networking and multitasking framework to support concurrent input from network sockets and the console, multiple timers, and more.PUBLIC METHODSTerm::Visual->method(); new Create and initialize a new instance of Term::Visual. my $vt = Term::Visual->new( Alias => "interface", Common_Input => 1, Tab_Complete => sub { ... }, Errlevel => 0 ); Alias is a session alias for POE. Common_Input is an optional flag used to globalize History_Position, History_Size, Command_History, Data, Data_Save, Cursor, Cursor_Save, Tab_Complete, Insert, Edit_Position in create_window(); Thus all windows created will have common input. Tab_Complete is a handler for tab completion. Tab_Complete => sub { my $left = shift; my @return; my %complete = ( foo => "foobar ", biz => "bizbaz ", ); return $complete{$left}; } Tab_Complete is covered more indepth in the examples directory. Errlevel not implemented yet. Errlevel sets Term::Visual's error level. create_window my $window_id = $vt->create_window( ... ); Set the window's name Window_Name => "foo" Set the Statusbar's format Status => { 0 => # first statusline { format => "