TAP::Object(3p) Perl Programmers Reference Guide TAP::Object(3p)

TAP::Object(3p) Perl Programmers Reference Guide TAP::Object(3p) #

TAP::Object(3p) Perl Programmers Reference Guide TAP::Object(3p)

NNAAMMEE #

 TAP::Object - Base class that provides common functionality to all
 "TAP::*" modules

VVEERRSSIIOONN #

 Version 3.44

SSYYNNOOPPSSIISS #

     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);

DDEESSCCRRIIPPTTIIOONN #

 "TAP::Object" provides a default constructor and exception model for all
 "TAP::*" classes.  Exceptions are raised using Carp.

MMEETTHHOODDSS #

CCllaassss MMeetthhooddss _"_n_e_w_"

 Create a new object.  Any arguments passed to "new" will be passed on to
 the "_initialize" method.  Returns a new object.

IInnssttaannccee MMeetthhooddss _"___i_n_i_t_i_a_l_i_z_e_"

 Initializes a new object.  This method is a stub by default, you should
 override it as appropriate.

 _N_o_t_e_: "new" expects you to return $self or raise an exception.  See
 "_croak", and Carp.

 _"___c_r_o_a_k_"

 Raise an exception using "croak" from Carp, eg:

     $self->_croak( 'why me?', 'aaarrgh!' );

 May also be called as a _c_l_a_s_s method.

     $class->_croak( 'this works too' );

 _"___c_o_n_f_e_s_s_"

 Raise an exception using "confess" from Carp, eg:

     $self->_confess( 'why me?', 'aaarrgh!' );

 May also be called as a _c_l_a_s_s method.

     $class->_confess( 'this works too' );

 _"___c_o_n_s_t_r_u_c_t_"

 Create a new instance of the specified class.

 _"_m_k___m_e_t_h_o_d_s_"

 Create simple getter/setters.

  __PACKAGE__->mk_methods(@method_names);

perl v5.36.3 2023-02-15 TAP::Object(3p)