TAP::Object(3pm)

πŸ’… TAP::Object β€” the manual page, but make it make sense

ok so this is TAP::Object, from the Perl Programmers Reference Guide β€” it's the base class that hands all the "TAP::*" modules their shared functionality ✨ like, it's the mom friend of the TAP namespace, no cap.

🌸 VERSION

Version 3.50 πŸŽ€


✨ SYNOPSIS ✨

package TAP::Whatever;

use strict;

use base 'TAP::Object';

# new() implementation by TAP::Object
sub _initialize {
    my ( $self, @args) = @_;
    # initialize your object
    return $self;
}

# ... later ...
my $obj = TAP::Whatever->new(@args);

see that? you inherit, you write one _initialize, and the constructor is literally just handed to you. slay. πŸ’…


🌈 DESCRIPTION

"TAP::Object" gives you a default constructor and an exception model for every single "TAP::*" class in the family 🫢. Exceptions get raised using Carp. that's the whole vibe β€” consistent construction, consistent erroring, no reinventing the wheel every time, periodt.


πŸ’– METHODS πŸ’–

πŸ‘‘ Class Methods

  • "new" β€” creates a brand-new object, bestie πŸ’«. anything you hand to "new" gets passed straight along to the "_initialize" method. returns a new object. that's it, that's the method.

πŸ¦‹ Instance Methods

  • "_initialize" β€” initializes a new object 🧚. heads up: this method is a stub by default, so you're supposed to override it with whatever your little heart needs.
⚠️ Note: "new" expects you to return $self or raise an exception. no third option, iykyk. see "_croak" and Carp.
  • "_croak" β€” raises an exception using "croak" from Carp πŸ”₯, like:
$self->_croak( 'why me?', 'aaarrgh!' );

it can also be called as a class method, which honestly? iconic:

$class->_croak( 'this works too' );
  • "_confess" β€” raises an exception using "confess" from Carp 😭, like:
$self->_confess( 'why me?', 'aaarrgh!' );

and yes, class method energy works here too:

$class->_confess( 'this works too' );
  • "_construct" β€” creates a new instance of the specified class ⭐.
  • "mk_methods" β€” creates simple getter/setters 🌸:
__PACKAGE__->mk_methods(@method_names);

that's the whole page, bestie β€” every method accounted for, nothing missing, we ate and left no crumbs πŸ“

kisses and good vibes from perl v5.42.3, dated 2026-11-03 β€” this has been TAP::Object(3pm), mwah πŸ’œ

πŸ“¦ where this page comes from