# LibTmux::Workspace::load

**Workspace Manager concept example** A working example of the core library. It can change without notice.

- **Module:** LibTmux
- **Package:** LibTmux-Workspace
- **Language:** Perl
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-perl/blob/352715a4fa66a96eed7763b90daaa536aa2f121d/packages/workspace/lib/LibTmux/Workspace.pm#L179
- **Page:** https://libtmux.org/en/perl/latest/workspace/reference/libtmux-workspace-load/

```
sub load($self, %args)
```

`load(server => $server, existing => 'error'|'skip')` uses public [`LibTmux::Server`](/en/perl/latest/reference/libtmux-server/) operations. It checks all session-name conflicts before creation. `error` rejects any existing target with [`Conflict`](/en/perl/latest/workspace/reference/libtmux-workspace-x-conflict/); `skip` leaves that entire session alone, so repeated application creates only absent sessions. A missing server permits explicit creation; other acquisition failures propagate.

Return one report containing created IDs, skipped names, and completed steps. On failure, rollback only sessions returned by successful creation, then throw [`Load`](/en/perl/latest/workspace/reference/libtmux-workspace-x-load/) with original cause and partial-effect report. An uncertain creation without a returned ID cannot be rolled back safely. Existing resources are never rollback targets. Layouts apply after splitting; working directories and environments reach every initial process. Completion means command acceptance and captured state, not application readiness.

## Methods

## Examples

Complete installed-package program with an owned tmux fixture and result/cleanup assertions.

[Source example](https://github.com/libtmux/libtmux-perl/blob/352715a4fa66a96eed7763b90daaa536aa2f121d/examples/workspace.pl).

```perl
use v5.44;
use FindBin;
use lib "$FindBin::Bin/../scripts/lib";
use LibTmuxFixture;
use LibTmux::Workspace;
LibTmuxFixture->run(
    sub ($server, $root) {
        my $workspace = LibTmux::Workspace->new(
            config => {
                schema   => 'libtmux.workspace/v1',
                sessions => [
                    {
                        name    => 'workspace-example',
                        windows => [
                            {
                                name   => 'api',
                                cwd    => $root,
                                layout => 'even-horizontal',
                                panes  => [
                                    {command => ['/bin/sleep', '120']},
                                    {
                                        command    => ['/bin/sleep', '120'],
                                        horizontal => true
                                    },
                                ],
                            }
                        ],
                    }
                ],
            }
        );
        die 'plan mutated state' if $workspace->plan->{mutates};
        my $loaded = $workspace->load(server => $server);
        die 'load failed'   unless $loaded->{status} eq 'loaded';
        die 'panes missing' unless $server->snapshot->panes->count == 2;
        die 'repeat did not skip'
            unless $workspace->load(server => $server, existing => 'skip')
            ->{skipped}->@* == 1;
        say 'workspace load and repeat: ok';
    }
);
```

## Parameters

- `args`

## In other ports

Build a session from a workspace description

| Language | Equivalent |
| --- | --- |
| Python | [`tmuxp.workspace.builder.ClassicWorkspaceBuilder.build`](/en/py/latest/workspace/reference/tmuxp-workspace-builder-classicworkspacebuilder-build/) (method) |
| Ruby | [`LibTmux::Workspace::Plan#apply`](/en/ruby/latest/workspace/reference/libtmux-workspace-plan-apply/) (method) |
| PowerShell | [`LibTmux.Workspace\Invoke-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-invoke-tmuxworkspace/) (cmdlet). Applies the exact reviewed [`-Plan`](/en/powershell/latest/workspace/reference/libtmux-workspace-invoke-tmuxworkspace/#LibTmux.Workspace%5CInvoke-TmuxWorkspace.parameter.Plan) after PowerShell confirmation. [`-WhatIf`](/en/powershell/latest/workspace/reference/libtmux-workspace-invoke-tmuxworkspace/#LibTmux.Workspace%5CInvoke-TmuxWorkspace.parameter.WhatIf) previews without applying it; application is detached. |
| Julia | [`LibTmuxWorkspace.apply`](/en/julia/latest/workspace/reference/libtmuxworkspace-apply/) (function). Applies a prepared `WorkspacePlan` on an explicit `Server`, detached and under one deadline. Existing session names fail unless reuse is explicit. |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| Common Lisp | [`libtmux.workspace:apply-workspace`](/en/lisp/latest/workspace/reference/libtmux-workspace-apply-workspace/) (function) |
| TypeScript | [`builder.applyWorkspace`](/en/ts/latest/workspace/reference/builder-applyworkspace/) (function) |
| Rust | [`src.WorkspaceBuilder.build`](/en/rs/latest/workspace/reference/src-workspacebuilder-build/) (method) |
| Go | [`workspace.Build`](/en/go/latest/workspace/reference/workspace-build/) (function) |
| Java | [`io.github.libtmux.workspace.WorkspaceBuilder.build`](/en/java/latest/workspace/reference/io-github-libtmux-workspace-workspacebuilder-workspacebuilder-build/) (method) |
| C# | [`LibTmux.Workspace.WorkspaceBuilder.BuildAsync`](/en/csharp/latest/workspace/reference/libtmux-workspace-workspacebuilder-buildasync/) (method) |
| C++ | [`libtmux::workspace::build`](/en/cxx/latest/workspace/reference/libtmux-workspace-build/) (function) |
| Swift | [`WorkspaceBuilder.build(_:on:)`](/en/swift/latest/workspace/reference/workspacebuilder-build(_-on-)/) (method) |
| OCaml | [`Libtmux_unix.Workspace.await`](/en/ocaml/latest/workspace/reference/libtmux_unix-workspace-await/) (function). Apply a validated Plan through submit, then await its retained execution receipt. Inspect preserves partial and late outcomes. |

No equivalent is recorded in Lua, Erlang, Elixir, Clojure, Kotlin, Scala or F#.
