in reply to Moo vs Code Attributes

Is it safe to conclude that "with" is being processed after compilation of the source? Seems so, this works:

BEGIN { with 'Something::Base'; }

Replies are listed 'Best First'.
Re^2: Moo vs Code Attributes
by tobyink (Canon) on Oct 27, 2014 at 15:39 UTC

    Yes, with and extends are just plain old exported subs; they don't execute at compile time unless you wrap them in BEGIN { ... }.

    An alternative is to define your attribute in UNIVERSAL, so you don't need to inherit or import it explicitly. Defining attributes in UNIVERSAL is quite commonly done, and not as awful as it sounds.