.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\" ========================================================================
.de Sh \" Subsection heading
.de Sp \" Vertical space (when we can't use .PP)
.de Vb \" Begin verbatim text
.de Ve \" End verbatim text
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
. tm Index:\\$1\t\\n%\t"\\$2"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. \" simple accents for nroff and troff
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
.\" ========================================================================
.TH UNIVERSAL 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
UNIVERSAL \- base class for ALL classes (blessed references)
\& $is_io = $fd->isa("IO::Handle");
\& $is_io = Class->isa("IO::Handle");
\& $sub = $obj->can("print");
\& $sub = Class->can("print");
\& use UNIVERSAL qw( isa can VERSION );
\& $yes = isa $ref, "HASH" ;
\& $sub = can $ref, "fandango" ;
\&\f(CW\*(C`UNIVERSAL\*(C'\fR is the base class which all bless references will inherit from,
\&\f(CW\*(C`UNIVERSAL\*(C'\fR provides the following methods and functions:
.ie n .IP """$obj\->isa( TYPE )""" 4
.el .IP "\f(CW$obj\->isa( TYPE )\fR" 4
.IX Item "$obj->isa( TYPE )"
.ie n .IP """CLASS\->isa( TYPE )""" 4
.el .IP "\f(CWCLASS\->isa( TYPE )\fR" 4
.IX Item "CLASS->isa( TYPE )"
.ie n .IP """isa( VAL, TYPE )""" 4
.el .IP "\f(CWisa( VAL, TYPE )\fR" 4
.IX Item "isa( VAL, TYPE )"
is a blessed reference or a string containing a package name
.el .IP "\f(CWCLASS\fR" 4
is any of the above or an unblessed reference
When used as an instance or class method (\f(CW\*(C`$obj\->isa( TYPE )\*(C'\fR),
\&\f(CW\*(C`isa\*(C'\fR returns \fItrue\fR if \f(CW$obj\fR is blessed into package \f(CW\*(C`TYPE\*(C'\fR or
inherits from package \f(CW\*(C`TYPE\*(C'\fR.
When used as a class method (\f(CW\*(C`CLASS\->isa( TYPE )\*(C'\fR: sometimes
referred to as a static method), \f(CW\*(C`isa\*(C'\fR returns \fItrue\fR if \f(CW\*(C`CLASS\*(C'\fR
inherits from (or is itself) the name of the package \f(CW\*(C`TYPE\*(C'\fR or
inherits from package \f(CW\*(C`TYPE\*(C'\fR.
When used as a function, like
\& use UNIVERSAL qw( isa ) ;
\& $yes = isa $h, "HASH";
\& $yes = isa "Foo", "Bar";
\& $yes = UNIVERSAL::isa $a, "ARRAY";
\&\f(CW\*(C`isa\*(C'\fR returns \fItrue\fR in the same cases as above and also if \f(CW\*(C`VAL\*(C'\fR is an
unblessed reference to a perl variable of type \f(CW\*(C`TYPE\*(C'\fR, such as \*(L"\s-1HASH\s0\*(R",
\&\*(L"\s-1ARRAY\s0\*(R", or \*(L"Regexp\*(R".
.ie n .IP """$obj\->can( METHOD )""" 4
.el .IP "\f(CW$obj\->can( METHOD )\fR" 4
.IX Item "$obj->can( METHOD )"
.ie n .IP """CLASS\->can( METHOD )""" 4
.el .IP "\f(CWCLASS\->can( METHOD )\fR" 4
.IX Item "CLASS->can( METHOD )"
.ie n .IP """can( VAL, METHOD )""" 4
.el .IP "\f(CWcan( VAL, METHOD )\fR" 4
.IX Item "can( VAL, METHOD )"
\&\f(CW\*(C`can\*(C'\fR checks if the object or class has a method called \f(CW\*(C`METHOD\*(C'\fR. If it does
then a reference to the sub is returned. If it does not then \fIundef\fR is
returned. This includes methods inherited or imported by \f(CW$obj\fR, \f(CW\*(C`CLASS\*(C'\fR, or
\&\f(CW\*(C`can\*(C'\fR cannot know whether an object will be able to provide a method
through \s-1AUTOLOAD\s0, so a return value of \fIundef\fR does not necessarily mean
the object will not be able to handle the method call. To get around
this some module authors use a forward declaration (see perlsub)
for methods they will handle via \s-1AUTOLOAD\s0. For such 'dummy' subs, \f(CW\*(C`can\*(C'\fR
will still return a code reference, which, when called, will fall through
to the \s-1AUTOLOAD\s0. If no suitable \s-1AUTOLOAD\s0 is provided, calling the coderef
\&\f(CW\*(C`can\*(C'\fR can be called as a class (static) method, an object method, or a
When used as a function, if \f(CW\*(C`VAL\*(C'\fR is a blessed reference or package name which
has a method called \f(CW\*(C`METHOD\*(C'\fR, \f(CW\*(C`can\*(C'\fR returns a reference to the subroutine.
If \f(CW\*(C`VAL\*(C'\fR is not a blessed reference, or if it does not have a method
\&\f(CW\*(C`METHOD\*(C'\fR, \fIundef\fR is returned.
.ie n .IP """VERSION ( [ REQUIRE ] )""" 4
.el .IP "\f(CWVERSION ( [ REQUIRE ] )\fR" 4
.IX Item "VERSION ( [ REQUIRE ] )"
\&\f(CW\*(C`VERSION\*(C'\fR will return the value of the variable \f(CW$VERSION\fR in the
package the object is blessed into. If \f(CW\*(C`REQUIRE\*(C'\fR is given then
it will do a comparison and die if the package version is not
greater than or equal to \f(CW\*(C`REQUIRE\*(C'\fR.
\&\f(CW\*(C`VERSION\*(C'\fR can be called as either a class (static) method, an object
You may request the import of all three functions (\f(CW\*(C`isa\*(C'\fR, \f(CW\*(C`can\*(C'\fR, and
\&\f(CW\*(C`VERSION\*(C'\fR), however it isn't usually necessary to do so. Perl magically
makes these functions act as methods on all objects. The one exception is
\&\f(CW\*(C`isa\*(C'\fR, which is useful as a function when operating on non-blessed