Sponsoring The Perl Toolchain Summit 2025: Help make this important event another success Learn more

package My::Farm;
use Moo;
has cow => ( is => 'ro', to_hash => 1 );
has duck => ( is => 'ro', to_hash => 'goose,if_exists', );
has horse => ( is => 'ro', to_hash => ',if_defined', );
has hen => ( is => 'ro', to_hash => 1, );
has secret_admirer => ( is => 'ro', );
# and somewhere else...
my $farm = My::Farm->new(
cow => 'Daisy',
duck => 'Frank',
secret_admirer => 'Fluffy',
);
print Dumper $farm->TO_HASH;