---
name: "Test2::Handle"
section: "3perl"
platform: "linux"
package: "perl"
version: "5.44.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Test2::Handle"
---

# Test2::Handle(3perl)

Base class for Test2 handles used in V# bundles.

## NAME

Test2::Handle - Base class for Test2 handles used in V# bundles.

## DESCRIPTION

This is what you interact with when you use the `T2()` function in a test that uses Test2::V1.

## SYNOPSIS

### RECOMMENDED

```
    use Test2::V1;
    my $handle = T2();
    $handle->ok(1, "Passing Test");
```

### WITHOUT SUGAR

```
    use Test2::Handle();
    my $handle = Test2::Handle->new(base => 'Test2::V1::Base');
    $handle->ok(1, "Passing test");
```

## METHODS

Most methods are delegated to the base class provided at construction. There are however a few methods that are defined by this package itself.

- $base = $class\_or\_inst-\>DEFAULT\_HANDLE\_BASE

  Get the default handle base. This throws an exception on the base handle class, you should override it in a subclass.

- $base = $inst-\>HANDLE\_BASE

  In this base class this method always throws an exception. In a subclass it should return the default base class to use for that subclass.

- $namespace = $inst-\>HANDLE\_NAMESPACE

  Get the namespace used to store function we wrap as methods.

- @sub\_names = $inst-\>HANDLE\_SUBS

  Get a list of all subs available in the handle namespace.

- $inst-\>HANDLE\_INCLUDE($package, @subs)

  Import the specified subs from the specified package into our internal namespace.

- $inst = $class-\>**import()**

  Used to create a `T2()` sub in your namsepace at import.

- $inst-\>**init()**

  Internally used to intialize and validate the handle object.

- AUTOLOAD

  Internally used to wrap functions as methods.

## SOURCE

The source code repository for Test2-Suite can be found at *https://github.com/Test-More/test-more/*.

## MAINTAINERS

- Chad Granum \<exodist@cpan.org\>

  ## AUTHORS

- Chad Granum \<exodist@cpan.org\>

  ## COPYRIGHT

Copyright Chad Granum \<exodist@cpan.org\>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See *http://dev.perl.org/licenses/*
