Test2::Handle(3pm)

πŸ“¦
version 1.302222 Β· 3 versions
, in ubuntu stonking

✨ NAME ✨

Test2::Handle β€” the base class for Test2 handles, the ones you use inside V# bundles. πŸ’…


🌸 DESCRIPTION 🌸

okay so bestie, this is literally the thing you're vibing with when you call the T2() function in a test that uses Test2::V1. That's it. That's the whole deal. It's the handle. It's giving main character energy. 🫢


πŸŽ€ SYNOPSIS πŸŽ€

the way we highly recommend doing it, no cap:

use Test2::V1;

my $handle = T2();

$handle->ok(1, "Passing Test");

πŸ¦‹ WITHOUT SUGAR πŸ¦‹

if you wanna raw-dog it with no syntactic sugar (iconic of you honestly):

use Test2::Handle();

my $handle = Test2::Handle->new(base => 'Test2::V1::Base');

$handle->ok(1, "Passing test");

πŸ’– METHODS πŸ’–

lowkey most of these methods get delegated to the base class you handed over at construction. But there are a few that this package defines all on its own, like the little overachievers they are. πŸ‘‘

  • $base = $class_or_inst->DEFAULT_HANDLE_BASE β€” grab the default handle base. Heads up bestie: this one throws an exception on the base handle class itself, so you're supposed to override it in a subclass. Periodt.
  • $base = $inst->HANDLE_BASE β€” in this base class, this method always throws an exception, every single time, no exceptions (well, except the exception). In a subclass? It should return the default base class that subclass should be using. πŸ’«
  • $namespace = $inst->HANDLE_NAMESPACE β€” gets you the namespace where we stash the functions we wrap up as methods. πŸ—‚οΈ
  • @sub_names = $inst->HANDLE_SUBS β€” gimme the full list of every sub available in the handle namespace please and thank you. πŸ“‹
  • $inst->HANDLE_INCLUDE($package, @subs) β€” imports the specified subs from the specified package straight into our internal namespace. Come on in, the water's fine. 🏊
  • $inst = $class->import() β€” used to create a T2() sub in your namespace at import time. Very demure, very mindful. ✨
  • $inst->init() β€” internal business only: initializes and validates the handle object. Don't touch this one, it's doing its job. πŸ™ˆ

πŸ‘‘ AUTOLOAD πŸ‘‘

internally used to wrap functions as methods. that's it. that's the whole vibe. πŸ”₯


πŸ”— SOURCE πŸ”—

the source code repository for Test2-Suite lives right here, bestie:

https://github.com/Test-More/test-more/


🫢 MAINTAINERS 🫢

Chad Granum <exodist@cpan.org>


🌈 AUTHORS 🌈

Chad Granum <exodist@cpan.org>


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/


ok that's the whole page, you ate that fr fr πŸ’…βœ¨

and that's a wrap on this lil gem of a page β€” brought to you by perl v5.40.1, dated 2026-06-21, and lovingly filed under User Contributed Perl Documentation as Test2::Handle(3pm). mwah. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from