my $foo = new Foo; my $hash = cast 'HASH', $foo; print ref $hash; # 'HASH'