If you want just "a" - that is, the list of attributes that have been set for a particular object - then unless you've been playing around subclassing Method::Generate::Accessor, you ought to be able to use keys(%$bar).

If you want "a" and "b" - that is, the list of all attributes declared for the class - then you could try:

thank you for your answer. The comments above and what you showed me let me think again about what I wanted to do:

I want to implement a factory class generating Moo-objects. IMHO a factory class IS tightly coupled with the objects it creates. I wanted to avoid to explicitly enumerate every attribute in the code for initialisation of the created object.

Do you think that the usage of the mentioned "introspection"-method is a good way to achieve that? Or should I use a different design?

By the way: With 'attributes' I thought of all setters related to the attributes declared via 'has', that means all names used for the initialisation hash for method 'new'.
Is there a common wording for that?

I'll also point out a technique you could use. Instead of FooFactory introspecting class Foo, you could have class Foo pass FooFactory all the information it needs. One simple way to do that is write a wrapper for has...