Class::Template - struct/member template builder


Class-Eroot documentation  | view source Contained in the Class-Eroot distribution.

Index


NAME

Top

Class::Template - struct/member template builder

EXAMPLES

Top

	use Class::Template;

	struct( rusage => {
		ru_utime => timeval,
		ru_stime => timeval,
	});

	struct( timeval => [
		tv_secs  => '$',
		tv_usecs => '$',
	]);

	my $s = new rusage;

	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

Top

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.


Class-Eroot documentation  | view source Contained in the Class-Eroot distribution.