<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">SYNOPSIS

     use Class::GenSource qw(gen_class_source_code);
    
     say gen_class_source_code(
         name =&gt; 'My::Class',
         attributes =&gt; {
             foo =&gt; {},
             bar =&gt; {},
             baz =&gt; {},
         },
     );

    Will print something like:

     package My::Class;
    
     sub new { my $class = shift; bless {@_}, $class }
     sub foo { $_[0]{foo} }
     sub bar { $_[0]{bar} }
     sub baz { $_[0]{baz} }

    Another example (generating Moo-based class):

     say gen_class_source_code(
         name =&gt; 'My::Class',
         attributes =&gt; {
             foo =&gt; {},
             bar =&gt; {},
             baz =&gt; {},
         },
         variant =&gt; 'Moo',
     );

    will print something like:

     package My::Class;
     use Moo;
     has foo =&gt; (is=&gt;'rw');
     has bar =&gt; (is=&gt;'rw');
     has baz =&gt; (is=&gt;'rw');

DESCRIPTION

</pre></body></html>