# tmux client library for Perl

Source: https://libtmux.org/en/perl/latest/core/

> tmux client library for Perl. Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, capture pane contents

The core uses stable Perl 5.44 features and standard-library runtime modules.
The optional [LibTmux-Async distribution](https://libtmux.org/en/perl/latest/reference/libtmux-async-server/)
returns Future values and requires a caller-owned
[IO::Async::Loop::Ppoll](https://metacpan.org/pod/IO::Async::Loop::Ppoll)
loop. Its [transport reference](https://libtmux.org/en/perl/latest/reference/libtmux-async-transport/) explains
admission, cancellation, and cleanup. Linux x86_64 LP64 is qualified; other
platforms and ABIs remain unsupported.

The distributions are available from source and have no CPAN release.Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, capture pane contents.

## At a glance

| Type | Wraps |
| ---- | ----- |
| [`LibTmux::Server`](https://libtmux.org/en/perl/latest/reference/libtmux-server/) | A tmux server |
| [`LibTmux::Session`](https://libtmux.org/en/perl/latest/reference/libtmux-session/) | A session, ID `$n` |
| [`LibTmux::Window`](https://libtmux.org/en/perl/latest/reference/libtmux-window/) | A physical window linked into sessions, ID `@n` |
| [`LibTmux::Pane`](https://libtmux.org/en/perl/latest/reference/libtmux-pane/) | A pane in a window, ID `%n` |
| [`LibTmux::WindowLink`](https://libtmux.org/en/perl/latest/reference/libtmux-windowlink/) | A session-window association, with its index and active state |

## Typed API

- Typed objects instead of parsed format strings: [`LibTmux::Pane`](https://libtmux.org/en/perl/latest/reference/libtmux-pane/)
- Addressing by tmux ID: [`LibTmux::Pane::id`](https://libtmux.org/en/perl/latest/reference/libtmux-pane-id/)
- Filtering and queries over tmux objects: [`LibTmux::Selection::where`](https://libtmux.org/en/perl/latest/reference/libtmux-selection-where/)
- Typed errors instead of exit codes and stderr: [`LibTmux::X::InvalidFilter`](https://libtmux.org/en/perl/latest/reference/libtmux-x-invalidfilter/)

## What you get over the tmux CLI

- Connect to or start a tmux server: [`LibTmux::Server::new`](https://libtmux.org/en/perl/latest/reference/libtmux-server-new/)
- Traversal from a server down to its panes: [`LibTmux::Server::snapshot`](https://libtmux.org/en/perl/latest/reference/libtmux-server-snapshot/)
- Send keys to a pane: [`LibTmux::Server::send_keys`](https://libtmux.org/en/perl/latest/reference/libtmux-server-send_keys/)
- Capture pane contents: [`LibTmux::Server::capture_pane`](https://libtmux.org/en/perl/latest/reference/libtmux-server-capture_pane/)
- Arguments passed as a list, with no shell quoting: [`LibTmux::Server::cmd`](https://libtmux.org/en/perl/latest/reference/libtmux-server-cmd/)
- A typed error when the running tmux lacks a feature: [`LibTmux::X::Unsupported`](https://libtmux.org/en/perl/latest/reference/libtmux-x-unsupported/)
- Async operations: [`LibTmux::Async`](https://libtmux.org/en/perl/latest/reference/libtmux-async/)

- [Installation and guides](https://libtmux.org/en/perl/latest/guides/): Install the native distributions and work with captured tmux state.
- [Filtering example](https://libtmux.org/en/perl/latest/guides/filtering/): Run a complete snapshot, criteria, callback, and native-array workflow.
- [API reference](https://libtmux.org/en/perl/latest/reference/): Native package signatures and interlinked POD for core and optional async.
