1TAP::Object(3pm) Perl Programmers Reference Guide TAP::Object(3pm)
2
3
4
6 TAP::Object - Base class that provides common functionality to all
7 "TAP::*" modules
8
10 Version 3.17
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 "_construct"
63
64 Create a new instance of the specified class.
65
66 "mk_methods"
67
68 Create simple getter/setters.
69
70 __PACKAGE__->mk_methods(@method_names);
71
72
73
74perl v5.12.4 2011-06-07 TAP::Object(3pm)