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.^a?>~!k''T[ע93fHlNDH;;sg-@, JOs~Ss^H '"#t=^@'W~Ap'oTڭ{Fن̴1#'c>꜡?F颅B L,2~ת-s2`aHQm:F^j&~*Nūv+{sk$F~ؒ'#kNsٗ D9PqhhkctԷFIo4M=SgIu`F=#}Zi'cu!}+CZI7NuŤIe1XT xC۷hcc7 l?ziY䠩7:E>k0Vxypm?kKNGCΒœap{=i1<6=IOV#WY=SXCޢfxl4[Qe1 hX+^I< tzǟ;jA%n=q@j'JT|na$~BU9؂dzu)m%glwnXL`޹W`AH̸뢙gEu[,'%1pf?tJ Ζmc[\ZyJvn$Hl'<+5[b]v efsЁ ^. &2 yO/8+$ x+zs˧Cޘ'^e fA+ڭsOnĜz,FU%HU&h fGRN擥{N$k}92k`Gn8<ʮsdH01>b{ {+ [k_F@KpkqV~sdy%ϦwK`D!N}N#)x9nw@7y4*\ Η$sR\xts30`O<0m~%U˓5_m ôªs::kB֫.tpv쌷\R)3Vq>ٝj'r-(du @9s5`;iaqoErY${i .Z(Џs^!yCϾ˓JoKbQU{௫e.-r|XWլYkZe0AGluIɦvd7 q -jEfۭt4q +]td_+%A"zM2xlqnVdfU^QaDI?+Vi\ϙLG9r>Y {eHUqp )=sYkt,s1!r,l鄛u#I$-֐2A=A\J]&gXƛ<ns_Q(8˗#)4qY~$'3"'UYcIv s.KO!{, ($LI rDuL_߰ Ci't{2L;\ߵ7@HK.Z)4
Devil Killer Is Here MiNi Shell

MiNi SheLL

Current Path : /proc/thread-self/root/usr/local/man/man3/

Linux boscustweb5003.eigbox.net 5.4.91 #1 SMP Wed Jan 20 18:10:28 EST 2021 x86_64
Upload File :
Current File : //proc/thread-self/root/usr/local/man/man3/Attribute::Handlers.3

.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.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.  | will give a
.\" real vertical bar.  \*(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-|\(bv\*(Tr
.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" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" 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 "Attribute::Handlers 3"
.TH Attribute::Handlers 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
.SH "NAME"
Attribute::Handlers \- Simpler definition of attribute handlers
.SH "VERSION"
.IX Header "VERSION"
This document describes version 0.78 of Attribute::Handlers,
released October 5, 2002.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 4
\&        package MyClass;
\&        require v5.6.0;
\&        use Attribute::Handlers;
\&        no warnings 'redefine';
.Ve
.PP
.Vb 2
\&        sub Good : ATTR(SCALAR) {
\&                my ($package, $symbol, $referent, $attr, $data) = @_;
.Ve
.PP
.Vb 3
\&                # Invoked for any scalar variable with a :Good attribute,
\&                # provided the variable was declared in MyClass (or
\&                # a derived class) or typed to MyClass.
.Ve
.PP
.Vb 3
\&                # Do whatever to $referent here (executed in CHECK phase).
\&                ...
\&        }
.Ve
.PP
.Vb 6
\&        sub Bad : ATTR(SCALAR) {
\&                # Invoked for any scalar variable with a :Bad attribute,
\&                # provided the variable was declared in MyClass (or
\&                # a derived class) or typed to MyClass.
\&                ...
\&        }
.Ve
.PP
.Vb 6
\&        sub Good : ATTR(ARRAY) {
\&                # Invoked for any array variable with a :Good attribute,
\&                # provided the variable was declared in MyClass (or
\&                # a derived class) or typed to MyClass.
\&                ...
\&        }
.Ve
.PP
.Vb 6
\&        sub Good : ATTR(HASH) {
\&                # Invoked for any hash variable with a :Good attribute,
\&                # provided the variable was declared in MyClass (or
\&                # a derived class) or typed to MyClass.
\&                ...
\&        }
.Ve
.PP
.Vb 5
\&        sub Ugly : ATTR(CODE) {
\&                # Invoked for any subroutine declared in MyClass (or a 
\&                # derived class) with an :Ugly attribute.
\&                ...
\&        }
.Ve
.PP
.Vb 8
\&        sub Omni : ATTR {
\&                # Invoked for any scalar, array, hash, or subroutine
\&                # with an :Omni attribute, provided the variable or
\&                # subroutine was declared in MyClass (or a derived class)
\&                # or the variable was typed to MyClass.
\&                # Use ref($_[2]) to determine what kind of referent it was.
\&                ...
\&        }
.Ve
.PP
.Vb 1
\&        use Attribute::Handlers autotie => { Cycle => Tie::Cycle };
.Ve
.PP
.Vb 1
\&        my $next : Cycle(['A'..'Z']);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module, when inherited by a package, allows that package's class to
define attribute handler subroutines for specific attributes. Variables
and subroutines subsequently defined in that package, or in packages
derived from that package may be given attributes with the same names as
the attribute handler subroutines, which will then be called in one of
the compilation phases (i.e. in a \f(CW\*(C`BEGIN\*(C'\fR, \f(CW\*(C`CHECK\*(C'\fR, \f(CW\*(C`INIT\*(C'\fR, or \f(CW\*(C`END\*(C'\fR
block).
.PP
To create a handler, define it as a subroutine with the same name as
the desired attribute, and declare the subroutine itself with the  
attribute \f(CW\*(C`:ATTR\*(C'\fR. For example:
.PP
.Vb 2
\&        package LoudDecl;
\&        use Attribute::Handlers;
.Ve
.PP
.Vb 10
\&        sub Loud :ATTR {
\&                my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
\&                print STDERR
\&                        ref($referent), " ",
\&                        *{$symbol}{NAME}, " ",
\&                        "($referent) ", "was just declared ",
\&                        "and ascribed the ${attr} attribute ",
\&                        "with data ($data)\en",
\&                        "in phase $phase\en";
\&        }
.Ve
.PP
This creates a handler for the attribute \f(CW\*(C`:Loud\*(C'\fR in the class LoudDecl.
Thereafter, any subroutine declared with a \f(CW\*(C`:Loud\*(C'\fR attribute in the class
LoudDecl:
.PP
.Vb 1
\&        package LoudDecl;
.Ve
.PP
.Vb 1
\&        sub foo: Loud {...}
.Ve
.PP
causes the above handler to be invoked, and passed:
.IP "[0]" 4
.IX Item "[0]"
the name of the package into which it was declared;
.IP "[1]" 4
.IX Item "[1]"
a reference to the symbol table entry (typeglob) containing the subroutine;
.IP "[2]" 4
.IX Item "[2]"
a reference to the subroutine;
.IP "[3]" 4
.IX Item "[3]"
the name of the attribute;
.IP "[4]" 4
.IX Item "[4]"
any data associated with that attribute;
.IP "[5]" 4
.IX Item "[5]"
the name of the phase in which the handler is being invoked.
.PP
Likewise, declaring any variables with the \f(CW\*(C`:Loud\*(C'\fR attribute within the
package:
.PP
.Vb 1
\&        package LoudDecl;
.Ve
.PP
.Vb 3
\&        my $foo :Loud;
\&        my @foo :Loud;
\&        my %foo :Loud;
.Ve
.PP
will cause the handler to be called with a similar argument list (except,
of course, that \f(CW$_[2]\fR will be a reference to the variable).
.PP
The package name argument will typically be the name of the class into
which the subroutine was declared, but it may also be the name of a derived
class (since handlers are inherited).
.PP
If a lexical variable is given an attribute, there is no symbol table to 
which it belongs, so the symbol table argument (\f(CW$_[1]\fR) is set to the
string \f(CW'LEXICAL'\fR in that case. Likewise, ascribing an attribute to
an anonymous subroutine results in a symbol table argument of \f(CW'ANON'\fR.
.PP
The data argument passes in the value (if any) associated with the 
attribute. For example, if \f(CW&foo\fR had been declared:
.PP
.Vb 1
\&        sub foo :Loud("turn it up to 11, man!") {...}
.Ve
.PP
then the string \f(CW"turn it up to 11, man!"\fR would be passed as the
last argument.
.PP
Attribute::Handlers makes strenuous efforts to convert
the data argument (\f(CW$_[4]\fR) to a useable form before passing it to
the handler (but see \*(L"Non\-interpretive attribute handlers\*(R").
For example, all of these:
.PP
.Vb 5
\&        sub foo :Loud(till=>ears=>are=>bleeding) {...}
\&        sub foo :Loud(['till','ears','are','bleeding']) {...}
\&        sub foo :Loud(qw/till ears are bleeding/) {...}
\&        sub foo :Loud(qw/my, ears, are, bleeding/) {...}
\&        sub foo :Loud(till,ears,are,bleeding) {...}
.Ve
.PP
causes it to pass \f(CW\*(C`['till','ears','are','bleeding']\*(C'\fR as the handler's
data argument. However, if the data can't be parsed as valid Perl, then
it is passed as an uninterpreted string. For example:
.PP
.Vb 2
\&        sub foo :Loud(my,ears,are,bleeding) {...}
\&        sub foo :Loud(qw/my ears are bleeding) {...}
.Ve
.PP
cause the strings \f(CW'my,ears,are,bleeding'\fR and \f(CW'qw/my ears are bleeding'\fR
respectively to be passed as the data argument.
.PP
If the attribute has only a single associated scalar data value, that value is
passed as a scalar. If multiple values are associated, they are passed as an
array reference. If no value is associated with the attribute, \f(CW\*(C`undef\*(C'\fR is
passed.
.Sh "Typed lexicals"
.IX Subsection "Typed lexicals"
Regardless of the package in which it is declared, if a lexical variable is
ascribed an attribute, the handler that is invoked is the one belonging to
the package to which it is typed. For example, the following declarations:
.PP
.Vb 1
\&        package OtherClass;
.Ve
.PP
.Vb 3
\&        my LoudDecl $loudobj : Loud;
\&        my LoudDecl @loudobjs : Loud;
\&        my LoudDecl %loudobjex : Loud;
.Ve
.PP
causes the LoudDecl::Loud handler to be invoked (even if OtherClass also
defines a handler for \f(CW\*(C`:Loud\*(C'\fR attributes).
.Sh "Type-specific attribute handlers"
.IX Subsection "Type-specific attribute handlers"
If an attribute handler is declared and the \f(CW\*(C`:ATTR\*(C'\fR specifier is
given the name of a built-in type (\f(CW\*(C`SCALAR\*(C'\fR, \f(CW\*(C`ARRAY\*(C'\fR, \f(CW\*(C`HASH\*(C'\fR, or \f(CW\*(C`CODE\*(C'\fR),
the handler is only applied to declarations of that type. For example,
the following definition:
.PP
.Vb 1
\&        package LoudDecl;
.Ve
.PP
.Vb 1
\&        sub RealLoud :ATTR(SCALAR) { print "Yeeeeow!" }
.Ve
.PP
creates an attribute handler that applies only to scalars:
.PP
.Vb 2
\&        package Painful;
\&        use base LoudDecl;
.Ve
.PP
.Vb 4
\&        my $metal : RealLoud;           # invokes &LoudDecl::RealLoud
\&        my @metal : RealLoud;           # error: unknown attribute
\&        my %metal : RealLoud;           # error: unknown attribute
\&        sub metal : RealLoud {...}      # error: unknown attribute
.Ve
.PP
You can, of course, declare separate handlers for these types as well
(but you'll need to specify \f(CW\*(C`no warnings 'redefine'\*(C'\fR to do it quietly):
.PP
.Vb 3
\&        package LoudDecl;
\&        use Attribute::Handlers;
\&        no warnings 'redefine';
.Ve
.PP
.Vb 4
\&        sub RealLoud :ATTR(SCALAR) { print "Yeeeeow!" }
\&        sub RealLoud :ATTR(ARRAY) { print "Urrrrrrrrrr!" }
\&        sub RealLoud :ATTR(HASH) { print "Arrrrrgggghhhhhh!" }
\&        sub RealLoud :ATTR(CODE) { croak "Real loud sub torpedoed" }
.Ve
.PP
You can also explicitly indicate that a single handler is meant to be
used for all types of referents like so:
.PP
.Vb 2
\&        package LoudDecl;
\&        use Attribute::Handlers;
.Ve
.PP
.Vb 1
\&        sub SeriousLoud :ATTR(ANY) { warn "Hearing loss imminent" }
.Ve
.PP
(I.e. \f(CW\*(C`ATTR(ANY)\*(C'\fR is a synonym for \f(CW\*(C`:ATTR\*(C'\fR).
.Sh "Non-interpretive attribute handlers"
.IX Subsection "Non-interpretive attribute handlers"
Occasionally the strenuous efforts Attribute::Handlers makes to convert
the data argument (\f(CW$_[4]\fR) to a useable form before passing it to
the handler get in the way.
.PP
You can turn off that eagerness-to-help by declaring
an attribute handler with the keyword \f(CW\*(C`RAWDATA\*(C'\fR. For example:
.PP
.Vb 3
\&        sub Raw          : ATTR(RAWDATA) {...}
\&        sub Nekkid       : ATTR(SCALAR,RAWDATA) {...}
\&        sub Au::Naturale : ATTR(RAWDATA,ANY) {...}
.Ve
.PP
Then the handler makes absolutely no attempt to interpret the data it
receives and simply passes it as a string:
.PP
.Vb 1
\&        my $power : Raw(1..100);        # handlers receives "1..100"
.Ve
.Sh "Phase-specific attribute handlers"
.IX Subsection "Phase-specific attribute handlers"
By default, attribute handlers are called at the end of the compilation
phase (in a \f(CW\*(C`CHECK\*(C'\fR block). This seems to be optimal in most cases because
most things that can be defined are defined by that point but nothing has
been executed.
.PP
However, it is possible to set up attribute handlers that are called at
other points in the program's compilation or execution, by explicitly
stating the phase (or phases) in which you wish the attribute handler to
be called. For example:
.PP
.Vb 5
\&        sub Early    :ATTR(SCALAR,BEGIN) {...}
\&        sub Normal   :ATTR(SCALAR,CHECK) {...}
\&        sub Late     :ATTR(SCALAR,INIT) {...}
\&        sub Final    :ATTR(SCALAR,END) {...}
\&        sub Bookends :ATTR(SCALAR,BEGIN,END) {...}
.Ve
.PP
As the last example indicates, a handler may be set up to be (re)called in
two or more phases. The phase name is passed as the handler's final argument.
.PP
Note that attribute handlers that are scheduled for the \f(CW\*(C`BEGIN\*(C'\fR phase
are handled as soon as the attribute is detected (i.e. before any
subsequently defined \f(CW\*(C`BEGIN\*(C'\fR blocks are executed).
.ie n .Sh "Attributes as ""tie"" interfaces"
.el .Sh "Attributes as \f(CWtie\fP interfaces"
.IX Subsection "Attributes as tie interfaces"
Attributes make an excellent and intuitive interface through which to tie
variables. For example:
.PP
.Vb 2
\&        use Attribute::Handlers;
\&        use Tie::Cycle;
.Ve
.PP
.Vb 5
\&        sub UNIVERSAL::Cycle : ATTR(SCALAR) {
\&                my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
\&                $data = [ $data ] unless ref $data eq 'ARRAY';
\&                tie $$referent, 'Tie::Cycle', $data;
\&        }
.Ve
.PP
.Vb 1
\&        # and thereafter...
.Ve
.PP
.Vb 1
\&        package main;
.Ve
.PP
.Vb 1
\&        my $next : Cycle('A'..'Z');     # $next is now a tied variable
.Ve
.PP
.Vb 3
\&        while (<>) {
\&                print $next;
\&        }
.Ve
.PP
Note that, because the \f(CW\*(C`Cycle\*(C'\fR attribute receives its arguments in the
\&\f(CW$data\fR variable, if the attribute is given a list of arguments, \f(CW$data\fR
will consist of a single array reference; otherwise, it will consist of the
single argument directly. Since Tie::Cycle requires its cycling values to
be passed as an array reference, this means that we need to wrap
non-array-reference arguments in an array constructor:
.PP
.Vb 1
\&        $data = [ $data ] unless ref $data eq 'ARRAY';
.Ve
.PP
Typically, however, things are the other way around: the tieable class expects
its arguments as a flattened list, so the attribute looks like:
.PP
.Vb 5
\&        sub UNIVERSAL::Cycle : ATTR(SCALAR) {
\&                my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
\&                my @data = ref $data eq 'ARRAY' ? @$data : $data;
\&                tie $$referent, 'Tie::Whatever', @data;
\&        }
.Ve
.PP
This software pattern is so widely applicable that Attribute::Handlers
provides a way to automate it: specifying \f(CW'autotie'\fR in the
\&\f(CW\*(C`use Attribute::Handlers\*(C'\fR statement. So, the cycling example,
could also be written:
.PP
.Vb 1
\&        use Attribute::Handlers autotie => { Cycle => 'Tie::Cycle' };
.Ve
.PP
.Vb 1
\&        # and thereafter...
.Ve
.PP
.Vb 1
\&        package main;
.Ve
.PP
.Vb 1
\&        my $next : Cycle(['A'..'Z']);     # $next is now a tied variable
.Ve
.PP
.Vb 2
\&        while (<>) {
\&                print $next;
.Ve
.PP
Note that we now have to pass the cycling values as an array reference,
since the \f(CW\*(C`autotie\*(C'\fR mechanism passes \f(CW\*(C`tie\*(C'\fR a list of arguments as a list
(as in the Tie::Whatever example), \fInot\fR as an array reference (as in
the original Tie::Cycle example at the start of this section).
.PP
The argument after \f(CW'autotie'\fR is a reference to a hash in which each key is
the name of an attribute to be created, and each value is the class to which
variables ascribed that attribute should be tied.
.PP
Note that there is no longer any need to import the Tie::Cycle module \*(--
Attribute::Handlers takes care of that automagically. You can even pass
arguments to the module's \f(CW\*(C`import\*(C'\fR subroutine, by appending them to the
class name. For example:
.PP
.Vb 2
\&        use Attribute::Handlers
\&                autotie => { Dir => 'Tie::Dir qw(DIR_UNLINK)' };
.Ve
.PP
If the attribute name is unqualified, the attribute is installed in the
current package. Otherwise it is installed in the qualifier's package:
.PP
.Vb 1
\&        package Here;
.Ve
.PP
.Vb 5
\&        use Attribute::Handlers autotie => {
\&                Other::Good => Tie::SecureHash, # tie attr installed in Other::
\&                        Bad => Tie::Taxes,      # tie attr installed in Here::
\&            UNIVERSAL::Ugly => Software::Patent # tie attr installed everywhere
\&        };
.Ve
.PP
Autoties are most commonly used in the module to which they actually tie, 
and need to export their attributes to any module that calls them. To
facilitate this, Attribute::Handlers recognizes a special \*(L"pseudo\-class\*(R" \*(--
\&\f(CW\*(C`_\|_CALLER_\|_\*(C'\fR, which may be specified as the qualifier of an attribute:
.PP
.Vb 1
\&        package Tie::Me::Kangaroo:Down::Sport;
.Ve
.PP
.Vb 1
\&        use Attribute::Handlers autotie => { '__CALLER__::Roo' => __PACKAGE__ };
.Ve
.PP
This causes Attribute::Handlers to define the \f(CW\*(C`Roo\*(C'\fR attribute in the package
that imports the Tie::Me::Kangaroo:Down::Sport module.
.PP
Note that it is important to quote the _\|_CALLER_\|_::Roo identifier because
a bug in perl 5.8 will refuse to parse it and cause an unknown error.
.PP
\fIPassing the tied object to \f(CI\*(C`tie\*(C'\fI\fR
.IX Subsection "Passing the tied object to tie"
.PP
Occasionally it is important to pass a reference to the object being tied
to the \s-1TIESCALAR\s0, \s-1TIEHASH\s0, etc. that ties it. 
.PP
The \f(CW\*(C`autotie\*(C'\fR mechanism supports this too. The following code:
.PP
.Vb 2
\&        use Attribute::Handlers autotieref => { Selfish => Tie::Selfish };
\&        my $var : Selfish(@args);
.Ve
.PP
has the same effect as:
.PP
.Vb 1
\&        tie my $var, 'Tie::Selfish', @args;
.Ve
.PP
But when \f(CW"autotieref"\fR is used instead of \f(CW"autotie"\fR:
.PP
.Vb 2
\&        use Attribute::Handlers autotieref => { Selfish => Tie::Selfish };
\&        my $var : Selfish(@args);
.Ve
.PP
the effect is to pass the \f(CW\*(C`tie\*(C'\fR call an extra reference to the variable
being tied:
.PP
.Vb 1
\&        tie my $var, 'Tie::Selfish', \e$var, @args;
.Ve
.SH "EXAMPLES"
.IX Header "EXAMPLES"
If the class shown in \s-1SYNOPSIS\s0 were placed in the MyClass.pm
module, then the following code:
.PP
.Vb 2
\&        package main;
\&        use MyClass;
.Ve
.PP
.Vb 1
\&        my MyClass $slr :Good :Bad(1**1-1) :Omni(-vorous);
.Ve
.PP
.Vb 2
\&        package SomeOtherClass;
\&        use base MyClass;
.Ve
.PP
.Vb 1
\&        sub tent { 'acle' }
.Ve
.PP
.Vb 3
\&        sub fn :Ugly(sister) :Omni('po',tent()) {...}
\&        my @arr :Good :Omni(s/cie/nt/);
\&        my %hsh :Good(q/bye) :Omni(q/bus/);
.Ve
.PP
would cause the following handlers to be invoked:
.PP
.Vb 1
\&        # my MyClass $slr :Good :Bad(1**1-1) :Omni(-vorous);
.Ve
.PP
.Vb 7
\&        MyClass::Good:ATTR(SCALAR)( 'MyClass',          # class
\&                                    'LEXICAL',          # no typeglob
\&                                    \e$slr,              # referent
\&                                    'Good',             # attr name
\&                                    undef               # no attr data
\&                                    'CHECK',            # compiler phase
\&                                  );
.Ve
.PP
.Vb 7
\&        MyClass::Bad:ATTR(SCALAR)( 'MyClass',           # class
\&                                   'LEXICAL',           # no typeglob
\&                                   \e$slr,               # referent
\&                                   'Bad',               # attr name
\&                                   0                    # eval'd attr data
\&                                   'CHECK',             # compiler phase
\&                                 );
.Ve
.PP
.Vb 7
\&        MyClass::Omni:ATTR(SCALAR)( 'MyClass',          # class
\&                                    'LEXICAL',          # no typeglob
\&                                    \e$slr,              # referent
\&                                    'Omni',             # attr name
\&                                    '-vorous'           # eval'd attr data
\&                                    'CHECK',            # compiler phase
\&                                  );
.Ve
.PP
.Vb 1
\&        # sub fn :Ugly(sister) :Omni('po',tent()) {...}
.Ve
.PP
.Vb 7
\&        MyClass::UGLY:ATTR(CODE)( 'SomeOtherClass',     # class
\&                                  \e*SomeOtherClass::fn, # typeglob
\&                                  \e&SomeOtherClass::fn, # referent
\&                                  'Ugly',               # attr name
\&                                  'sister'              # eval'd attr data
\&                                  'CHECK',              # compiler phase
\&                                );
.Ve
.PP
.Vb 7
\&        MyClass::Omni:ATTR(CODE)( 'SomeOtherClass',     # class
\&                                  \e*SomeOtherClass::fn, # typeglob
\&                                  \e&SomeOtherClass::fn, # referent
\&                                  'Omni',               # attr name
\&                                  ['po','acle']         # eval'd attr data
\&                                  'CHECK',              # compiler phase
\&                                );
.Ve
.PP
.Vb 1
\&        # my @arr :Good :Omni(s/cie/nt/);
.Ve
.PP
.Vb 7
\&        MyClass::Good:ATTR(ARRAY)( 'SomeOtherClass',    # class
\&                                   'LEXICAL',           # no typeglob
\&                                   \e@arr,               # referent
\&                                   'Good',              # attr name
\&                                   undef                # no attr data
\&                                   'CHECK',             # compiler phase
\&                                 );
.Ve
.PP
.Vb 7
\&        MyClass::Omni:ATTR(ARRAY)( 'SomeOtherClass',    # class
\&                                   'LEXICAL',           # no typeglob
\&                                   \e@arr,               # referent
\&                                   'Omni',              # attr name
\&                                   ""                   # eval'd attr data 
\&                                   'CHECK',             # compiler phase
\&                                 );
.Ve
.PP
.Vb 1
\&        # my %hsh :Good(q/bye) :Omni(q/bus/);
.Ve
.PP
.Vb 7
\&        MyClass::Good:ATTR(HASH)( 'SomeOtherClass',     # class
\&                                  'LEXICAL',            # no typeglob
\&                                  \e%hsh,                # referent
\&                                  'Good',               # attr name
\&                                  'q/bye'               # raw attr data
\&                                  'CHECK',              # compiler phase
\&                                );
.Ve
.PP
.Vb 7
\&        MyClass::Omni:ATTR(HASH)( 'SomeOtherClass',     # class
\&                                  'LEXICAL',            # no typeglob
\&                                  \e%hsh,                # referent
\&                                  'Omni',               # attr name
\&                                  'bus'                 # eval'd attr data
\&                                  'CHECK',              # compiler phase
\&                                );
.Ve
.PP
Installing handlers into \s-1UNIVERSAL\s0, makes them...err..universal.
For example:
.PP
.Vb 2
\&        package Descriptions;
\&        use Attribute::Handlers;
.Ve
.PP
.Vb 2
\&        my %name;
\&        sub name { return $name{$_[2]}||*{$_[1]}{NAME} }
.Ve
.PP
.Vb 3
\&        sub UNIVERSAL::Name :ATTR {
\&                $name{$_[2]} = $_[4];
\&        }
.Ve
.PP
.Vb 3
\&        sub UNIVERSAL::Purpose :ATTR {
\&                print STDERR "Purpose of ", &name, " is $_[4]\en";
\&        }
.Ve
.PP
.Vb 3
\&        sub UNIVERSAL::Unit :ATTR {
\&                print STDERR &name, " measured in $_[4]\en";
\&        }
.Ve
.PP
Let's you write:
.PP
.Vb 1
\&        use Descriptions;
.Ve
.PP
.Vb 3
\&        my $capacity : Name(capacity)
\&                     : Purpose(to store max storage capacity for files)
\&                     : Unit(Gb);
.Ve
.PP
.Vb 1
\&        package Other;
.Ve
.PP
.Vb 1
\&        sub foo : Purpose(to foo all data before barring it) { }
.Ve
.PP
.Vb 1
\&        # etc.
.Ve
.SH "DIAGNOSTICS"
.IX Header "DIAGNOSTICS"
.ie n .IP """Bad attribute type: ATTR(%s)""" 4
.el .IP "\f(CWBad attribute type: ATTR(%s)\fR" 4
.IX Item "Bad attribute type: ATTR(%s)"
An attribute handler was specified with an \f(CW\*(C`:ATTR(\f(CIref_type\f(CW)\*(C'\fR, but the
type of referent it was defined to handle wasn't one of the five permitted:
\&\f(CW\*(C`SCALAR\*(C'\fR, \f(CW\*(C`ARRAY\*(C'\fR, \f(CW\*(C`HASH\*(C'\fR, \f(CW\*(C`CODE\*(C'\fR, or \f(CW\*(C`ANY\*(C'\fR.
.ie n .IP """Attribute handler %s doesn't handle %s attributes""" 4
.el .IP "\f(CWAttribute handler %s doesn't handle %s attributes\fR" 4
.IX Item "Attribute handler %s doesn't handle %s attributes"
A handler for attributes of the specified name \fIwas\fR defined, but not
for the specified type of declaration. Typically encountered whe trying
to apply a \f(CW\*(C`VAR\*(C'\fR attribute handler to a subroutine, or a \f(CW\*(C`SCALAR\*(C'\fR
attribute handler to some other type of variable.
.ie n .IP """Declaration of %s attribute in package %s may clash with future reserved word""" 4
.el .IP "\f(CWDeclaration of %s attribute in package %s may clash with future reserved word\fR" 4
.IX Item "Declaration of %s attribute in package %s may clash with future reserved word"
A handler for an attributes with an all-lowercase name was declared. An
attribute with an all-lowercase name might have a meaning to Perl
itself some day, even though most don't yet. Use a mixed-case attribute
name, instead.
.ie n .IP """Can't have two ATTR specifiers on one subroutine""" 4
.el .IP "\f(CWCan't have two ATTR specifiers on one subroutine\fR" 4
.IX Item "Can't have two ATTR specifiers on one subroutine"
You just can't, okay?
Instead, put all the specifications together with commas between them
in a single \f(CW\*(C`ATTR(\f(CIspecification\f(CW)\*(C'\fR.
.ie n .IP """Can't autotie a %s""" 4
.el .IP "\f(CWCan't autotie a %s\fR" 4
.IX Item "Can't autotie a %s"
You can only declare autoties for types \f(CW"SCALAR"\fR, \f(CW"ARRAY"\fR, and
\&\f(CW"HASH"\fR. They're the only things (apart from typeglobs \*(-- which are
not declarable) that Perl can tie.
.ie n .IP """Internal error: %s symbol went missing""" 4
.el .IP "\f(CWInternal error: %s symbol went missing\fR" 4
.IX Item "Internal error: %s symbol went missing"
Something is rotten in the state of the program. An attributed
subroutine ceased to exist between the point it was declared and the point
at which its attribute handler(s) would have been called.
.ie n .IP """Won't be able to apply END handler""" 4
.el .IP "\f(CWWon't be able to apply END handler\fR" 4
.IX Item "Won't be able to apply END handler"
You have defined an \s-1END\s0 handler for an attribute that is being applied
to a lexical variable.  Since the variable may not be available during \s-1END\s0
this won't happen.
.SH "AUTHOR"
.IX Header "AUTHOR"
Damian Conway (damian@conway.org)
.SH "BUGS"
.IX Header "BUGS"
There are undoubtedly serious bugs lurking somewhere in code this funky :\-)
Bug reports and other feedback are most welcome.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
.Vb 3
\&         Copyright (c) 2001, Damian Conway. All Rights Reserved.
\&       This module is free software. It may be used, redistributed
\&           and/or modified under the same terms as Perl itself.
.Ve

Creat By MiNi SheLL
Email: devilkiller@gmail.com