Index: Glib.pm =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/Glib.pm,v retrieving revision 1.21 diff -u -r1.21 Glib.pm --- Glib.pm 12 Sep 2003 03:36:01 -0000 1.21 +++ Glib.pm 18 Sep 2003 01:02:48 -0000 @@ -34,6 +34,41 @@ bootstrap Glib $VERSION; +package Glib::Object; +# based on (and/or copied from) code at: http://dev.perl.org/perl6/rfc/335.html +# main changes are levels rather than all, puttting package name before it, +# and also getting rid of the wantarray stuff +sub methods +{ + my ($class, $levels) = @_; + $class = ref $class || $class; + $levels ||= -1; + my %classes_seen; + my @methods; + my @class = ($class); + my $level = 0; + + no strict 'refs'; + while ($class = shift @class) + { + next if $classes_seen{$class}++; + unshift @class, @{"${class}::ISA"} + if $levels > $level or $levels < 0; + # Based on methods_via() in perl5db.pl + for my $method (grep {not /^[(_]/ and + defined &{${"${class}::"}{$_}}} + keys %{"${class}::"}) + { + push @methods, "$class->$method" + } + + $level++; + } + + sort @methods; +} +package Glib; + 1; =head1 NAME