TAP::Object(3perl)

πŸ’– TAP::Object β€” it's giving "base class energy" ✨

ok so this is TAP::Object, a page from the Perl Programmers Reference Guide (TAP::Object(3perl)), and bestie… it's literally the blueprint every TAP::* module is built on. the whole squad. πŸ‘‘


🌸 NAME 🌸

TAP::Object β€” the base class that hands out the common functionality to all the TAP::* modules. every single one. no cap. πŸ’…


πŸŽ€ VERSION πŸŽ€

Version 3.52 β€” that's the one we're repping rn, periodt.


✨ SYNOPSIS ✨

ok here's the whole vibe, look:

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 how chill that is? you inherit, you override _initialize, and new just… works. iconic behavior honestly. πŸ¦‹


πŸ’œ DESCRIPTION πŸ’œ

TAP::Object gives every TAP::* class a default constructor and a whole exception model, for free, no effort, slay. exceptions get raised using Carp. that's the whole deal. 🫢


πŸ”₯ METHODS πŸ”₯

πŸ‘‘ Class Methods

  • new β€” makes you a brand new object ✨ any args you pass to new get forwarded straight to the _initialize method. returns a shiny new object. that's it, that's the method.

🧚 Instance Methods

  • _initialize β€” sets up a new object. heads up though: this one's just a stub by default, so you're supposed to override it and do your own thing. do not leave it blank and act surprised, bestie. 😭
Note: new expects you to return $self or raise an exception. that's the contract. look at _croak, and also at Carp. πŸ“Œ
  • _croak β€” raises an exception using croak from Carp, like so:
$self->_croak( 'why me?', 'aaarrgh!' );

and plot twist β€” you can call it as a class method too:

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

and yes, class method version exists too:

$class->_confess( 'this works too' );
  • _construct β€” creates a brand new instance of whatever class you point it at. new object, who dis. 🌈
  • mk_methods β€” makes you simple getters/setters. one line, so many methods, megabrain:
__PACKAGE__->mk_methods(@method_names);

and that's the page!! thanks for coming to my ted talk πŸ’… this was TAP::Object, part of the Perl Programmers Reference Guide, and this specific tea was spilled by perl v5.44.0 on 2026-10-17. go forth and inherit responsibly, bestie πŸŽ€βœ¨πŸ¦‹πŸ’–

πŸ“¦ 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