diff options
author | Gisle Aas <aas@bergen.sn.no> | 1997-02-14 15:52:21 +0000 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-02-18 13:22:00 +1200 |
commit | 77bb9b23081b62119e8fbe9f5655b8802e4537ae (patch) | |
tree | 1bc0523507004973c4bfbe84d5f19928ec4f8799 | |
parent | 8dbaa58ee2aba7cc22d84199a674c58bbf108b46 (diff) | |
download | perl-77bb9b23081b62119e8fbe9f5655b8802e4537ae.tar.gz |
Remove redundant functions UNIVERSAL::{class,is_instance}
Nick Ing-Simmons <nik@tiuk.ti.com> writes:
> Loose them!
p5p-msgid: <hwwsbpeq2.fsf@bergen.sn.no>
-rw-r--r-- | pod/perldelta.pod | 28 | ||||
-rw-r--r-- | pod/perlobj.pod | 17 | ||||
-rw-r--r-- | universal.c | 22 |
3 files changed, 0 insertions, 67 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index bfaeedcc11..df184622df 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -277,34 +277,6 @@ C<VERSION> form of C<use>. # implies: A->VERSION(1.2); -=item class() - -C<class> returns the class name of its object. - -=item is_instance() - -C<is_instance> returns true if its object is an instance of some -class, false if its object is the class (package) itself. Example - - A->is_instance(); # False - - $var = 'A'; - $var->is_instance(); # False - - $ref = bless [], 'A'; - $ref->is_instance(); # True - -This can be useful for methods that wish to easily distinguish -whether they were invoked as class or as instance methods. - - sub some_meth { - my $classname = shift; - if ($classname->is_instance()) { - die "unexpectedly called as instance not class method"; - } - ..... - } - =back B<NOTE:> C<can> directly uses Perl's internal code for method lookup, and diff --git a/pod/perlobj.pod b/pod/perlobj.pod index 9b1ede111f..c8b85b4b7d 100644 --- a/pod/perlobj.pod +++ b/pod/perlobj.pod @@ -313,23 +313,6 @@ C<VERSION> form of C<use>. # implies: A->VERSION(1.2); -=item class() - -C<class> returns the class name of its object. - -=item is_instance() - -C<is_instance> returns true if its object is an instance of some -class, false if its object is the class (package) itself. Example - - A->is_instance(); # False - - $var = 'A'; - $var->is_instance(); # False - - $ref = bless [], 'A'; - $ref->is_instance(); # True - =back B<NOTE:> C<can> directly uses Perl's internal code for method lookup, and diff --git a/universal.c b/universal.c index 74d182d953..03b907de0c 100644 --- a/universal.c +++ b/universal.c @@ -170,26 +170,6 @@ XS(XS_UNIVERSAL_can) } static -XS(XS_UNIVERSAL_is_instance) -{ - dXSARGS; - ST(0) = SvROK(ST(0)) ? &sv_yes : &sv_no; - XSRETURN(1); -} - -static -XS(XS_UNIVERSAL_class) -{ - dXSARGS; - if(SvROK(ST(0)) && SvOBJECT(SvRV(ST(0)))) { - SV *sv = sv_newmortal(); - sv_setpv(sv, HvNAME(SvSTASH(SvRV(ST(0))))); - ST(0) = sv; - } - XSRETURN(1); -} - -static XS(XS_UNIVERSAL_VERSION) { dXSARGS; @@ -239,7 +219,5 @@ boot_core_UNIVERSAL() newXS("UNIVERSAL::isa", XS_UNIVERSAL_isa, file); newXS("UNIVERSAL::can", XS_UNIVERSAL_can, file); - newXS("UNIVERSAL::class", XS_UNIVERSAL_class, file); - newXS("UNIVERSAL::is_instance", XS_UNIVERSAL_is_instance, file); newXS("UNIVERSAL::VERSION", XS_UNIVERSAL_VERSION, file); } |