1TAP::Object(3) User Contributed Perl Documentation TAP::Object(3)
2
3
4
6 TAP::Object - Base class that provides common functionality to all
7 "TAP::*" modules
8
10 Version 3.28
11
13 package TAP::Whatever;
14
15 use strict;
16 use vars qw(@ISA);
17
18 use TAP::Object;
19
20 @ISA = qw(TAP::Object);
21
22 # new() implementation by TAP::Object
23 sub _initialize {
24 my ( $self, @args) = @_;
25 # initialize your object
26 return $self;
27 }
28
29 # ... later ...
30 my $obj = TAP::Whatever->new(@args);
31
33 "TAP::Object" provides a default constructor and exception model for
34 all "TAP::*" classes. Exceptions are raised using Carp.
35
37 Class Methods
38 "new"
39
40 Create a new object. Any arguments passed to "new" will be passed on
41 to the "_initialize" method. Returns a new object.
42
43 Instance Methods
44 "_initialize"
45
46 Initializes a new object. This method is a stub by default, you should
47 override it as appropriate.
48
49 Note: "new" expects you to return $self or raise an exception. See
50 "_croak", and Carp.
51
52 "_croak"
53
54 Raise an exception using "croak" from Carp, eg:
55
56 $self->_croak( 'why me?', 'aaarrgh!' );
57
58 May also be called as a class method.
59
60 $class->_croak( 'this works too' );
61
62 "_confess"
63
64 Raise an exception using "confess" from Carp, eg:
65
66 $self->_confess( 'why me?', 'aaarrgh!' );
67
68 May also be called as a class method.
69
70 $class->_confess( 'this works too' );
71
72 "_construct"
73
74 Create a new instance of the specified class.
75
76 "mk_methods"
77
78 Create simple getter/setters.
79
80 __PACKAGE__->mk_methods(@method_names);
81
82
83
84perl v5.16.3 2013-05-02 TAP::Object(3)