The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Class::Template - struct/member template builder

EXAMPLES

  • Example 1

    use Class::Template;
    
    struct( rusage => {
    	ru_utime => timeval,
    	ru_stime => timeval,
    });
    
    struct( timeval => [
    	tv_secs  => '$',
    	tv_usecs => '$',
    ]);
    
    my $s = new rusage;
  • Example 2

    package OBJ;
    use Class::Template;
    
    members OBJ {
    	'a'	=> '$',
    	'b'	=> '$',
    };
    
    members OBJ2 {
    	'd'	=> '@',
    	'c'	=> '$',
    };
    
    package OBJ2; @ISA = (OBJ);
    
    sub new {
    	my $r = InitMembers( &OBJ::InitMembers() );
    	bless $r;
    }

NOTES

Use '%' if the member should point to an anonymous hash. Use '@' if the member should point to an anonymous array.

When using % and @ the method requires one argument for the key or index into the hash or array.

Prefix the %, @, or $ with '*' to indicate you want to retrieve pointers to the values rather than the values themselves.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 35:

'=item' outside of any '=over'

Around line 73:

You forgot a '=back' before '=head1'