home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


B.8 Meta-Information

  1. Call-stack information. Use caller() to find out who's calling this subroutine:

        ($package, $file, $line) = caller();
  2. List of a package's global variables. For a package Foo , %Foo:: contains the symbol table, whose keys are names of global identifiers in that package and whose values are typeglobs.

  3. Find out what a reference contains. ref($r) returns undef if $r is an ordinary scalar, "SCALAR" if it is a reference to a scalar (similarly "ARRAY," "HASH," "CODE," and "REF") or the name of a package, if $r is a blessed object reference.

  4. Object information:

    $obj->isa("Foo"); # returns true if $obj inherits from Foo
    $obj->can("bar"); # returns true if it supports method "foo"