home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_3adf15f2190ccff2867caa02f0562d07
< prev
next >
Wrap
Text File
|
2000-03-23
|
4KB
|
113 lines
<HTML>
<HEAD>
<TITLE>UNIVERSAL - base class for ALL classes</TITLE>
<LINK REL="stylesheet" HREF="../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> UNIVERSAL - base class for ALL classes</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>UNIVERSAL - base class for ALL classes (blessed references)</P>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
$io = $fd->isa("IO::Handle");
$sub = $obj->can('print');</PRE>
<PRE>
$yes = UNIVERSAL::isa($ref, "HASH");</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P><CODE>UNIVERSAL</CODE> is the base class which all bless references will inherit from,
see <A HREF="../lib/Pod/perlobj.html">the perlobj manpage</A></P>
<P><CODE>UNIVERSAL</CODE> provides the following methods</P>
<DL>
<DT><STRONG><A NAME="item_isa">isa ( TYPE )</A></STRONG><BR>
<DD>
<A HREF="#item_isa"><CODE>isa</CODE></A> returns <EM>true</EM> if <CODE>REF</CODE> is blessed into package <CODE>TYPE</CODE>
or inherits from package <CODE>TYPE</CODE>.
<P><A HREF="#item_isa"><CODE>isa</CODE></A> can be called as either a static or object method call.</P>
<P></P>
<DT><STRONG><A NAME="item_can">can ( METHOD )</A></STRONG><BR>
<DD>
<A HREF="#item_can"><CODE>can</CODE></A> checks if the object has a method called <CODE>METHOD</CODE>. If it does
then a reference to the sub is returned. If it does not then <EM>undef</EM>
is returned.
<P><A HREF="#item_can"><CODE>can</CODE></A> can be called as either a static or object method call.</P>
<P></P>
<DT><STRONG><A NAME="item_VERSION">VERSION ( [ REQUIRE ] )</A></STRONG><BR>
<DD>
<A HREF="#item_VERSION"><CODE>VERSION</CODE></A> will return the value of the variable <CODE>$VERSION</CODE> in the
package the object is blessed into. If <CODE>REQUIRE</CODE> is given then
it will do a comparison and die if the package version is not
greater than or equal to <CODE>REQUIRE</CODE>.
<P><A HREF="#item_VERSION"><CODE>VERSION</CODE></A> can be called as either a static or object method call.</P>
<P></P></DL>
<P>The <A HREF="#item_isa"><CODE>isa</CODE></A> and <A HREF="#item_can"><CODE>can</CODE></A> methods can also be called as subroutines</P>
<DL>
<DT><STRONG>UNIVERSAL::isa ( VAL, TYPE )</STRONG><BR>
<DD>
<A HREF="#item_isa"><CODE>isa</CODE></A> returns <EM>true</EM> if one of the following statements is true.
<UL>
<LI>
<CODE>VAL</CODE> is a reference blessed into either package <CODE>TYPE</CODE> or a package
which inherits from package <CODE>TYPE</CODE>.
<P></P>
<LI>
<CODE>VAL</CODE> is a reference to a <CODE>TYPE</CODE> of Perl variable (e.g. 'HASH').
<P></P>
<LI>
<CODE>VAL</CODE> is the name of a package that inherits from (or is itself)
package <CODE>TYPE</CODE>.
<P></P></UL>
<DT><STRONG>UNIVERSAL::can ( VAL, METHOD )</STRONG><BR>
<DD>
If <CODE>VAL</CODE> is a blessed reference which has a method called <CODE>METHOD</CODE>,
<A HREF="#item_can"><CODE>can</CODE></A> returns a reference to the subroutine. If <CODE>VAL</CODE> is not
a blessed reference, or if it does not have a method <CODE>METHOD</CODE>,
<EM>undef</EM> is returned.
<P></P></DL>
<P>These subroutines should <EM>not</EM> be imported via <A HREF="../lib/Pod/perlfunc.html#item_qw"><CODE>use UNIVERSAL qw(...)</CODE></A>.
If you want simple local access to them you can do</P>
<PRE>
*isa = \&UNIVERSAL::isa;</PRE>
<P>to import isa into your package.</P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> UNIVERSAL - base class for ALL classes</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>