In the Perl OOP, how can I dump all methods / fields in this class and its parent class.
my ($self) = @_;
I saw a lot of constructors as a
What is @_
? See perldoc -v @_
perldoc perlobj
mjd has an interesting article on introspection in Perl.
In addition, How do I list available methods on a given object or package in Perl? answers part of your question.
My preferred answer to that question uses Class::Inspector:
#!/usr/bin/env perl
use strict; use warnings;
use Class::Inspector;
use HTML::TokeParser::Simple;
my $methods = Class::Inspector->methods(
'HTML::TokeParser::Simple', 'full', 'public'
);
print "Methods:\n";
print "$_\n" for @$methods;
print "Superclasses\n";
use Class::ISA;
print join(", ", Class::ISA::super_path('HTML::TokeParser::Simple')), "\n";