Perl6 Object Oriented Cookbook (v0.2.1)  
Section 1: Introduction to Object Oriented Perl6  
 
Recipe 1.13: Determining the Class of an Object
Last Updated: Sep 8, 2003
Status: Draft
      Previous Page   Next Page

How important is this problem to you?
  (Login to Vote)
5.00 Rating, 4 Votes  

How acceptable is the proposed solution?
  (Login to Vote)
5.00 Rating, 3 Votes  

Problem:  

You have an object of unknown type. You want to find out what class it belongs to.

Solution:  

Use the TYPE method, made available to every perl6 object:

print $obj.TYPE;


Log In to Comment


Login / Edit User Info -- Copyright © 2002 Cognitivity -- Previous Page   Next Page