Term::Multiplexed - Detect terminal multiplexers (screen, tmux)
use Term::Multiplexed qw(multiplexed attached multiplexer); if(multiplexed) { say "Using " . multiplexer . " as terminal multiplexer"; say "Currently " . (attached ? : "not ") . "attached."; }
When running scripts inside screen/tmux, it's often useful to detect this and to detect whether the multiplexer of choice is currently attached or not. This module does exactly that and nothing more.
Returns whether we are running inside a terminal multiplexer or not. Currently only screen and tmux are detected.
Returns true when the multiplexer is attached. Returns undef when called outside a multiplexed environment.
Returns false when the multiplexer is attached. Returns undef when called outside a multiplexed environment.
The name of the current multiplexer. Currently only "screen" and "tmux" are possible return values.
The full filesystem path to the socket used by the multiplexer.
Manpages: screen(1) tmux(1)
Dennis Kaarsemaker <dennis@kaarsemaker.net>
This software is placed in the public domain, no rights reserved
To install Term::Multiplexed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::Multiplexed
CPAN shell
perl -MCPAN -e shell install Term::Multiplexed
For more information on module installation, please visit the detailed CPAN module installation guide.