1TAP::Object(3)        User Contributed Perl Documentation       TAP::Object(3)
2
3
4

NAME

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

VERSION

10       Version 3.48
11

SYNOPSIS

13           package TAP::Whatever;
14
15           use strict;
16
17           use base 'TAP::Object';
18
19           # new() implementation by TAP::Object
20           sub _initialize {
21               my ( $self, @args) = @_;
22               # initialize your object
23               return $self;
24           }
25
26           # ... later ...
27           my $obj = TAP::Whatever->new(@args);
28

DESCRIPTION

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

METHODS

34   Class Methods
35       "new"
36
37       Create a new object.  Any arguments passed to "new" will be passed on
38       to the "_initialize" method.  Returns a new object.
39
40   Instance Methods
41       "_initialize"
42
43       Initializes a new object.  This method is a stub by default, you should
44       override it as appropriate.
45
46       Note: "new" expects you to return $self or raise an exception.  See
47       "_croak", and Carp.
48
49       "_croak"
50
51       Raise an exception using "croak" from Carp, eg:
52
53           $self->_croak( 'why me?', 'aaarrgh!' );
54
55       May also be called as a class method.
56
57           $class->_croak( 'this works too' );
58
59       "_confess"
60
61       Raise an exception using "confess" from Carp, eg:
62
63           $self->_confess( 'why me?', 'aaarrgh!' );
64
65       May also be called as a class method.
66
67           $class->_confess( 'this works too' );
68
69       "_construct"
70
71       Create a new instance of the specified class.
72
73       "mk_methods"
74
75       Create simple getter/setters.
76
77        __PACKAGE__->mk_methods(@method_names);
78
79
80
81perl v5.38.0                      2023-10-03                    TAP::Object(3)
Impressum