.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "MakeMethods::Template::ClassName 3pm" .TH MakeMethods::Template::ClassName 3pm "2016-06-10" "perl v5.22.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Class::MakeMethods::Template::ClassName \- Access object's class .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 7 \& package MyObject; \& use Class::MakeMethods::Template::ClassName ( \& subclass_name => [ \*(Aqtype\*(Aq ] \& ); \& ... \& package main; \& my $object = MyObject\->new; \& \& $object\->type(\*(AqFoo\*(Aq) \& # reblesses object to MyObject::Foo subclass \& \& print $object\->type(); \& # prints "Foo". .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" These method types access or change information about the class an object is associated with. .SS "class_name" .IX Subsection "class_name" Called without arguments, returns the class name. .PP If called with an argument, reblesses object into that class. If the class doesn't already exist, it will be created. .SS "subclass_name" .IX Subsection "subclass_name" Called without arguments, returns the subclass name. .PP If called with an argument, reblesses object into that subclass. If the subclass doesn't already exist, it will be created. .PP The subclass name is written as follows: .IP "\(bu" 4 if it's the original, defining class: empty .IP "\(bu" 4 if its a a package within the namespace of the original: the distinguishing name within that namespace, without leading \f(CW\*(C`::\*(C'\fR .IP "\(bu" 4 if it's a package elsewhere: the full name with leading \f(CW\*(C`::\*(C'\fR .SS "static_hash_classname" .IX Subsection "static_hash_classname" Provides a shared hash mapping keys to class names. .PP .Vb 1 \& class_registry => [ qw/ foo / ] .Ve .PP Takes a single string or a reference to an array of strings as its argument. For each string, creates a new anonymous hash and associated accessor methods that will map scalar values to classes in the calling package's subclass hierarchy. .PP The accessor methods provide an interface to the hash as illustrated below. Note that several of these functions operate quite differently depending on the number of arguments passed, or the context in which they are called. .ie n .IP "@indexes = $class_or_ref\->x;" 4 .el .IP "\f(CW@indexes\fR = \f(CW$class_or_ref\fR\->x;" 4 .IX Item "@indexes = $class_or_ref->x;" Returns the scalar values that are indexes associated with this class, or the class of this object. .ie n .IP "$class = $class_or_ref\->x( $index );" 4 .el .IP "\f(CW$class\fR = \f(CW$class_or_ref\fR\->x( \f(CW$index\fR );" 4 .IX Item "$class = $class_or_ref->x( $index );" Returns the class name associated with the provided index value. .ie n .IP "@classes = $class_or_ref\->x( @indexes );" 4 .el .IP "\f(CW@classes\fR = \f(CW$class_or_ref\fR\->x( \f(CW@indexes\fR );" 4 .IX Item "@classes = $class_or_ref->x( @indexes );" Returns the associated classes for each index in order. .ie n .IP "@all_indexes = $class_or_ref\->x_keys;" 4 .el .IP "\f(CW@all_indexes\fR = \f(CW$class_or_ref\fR\->x_keys;" 4 .IX Item "@all_indexes = $class_or_ref->x_keys;" Returns a list of the indexes defined for this registry. .ie n .IP "@all_classes = $class_or_ref\->x_values;" 4 .el .IP "\f(CW@all_classes\fR = \f(CW$class_or_ref\fR\->x_values;" 4 .IX Item "@all_classes = $class_or_ref->x_values;" Returns a list of the classes associated with this registry. .ie n .IP "@all_classes = $class_or_ref\->unique_x_values;" 4 .el .IP "\f(CW@all_classes\fR = \f(CW$class_or_ref\fR\->unique_x_values;" 4 .IX Item "@all_classes = $class_or_ref->unique_x_values;" Returns a list of the classes associated with this registry, with no more than one occurrence of any value. .ie n .IP "%mapping = $class_or_ref\->x_hash;" 4 .el .IP "\f(CW%mapping\fR = \f(CW$class_or_ref\fR\->x_hash;" 4 .IX Item "%mapping = $class_or_ref->x_hash;" Return the key-value pairs used to store this attribute .ie n .IP "$mapping_ref = $class_or_ref\->x_hash;" 4 .el .IP "\f(CW$mapping_ref\fR = \f(CW$class_or_ref\fR\->x_hash;" 4 .IX Item "$mapping_ref = $class_or_ref->x_hash;" Returns a reference to the hash used for the mapping. .ie n .IP "$class_or_ref\->add_x( @indexes );" 4 .el .IP "\f(CW$class_or_ref\fR\->add_x( \f(CW@indexes\fR );" 4 .IX Item "$class_or_ref->add_x( @indexes );" Adds an entry in the hash for each of the provided indexes, mapping it to this class, or the class of this object. .ie n .IP "$class_or_ref\->clear_x;" 4 .el .IP "\f(CW$class_or_ref\fR\->clear_x;" 4 .IX Item "$class_or_ref->clear_x;" Removes those entries from the hash whose values are this class, or the class of this object. .ie n .IP "$class_or_ref\->clear_xs( @indexes );" 4 .el .IP "\f(CW$class_or_ref\fR\->clear_xs( \f(CW@indexes\fR );" 4 .IX Item "$class_or_ref->clear_xs( @indexes );" Remove all entries from the hash. .SH "SEE ALSO" .IX Header "SEE ALSO" See Class::MakeMethods for general information about this distribution. .PP See Class::MakeMethods::Template for information about this family of subclasses.