|
NAMEClass::MakeMethods::Template::Hash - Method interfaces for hash-based objectsSYNOPSISpackage MyObject; use Class::MakeMethods::Template::Hash ( new => [ 'new' ], scalar => [ 'foo', 'bar' ] ); package main; my $obj = MyObject->new( foo => "Foozle", bar => "Bozzle" ); print $obj->foo(); $obj->bar("Bamboozle"); DESCRIPTIONThese meta-methods create and access values within blessed hash objects.Common Parameters: The following parameters are defined for Hash meta-methods.
Common Behaviors
Standard MethodsThe following methods from Generic are all supported:new scalar string string_index number boolean bits (*) array hash tiedhash hash_of_arrays object instance array_of_objects code code_or_scalar See Class::MakeMethods::Template::Generic for the interfaces and behaviors of these method types. The items marked with a * above are specifically defined in this package, whereas the others are formed automatically by the interaction of this package's generic settings with the code templates provided by the Generic superclass. structstruct => [ qw / foo bar baz / ]; Creates methods for setting, checking and clearing values which are stored by position in an array. All the slots created with this meta-method are stored in a single array. The argument to struct should be a string or a reference to an array of strings. For each string meta-method x, it defines two methods: x and clear_x. x returns the value of the x-slot. If called with an argument, it first sets the x-slot to the argument. clear_x sets the slot to undef. Additionally, struct defines three class method: struct, which returns a list of all of the struct values, struct_fields, which returns a list of all the slots by name, and struct_dump, which returns a hash of the slot-name/slot-value pairs. SEE ALSOSee Class::MakeMethods for general information about this distribution.See Class::MakeMethods::Template for more about this family of subclasses. See Class::MakeMethods::Template::Generic for information about the various accessor interfaces subclassed herein.
Visit the GSP FreeBSD Man Page Interface. |