in reply to Enumerating all attributes of a Moo object

Moo(se) objects are essentially hashrefs, so you can just do this:

print "$_\n" for keys %{$moo_object};

Replies are listed 'Best First'.
Re^2: Enumerating all attributes of a Moo object
by zwon (Abbot) on Jul 09, 2013 at 16:51 UTC
    Note, that this will not show attributes that are not set:
    use 5.010; use strict; use warnings; { package Foo; use Moose; has bar => ( is => 'rw' ); has baz => ( is => 'rw' ); } my $foo = Foo->new( bar => 1 ); say join "\n", keys %$foo; __END__ bar
Re^2: Enumerating all attributes of a Moo object
by Smonff (Monk) on Oct 19, 2020 at 19:20 UTC

    Thanks for this, it was very educative.

    🌸