TEST2::EVENT::GENERIC(3perl)

πŸ’– Test2::Event::Generic β€” the perl manpage, but make it cute ✨

okay so bestie, welcome to Test2::Event::Generic(3perl), straight out of the Perl Programmers Reference Guide 🌸 and literally it's the generic event of your dreams. let's get into it πŸ’…


✨ NAME ✨

Test2::Event::Generic β€” it's a generic event type, and it's giving blank canvas 🎨


🌈 DESCRIPTION 🌈

so this is a generic event that lets you customize every single field in the event API. not most of them. not some of them. all of them. πŸ‘‘

when is that useful? when you need a custom event that lowkey doesn't make sense as a published reusable event subclass. like, it's a one-off vibe, not a whole family legacy. and that's valid 🫢


πŸŽ€ SYNOPSIS πŸŽ€

use Test2::API qw/context/;

sub send_custom_fail {
    my $ctx = shift;

    $ctx->send_event('Generic', causes_fail => 1, summary => 'The sky is falling');

    $ctx->release;
}

send_custom_fail();

not the 'The sky is falling' summary 😭 iconic behavior honestly.


πŸ¦‹ METHODS πŸ¦‹

  • $e->facet_data($data)
  • $data = $e->facet_data

get it or set it, your call bestie πŸ’œ this is the facet data (peep Test2::Event for the lore). and if no facet_data is set? then Test2::Event->facet_data gets called to produce facets from the other data. no facet data, no problem, it'll cook πŸ“

  • $e->callback($hub)

calls the custom callback if one is set. if there isn't one? literally nothing happens. it does nothing. silent. respectful. πŸ™ˆ

  • $e->set_callback(sub { ... })

sets the custom callback. ⚠️ the custom callback must be a coderef. first arg you get is the event itself, second arg is the Test2::Hub that's using the callback. two lil presents 🎁

  • $bool = $e->causes_fail
  • $e->set_causes_fail($bool)

get/set the causes_fail attribute. default is 0. periodt πŸ’…

  • $bool = $e->diagnostics
  • $e->set_diagnostics($bool)

get/set the diagnostics attribute. defaults to 0. 🩺

  • $bool_or_undef = $e->global
  • @bool_or_empty = $e->global
  • $e->set_global($bool_or_undef)

get/set the "diagnostics" attribute β€” yes bestie, that's literally what it says, iykyk πŸ™ˆ β€” and it defaults to an empty list, which reads as undef in scalar context. context is everything, fr fr.

  • $bool = $e->increments_count
  • $e->set_increments_count($bool)

get/set the increments_count attribute. default? you guessed it: 0. πŸ”’

  • $bool = $e->no_display
  • $e->set_no_display($bool)

get/set the no_display attribute. defaults to 0. πŸ™ˆ

  • @plan = $e->sets_plan

grab the plan if this event sets one πŸ—’οΈ the plan is a list of up to 3 items: ($count, $directive, $reason). $count must be defined β€” no debate β€” but the others may be undef, or may not exist at all. they can simply not show up. ghosting is allowed here πŸ‘»

  • $e->set_sets_plan(\@plan)

set the plan. you must pass in an arrayref with up to 3 elements. up to three. not four. 🚫

  • $summary = $e->summary
  • $e->set_summary($summary_or_undef)

get/set the summary. it defaults to the event package 'Test2::Event::Generic'. you can set it to literally any value πŸ’« and if you set it to undef, it resets right back to the default. undo button, but make it slay.

  • $int_or_undef = $e->terminate
  • @int_or_empty = $e->terminate
  • $e->set_terminate($int_or_undef)

this gets/sets the terminate attribute. defaults to undef in scalar context, or an empty list in list context. setting it to undef clears it completely. 🧼 and ⚠️ heads up: this must be set to a positive integer (0 or larger). zero counts. negative does not. no cap.


🌟 SOURCE 🌟

the source code repository for Test2 lives at <https://github.com/Test-More/test-more/> β€” go peek, it's right there 🫢


πŸ‘‘ 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 <https://dev.perl.org/licenses/>


and that's the whole page bestie!! πŸŽ€ this was perl v5.44.0, dated 2026-10-17, and the manual name is Test2:...Generic(3perl) if you need to cite your sources πŸ’… mwah, go write a generic event, you're gonna eat πŸ”₯ ✨

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms