This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Problems with SKIP in makemaker
[perl5.git] / lib / UNIVERSAL.pm
CommitLineData
def3c102 1package UNIVERSAL;
2
3require Exporter;
4@ISA = qw(Exporter);
5@EXPORT_OK = qw(isa);
6
71;
8__END__
9
10=head1 NAME
11
12UNIVERSAL - base class for ALL classes (blessed references)
13
14=head1 SYNOPSIS
15
16 use UNIVERSAL qw(isa);
17
18 $yes = isa($ref, "HASH");
19 $io = $fd->isa("IO::Handle");
20 $sub = $obj->can('print');
21
22=head1 DESCRIPTION
23
24C<UNIVERSAL> is the base class which all bless references will inherit from,
25see L<perlobj>
26
27C<UNIVERSAL> provides the following methods
28
29=over 4
30
31=item isa ( TYPE )
32
33C<isa> returns I<true> if C<REF> is blessed into package C<TYPE>
34or inherits from package C<TYPE>.
35
36C<isa> can be called as either a static or object method call.
37
38=item can ( METHOD )
39
40C<can> checks if the object has a method called C<METHOD>. If it does
7e1af8bc 41then a reference to the sub is returned. If it does not then I<undef>
def3c102 42is returned.
43
44C<can> can be called as either a static or object method call.
45
46=item VERSION ( [ REQUIRE ] )
47
48C<VERSION> will return the value of the variable C<$VERSION> in the
49package the object is blessed into. If C<REQUIRE> is given then
50it will do a comparison and die if the package version is not
51greater than or equal to C<REQUIRE>.
52
53C<VERSION> can be called as either a static or object method call.
54
55=back
56
57C<UNIVERSAL> also optionally exports the following subroutines
58
59=over 4
60
61=item isa ( REF, TYPE )
62
63C<isa> returns I<true> if the first argument is a reference and either
64of the following statements is true.
65
66=over 8
67
68=item
69
70C<REF> is a blessed reference and is blessed into package C<TYPE>
71or inherits from package C<TYPE>
72
73=item
74
75C<REF> is a reference to a C<TYPE> of perl variable (er 'HASH')
76
77=back
78
79=back
80
81=cut