1 package Maasha::DumpFunc;
3 # Copyright (C) 2003 Martin A. Hansen.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # http://www.gnu.org/copyleft/gpl.html
22 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
25 # Routines to inspect objects and their inheritance.
28 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
33 use vars qw ( @ISA @EXPORT );
38 @ISA = qw( Exporter );
41 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
46 # Martin A. Hansen, August 2003.
48 # given an object, the cognate functions are returned as a list
50 my ( $obj, # incomming object
53 my ( $ref, $methods );
56 $methods = Class::Inspector->methods( $ref, 'full', 'public' );
58 # @{ $methods } = grep /$ref/, @{ $methods };
60 return wantarray ? @{ $methods } : $methods;
66 # Martin A. Hansen, August 2003.
68 # given an object, returns the cognate function run with default values
70 my ( $obj , # incomming object
73 # returns a list of test lines to be printed
75 my ( $methods, $method, $function, @lines );
77 $methods = dump_func( $obj );
79 foreach $method ( @{ $methods } )
81 $method =~ /::(\w+)$/;
83 next if not eval { $obj->$function };
85 # push @lines, "Testing $function from $method --- Returns -> " . $obj->$function;
86 print "TESTING $function FROM $method: RETURNS->" . $obj->$function . "\n";
89 return wantarray ? @lines : \@lines;
93 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<