The following module was proposed for inclusion in the Module List: modid: Tern::Size::Heuristic DSLIP: bdpfp description: Guesses terminal size in difficult cases userid: YUMPY (Tim Maher) chapterid: 5 (Networking_Devices_IPC) communities: Consultix training classes
similar: Term::Size rationale: Term::Size works fine on UNIX/Linux systems to determine the terminal height and width when one of the standard file descriptors is actually connected to a terminal. But there are important cases, such as when filtering VI's buffer through a shell command (as in :1,$! sort), when those file descriptors are temporarily connected to files, causing Term::Size's technique to fail. Another problem is the UNIX specifity of the module's approach, which prevents it from working on other systems. This module applies a number of heuristics in an attempt to guess the correct terminal dimensions in those currently unsupported cases. For example, if no standard I/O channel is connected to a terminal, my module scans the process table to see if there's a parent process that's an interactive editor (like VI),and if so, it then examines the environment for variables (e.g., the POSIX shell's COLUMNS, which can track window size changes) that can give a good idea of the width. This allows commands like the following to properly format text for the correct screen width -- :1,$! fmt_comment (That's my own script, based on Text::Autoformat, that reformats Perl (or shell or AWK) comments for the appropriate screen width; I'll be releasing that along with this module.) enteredby: YUMPY (Tim Maher) enteredon: Sun Dec 22 19:19:27 2002 GMT The resulting entry would be: Tern::Size:: ::Heuristic bdpfp Guesses terminal size in difficult cases YUMPY Thanks for registering, The Pause Team PS: The following links are only valid for module list maintainers: Registration form with editing capabilities: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=71400000_cc4be784ce7de575&SUBMIT_pause99_add_mod_preview=1 Immediate (one click) registration: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=71400000_cc4be784ce7de575&SUBMIT_pause99_add_mod_insertit=1