use strict; use Data::DumpXML qw(dump_xml); my $foo = Foo->new(); dump_xml($foo); package Foo; sub new { return bless { scalar => 'foobar', array => [('a'..'d')], hash => { bar => { baz => 'qux'}}, }, shift; } #### package main; my $no = Bar->new(); print "yes\n" if $no->can('do'); package Bar; sub new { bless {},shift } sub do { print "cool\n" }