.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Rose::Object::MixIn 3pm" .TH Rose::Object::MixIn 3pm "2010-04-27" "perl v5.18.1" "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" Rose::Object::MixIn \- A base class for mix\-ins. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& package MyMixInClass; \& \& use Rose::Object::MixIn(); # Use empty parentheses here \& our @ISA = qw(Rose::Object::MixIn); \& \& _\|_PACKAGE_\|_\->export_tag(all => [ qw(my_cool_method my_other_method) ]); \& \& sub my_cool_method { ... } \& sub my_other_method { ... } \& ... \& \& package MyClass; \& # Import methods my_cool_method() and my_other_method() \& use MyMixInClass qw(:all); \& ... \& \& package MyOtherClass; \& # Import just my_cool_method() \& use MyMixInClass qw(my_cool_method); \& ... \& \& package YetAnotherClass; \& # Import just my_cool_method() as cool() \& use MyMixInClass { my_cool_method => \*(Aqcool\*(Aq } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Rose::Object::MixIn is a base class for mix-ins. A mix-in is a class that exports methods into another class. This export process is controlled with an Exporter\-like interface, but Rose::Object::MixIn does not inherit from Exporter. .PP When you use a Rose::Object::MixIn\-derived class, its import method is called at compile time. In other words, this: .PP .Vb 1 \& use Rose::Object::MixIn \*(Aqa\*(Aq, \*(Aqb\*(Aq, { c => \*(Aqd\*(Aq }; .Ve .PP is the same thing as this: .PP .Vb 1 \& BEGIN { Rose::Object::MixIn\->import(\*(Aqa\*(Aq, \*(Aqb\*(Aq, { c => \*(Aqd\*(Aq }) } .Ve .PP To prevent the import method from being run, put empty parentheses \*(L"()\*(R" after the package name instead of a list of arguments. .PP .Vb 1 \& use Rose::Object::MixIn(); .Ve .PP See the synopsis for an example of when this is handy: using Rose::Object::MixIn from within a subclass. Note that the empty parenthesis are important. The following is \fInot\fR equivalent: .PP .Vb 2 \& # This is not the same thing as the example above! \& use Rose::Object::MixIn; .Ve .PP See the documentation for the import method below to learn what arguments it accepts. .SH "CLASS METHODS" .IX Header "CLASS METHODS" .IP "\fBimport \s-1ARGS\s0\fR" 4 .IX Item "import ARGS" Import the methods specified by \s-1ARGS\s0 into the package from which this method was called. If the current class can already perform one of these methods, a fatal error will occur. To override an existing method, you must use the \f(CW\*(C`\-force\*(C'\fR argument (see below). .Sp Valid formats for \s-1ARGS\s0 are as follows: .RS 4 .IP "\(bu" 4 \&\fBA method name\fR .Sp Literal method names will be imported as-is. .IP "\(bu" 4 \&\fBA tag name\fR .Sp Tags names are indicated with a leading colon. For example, \*(L":all\*(R" specifies the \*(L"all\*(R" tag. A tag is a stand-in for a list of methods. See the export_tag method to learn how to create tags. .IP "\(bu" 4 \&\fBA reference to a hash\fR .Sp Each key/value pair in this hash contains a method name and the name that it will be imported as. Use this feature to import methods under different names in order to avoid conflicts with existing methods. .IP "\(bu" 4 \&\f(CW\*(C`\-force\*(C'\fR .Sp The special literal argument \f(CW\*(C`\-force\*(C'\fR will cause the specified methods to be imported even if the calling class can already perform one or more of those methods. .IP "\(bu" 4 \&\f(CW\*(C`\-target_class CLASS\*(C'\fR .Sp The special literal argument \f(CW\*(C`\-target\-class\*(C'\fR followed by a class name will cause the specified methods to be imported into \s-1CLASS\s0 rather than into the calling class. .RE .RS 4 .Sp See the synopsis for several examples of the import method in action. (Remember, it's called implicitly when you use a Rose::Object::MixIn\-derived class with anything other than an empty set of parenthesis \*(L"()\*(R" as an argument.) .RE .IP "\fBclear_export_tags\fR" 4 .IX Item "clear_export_tags" Delete the entire list of export tags. .IP "\fBexport_tag \s-1NAME\s0 [, \s-1ARRAYREF\s0]\fR" 4 .IX Item "export_tag NAME [, ARRAYREF]" Get or set the list of method names associated with a tag. The tag name should \fInot\fR begin with a colon. If \s-1ARRAYREF\s0 is passed, then the list of methods associated with the specific tag is set. .Sp Returns a list (in list context) or a reference to an array (in scalar context) of method names. The array reference return value should be treated as read-only. If no such tag exists, and if an \s-1ARRAYREF\s0 is not passed, then a fatal error will occur. .IP "\fBexport_tags\fR" 4 .IX Item "export_tags" Returns a list (in list context) and a reference to an array (in scalar context) containing the complete list of export tags. The array reference return value should be treated as read-only. .SH "AUTHOR" .IX Header "AUTHOR" John C. Siracusa (siracusa@gmail.com) .SH "LICENSE" .IX Header "LICENSE" Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.