1 package Attribute::Handlers;
10 my ($pkg, $ref, $type) = @_;
11 return $symcache{$pkg,$ref} if $symcache{$pkg,$ref};
14 foreach my $sym ( values %{$pkg."::"} ) {
15 return $symcache{$pkg,$ref} = \$sym
16 if *{$sym}{$type} && *{$sym}{$type} == $ref;
21 VAR => [qw[SCALAR ARRAY HASH]],
22 ANY => [qw[SCALAR ARRAY HASH CODE]],
23 "" => [qw[SCALAR ARRAY HASH CODE]],
24 SCALAR => [qw[SCALAR]],
33 my %sigil = (SCALAR=>'$', ARRAY=>'@', HASH=>'%');
41 my @global_phases = qw(BEGIN CHECK INIT END);
44 croak "Usage: use $_[0] autotie => {AttrName => TieClassName,...}";
47 my $qual_id = qr/^[_a-z]\w*(::[_a-z]\w*)*$/i;
51 return unless $class eq "Attribute::Handlers";
54 if ($cmd =~ /^autotie((?:ref)?)$/) {
55 my $tiedata = ($1 ? '$ref, ' : '') . '@$data';
57 _usage_AH_ $class unless ref($mapping) eq 'HASH';
58 while (my($attr, $tieclass) = each %$mapping) {
59 $tieclass =~ s/^([_a-z]\w*(::[_a-z]\w*)*)(.*)/$1/is;
61 _usage_AH_ $class unless $attr =~ $qual_id
62 && $tieclass =~ $qual_id
63 && eval "use base $tieclass; 1";
64 if ($tieclass->isa('Exporter')) {
65 local $Exporter::ExportLevel = 2;
66 $tieclass->import(eval $args);
68 $attr =~ s/__CALLER__/caller(1)/e;
69 $attr = caller()."::".$attr unless $attr =~ /::/;
71 sub $attr : ATTR(VAR) {
72 my (\$ref, \$data) = \@_[2,4];
73 my \$was_arrayref = ref \$data eq 'ARRAY';
74 \$data = [ \$data ] unless \$was_arrayref;
75 my \$type = ref(\$ref)||"value (".(\$ref||"<undef>").")";
76 (\$type eq 'SCALAR')? tie \$\$ref,'$tieclass',$tiedata
77 :(\$type eq 'ARRAY') ? tie \@\$ref,'$tieclass',$tiedata
78 :(\$type eq 'HASH') ? tie \%\$ref,'$tieclass',$tiedata
79 : die "Can't autotie a \$type\n"
81 } or die "Internal error: $@";
85 croak "Can't understand $_";
89 sub _resolve_lastattr {
90 return unless $lastattr{ref};
91 my $sym = findsym @lastattr{'pkg','ref'}
92 or die "Internal error: $lastattr{pkg} symbol went missing";
93 my $name = *{$sym}{NAME};
94 warn "Declaration of $name attribute in package $lastattr{pkg} may clash with future reserved word\n"
95 if $^W and $name !~ /[A-Z]/;
96 foreach ( @{$validtype{$lastattr{type}}} ) {
97 *{"$lastattr{pkg}::_ATTR_${_}_${name}"} = $lastattr{ref};
103 my ($class) = $AUTOLOAD =~ m/(.*)::/g;
104 $AUTOLOAD =~ m/_ATTR_(.*?)_(.*)/ or
105 croak "Can't locate class method '$AUTOLOAD' via package '$class'";
106 croak "Attribute handler '$2' doesn't handle $1 attributes";
111 my $builtin = qr/lvalue|method|locked|unique|shared/;
113 sub _gen_handler_AH_() {
116 my ($pkg, $ref, @attrs) = @_;
118 my ($attr, $data) = /^([a-z_]\w*)(?:[(](.*)[)])?$/is or next;
119 if ($attr eq 'ATTR') {
121 $raw{$ref} = $data =~ s/\s*,?\s*RAWDATA\s*,?\s*//;
122 $phase{$ref}{BEGIN} = 1
123 if $data =~ s/\s*,?\s*(BEGIN)\s*,?\s*//;
124 $phase{$ref}{INIT} = 1
125 if $data =~ s/\s*,?\s*(INIT)\s*,?\s*//;
126 $phase{$ref}{END} = 1
127 if $data =~ s/\s*,?\s*(END)\s*,?\s*//;
128 $phase{$ref}{CHECK} = 1
129 if $data =~ s/\s*,?\s*(CHECK)\s*,?\s*//
130 || ! keys %{$phase{$ref}};
131 # Added for cleanup to not pollute next call.
133 croak "Can't have two ATTR specifiers on one subroutine"
135 croak "Bad attribute type: ATTR($data)"
136 unless $validtype{$data};
137 %lastattr=(pkg=>$pkg,ref=>$ref,type=>$data);
141 my $handler = $pkg->can("_ATTR_${type}_${attr}");
142 next unless $handler;
143 my $decl = [$pkg, $ref, $attr, $data,
144 $raw{$handler}, $phase{$handler}];
145 foreach my $gphase (@global_phases) {
146 _apply_handler_AH_($decl,$gphase)
147 if $global_phases{$gphase} <= $global_phase;
149 if ($global_phase != 0) {
150 # if _gen_handler_AH_ is being called after
151 # CHECK it's for a lexical, so make sure
152 # it didn't want to run anything later
154 local $Carp::CarpLevel = 2;
155 carp "Won't be able to apply END handler"
156 if $phase{$handler}{END};
159 push @declarations, $decl
164 return grep {defined && !/$builtin/} @attrs;
168 *{"Attribute::Handlers::UNIVERSAL::MODIFY_${_}_ATTRIBUTES"} =
169 _gen_handler_AH_ foreach @{$validtype{ANY}};
170 push @UNIVERSAL::ISA, 'Attribute::Handlers::UNIVERSAL'
171 unless grep /^Attribute::Handlers::UNIVERSAL$/, @UNIVERSAL::ISA;
173 sub _apply_handler_AH_ {
174 my ($declaration, $phase) = @_;
175 my ($pkg, $ref, $attr, $data, $raw, $handlerphase) = @$declaration;
176 return unless $handlerphase->{$phase};
177 # print STDERR "Handling $attr on $ref in $phase with [$data]\n";
179 my $handler = "_ATTR_${type}_${attr}";
180 my $sym = findsym($pkg, $ref);
181 $sym ||= $type eq 'CODE' ? 'ANON' : 'LEXICAL';
183 my $evaled = !$raw && eval("package $pkg; no warnings;
184 local \$SIG{__WARN__}=sub{die}; [$data]");
185 $data = ($evaled && $data =~ /^\s*\[/) ? [$evaled]
186 : ($evaled) ? $evaled
189 (ref $sym eq 'GLOB' ? *{$sym}{ref $ref}||$ref : $ref),
191 (@$data>1? $data : $data->[0]),
202 _apply_handler_AH_($_,'CHECK') foreach @declarations;
207 _apply_handler_AH_($_,'INIT') foreach @declarations
211 END { $global_phase++; _apply_handler_AH_($_,'END') foreach @declarations }
218 Attribute::Handlers - Simpler definition of attribute handlers
222 This document describes version 0.78 of Attribute::Handlers,
223 released October 5, 2002.
229 use Attribute::Handlers;
230 no warnings 'redefine';
233 sub Good : ATTR(SCALAR) {
234 my ($package, $symbol, $referent, $attr, $data) = @_;
236 # Invoked for any scalar variable with a :Good attribute,
237 # provided the variable was declared in MyClass (or
238 # a derived class) or typed to MyClass.
240 # Do whatever to $referent here (executed in CHECK phase).
244 sub Bad : ATTR(SCALAR) {
245 # Invoked for any scalar variable with a :Bad attribute,
246 # provided the variable was declared in MyClass (or
247 # a derived class) or typed to MyClass.
251 sub Good : ATTR(ARRAY) {
252 # Invoked for any array variable with a :Good attribute,
253 # provided the variable was declared in MyClass (or
254 # a derived class) or typed to MyClass.
258 sub Good : ATTR(HASH) {
259 # Invoked for any hash variable with a :Good attribute,
260 # provided the variable was declared in MyClass (or
261 # a derived class) or typed to MyClass.
265 sub Ugly : ATTR(CODE) {
266 # Invoked for any subroutine declared in MyClass (or a
267 # derived class) with an :Ugly attribute.
272 # Invoked for any scalar, array, hash, or subroutine
273 # with an :Omni attribute, provided the variable or
274 # subroutine was declared in MyClass (or a derived class)
275 # or the variable was typed to MyClass.
276 # Use ref($_[2]) to determine what kind of referent it was.
281 use Attribute::Handlers autotie => { Cycle => Tie::Cycle };
283 my $next : Cycle(['A'..'Z']);
288 This module, when inherited by a package, allows that package's class to
289 define attribute handler subroutines for specific attributes. Variables
290 and subroutines subsequently defined in that package, or in packages
291 derived from that package may be given attributes with the same names as
292 the attribute handler subroutines, which will then be called in one of
293 the compilation phases (i.e. in a C<BEGIN>, C<CHECK>, C<INIT>, or C<END>
296 To create a handler, define it as a subroutine with the same name as
297 the desired attribute, and declare the subroutine itself with the
298 attribute C<:ATTR>. For example:
301 use Attribute::Handlers;
304 my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
307 *{$symbol}{NAME}, " ",
308 "($referent) ", "was just declared ",
309 "and ascribed the ${attr} attribute ",
310 "with data ($data)\n",
314 This creates a handler for the attribute C<:Loud> in the class LoudDecl.
315 Thereafter, any subroutine declared with a C<:Loud> attribute in the class
322 causes the above handler to be invoked, and passed:
328 the name of the package into which it was declared;
332 a reference to the symbol table entry (typeglob) containing the subroutine;
336 a reference to the subroutine;
340 the name of the attribute;
344 any data associated with that attribute;
348 the name of the phase in which the handler is being invoked.
352 Likewise, declaring any variables with the C<:Loud> attribute within the
361 will cause the handler to be called with a similar argument list (except,
362 of course, that C<$_[2]> will be a reference to the variable).
364 The package name argument will typically be the name of the class into
365 which the subroutine was declared, but it may also be the name of a derived
366 class (since handlers are inherited).
368 If a lexical variable is given an attribute, there is no symbol table to
369 which it belongs, so the symbol table argument (C<$_[1]>) is set to the
370 string C<'LEXICAL'> in that case. Likewise, ascribing an attribute to
371 an anonymous subroutine results in a symbol table argument of C<'ANON'>.
373 The data argument passes in the value (if any) associated with the
374 attribute. For example, if C<&foo> had been declared:
376 sub foo :Loud("turn it up to 11, man!") {...}
378 then the string C<"turn it up to 11, man!"> would be passed as the
381 Attribute::Handlers makes strenuous efforts to convert
382 the data argument (C<$_[4]>) to a useable form before passing it to
383 the handler (but see L<"Non-interpretive attribute handlers">).
384 For example, all of these:
386 sub foo :Loud(till=>ears=>are=>bleeding) {...}
387 sub foo :Loud(['till','ears','are','bleeding']) {...}
388 sub foo :Loud(qw/till ears are bleeding/) {...}
389 sub foo :Loud(qw/my, ears, are, bleeding/) {...}
390 sub foo :Loud(till,ears,are,bleeding) {...}
392 causes it to pass C<['till','ears','are','bleeding']> as the handler's
393 data argument. However, if the data can't be parsed as valid Perl, then
394 it is passed as an uninterpreted string. For example:
396 sub foo :Loud(my,ears,are,bleeding) {...}
397 sub foo :Loud(qw/my ears are bleeding) {...}
399 cause the strings C<'my,ears,are,bleeding'> and C<'qw/my ears are bleeding'>
400 respectively to be passed as the data argument.
402 If the attribute has only a single associated scalar data value, that value is
403 passed as a scalar. If multiple values are associated, they are passed as an
404 array reference. If no value is associated with the attribute, C<undef> is
408 =head2 Typed lexicals
410 Regardless of the package in which it is declared, if a lexical variable is
411 ascribed an attribute, the handler that is invoked is the one belonging to
412 the package to which it is typed. For example, the following declarations:
416 my LoudDecl $loudobj : Loud;
417 my LoudDecl @loudobjs : Loud;
418 my LoudDecl %loudobjex : Loud;
420 causes the LoudDecl::Loud handler to be invoked (even if OtherClass also
421 defines a handler for C<:Loud> attributes).
424 =head2 Type-specific attribute handlers
426 If an attribute handler is declared and the C<:ATTR> specifier is
427 given the name of a built-in type (C<SCALAR>, C<ARRAY>, C<HASH>, or C<CODE>),
428 the handler is only applied to declarations of that type. For example,
429 the following definition:
433 sub RealLoud :ATTR(SCALAR) { print "Yeeeeow!" }
435 creates an attribute handler that applies only to scalars:
441 my $metal : RealLoud; # invokes &LoudDecl::RealLoud
442 my @metal : RealLoud; # error: unknown attribute
443 my %metal : RealLoud; # error: unknown attribute
444 sub metal : RealLoud {...} # error: unknown attribute
446 You can, of course, declare separate handlers for these types as well
447 (but you'll need to specify C<no warnings 'redefine'> to do it quietly):
450 use Attribute::Handlers;
451 no warnings 'redefine';
453 sub RealLoud :ATTR(SCALAR) { print "Yeeeeow!" }
454 sub RealLoud :ATTR(ARRAY) { print "Urrrrrrrrrr!" }
455 sub RealLoud :ATTR(HASH) { print "Arrrrrgggghhhhhh!" }
456 sub RealLoud :ATTR(CODE) { croak "Real loud sub torpedoed" }
458 You can also explicitly indicate that a single handler is meant to be
459 used for all types of referents like so:
462 use Attribute::Handlers;
464 sub SeriousLoud :ATTR(ANY) { warn "Hearing loss imminent" }
466 (I.e. C<ATTR(ANY)> is a synonym for C<:ATTR>).
469 =head2 Non-interpretive attribute handlers
471 Occasionally the strenuous efforts Attribute::Handlers makes to convert
472 the data argument (C<$_[4]>) to a useable form before passing it to
473 the handler get in the way.
475 You can turn off that eagerness-to-help by declaring
476 an attribute handler with the keyword C<RAWDATA>. For example:
478 sub Raw : ATTR(RAWDATA) {...}
479 sub Nekkid : ATTR(SCALAR,RAWDATA) {...}
480 sub Au::Naturale : ATTR(RAWDATA,ANY) {...}
482 Then the handler makes absolutely no attempt to interpret the data it
483 receives and simply passes it as a string:
485 my $power : Raw(1..100); # handlers receives "1..100"
487 =head2 Phase-specific attribute handlers
489 By default, attribute handlers are called at the end of the compilation
490 phase (in a C<CHECK> block). This seems to be optimal in most cases because
491 most things that can be defined are defined by that point but nothing has
494 However, it is possible to set up attribute handlers that are called at
495 other points in the program's compilation or execution, by explicitly
496 stating the phase (or phases) in which you wish the attribute handler to
497 be called. For example:
499 sub Early :ATTR(SCALAR,BEGIN) {...}
500 sub Normal :ATTR(SCALAR,CHECK) {...}
501 sub Late :ATTR(SCALAR,INIT) {...}
502 sub Final :ATTR(SCALAR,END) {...}
503 sub Bookends :ATTR(SCALAR,BEGIN,END) {...}
505 As the last example indicates, a handler may be set up to be (re)called in
506 two or more phases. The phase name is passed as the handler's final argument.
508 Note that attribute handlers that are scheduled for the C<BEGIN> phase
509 are handled as soon as the attribute is detected (i.e. before any
510 subsequently defined C<BEGIN> blocks are executed).
513 =head2 Attributes as C<tie> interfaces
515 Attributes make an excellent and intuitive interface through which to tie
516 variables. For example:
518 use Attribute::Handlers;
521 sub UNIVERSAL::Cycle : ATTR(SCALAR) {
522 my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
523 $data = [ $data ] unless ref $data eq 'ARRAY';
524 tie $$referent, 'Tie::Cycle', $data;
531 my $next : Cycle('A'..'Z'); # $next is now a tied variable
537 Note that, because the C<Cycle> attribute receives its arguments in the
538 C<$data> variable, if the attribute is given a list of arguments, C<$data>
539 will consist of a single array reference; otherwise, it will consist of the
540 single argument directly. Since Tie::Cycle requires its cycling values to
541 be passed as an array reference, this means that we need to wrap
542 non-array-reference arguments in an array constructor:
544 $data = [ $data ] unless ref $data eq 'ARRAY';
546 Typically, however, things are the other way around: the tieable class expects
547 its arguments as a flattened list, so the attribute looks like:
549 sub UNIVERSAL::Cycle : ATTR(SCALAR) {
550 my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
551 my @data = ref $data eq 'ARRAY' ? @$data : $data;
552 tie $$referent, 'Tie::Whatever', @data;
556 This software pattern is so widely applicable that Attribute::Handlers
557 provides a way to automate it: specifying C<'autotie'> in the
558 C<use Attribute::Handlers> statement. So, the cycling example,
559 could also be written:
561 use Attribute::Handlers autotie => { Cycle => 'Tie::Cycle' };
567 my $next : Cycle(['A'..'Z']); # $next is now a tied variable
572 Note that we now have to pass the cycling values as an array reference,
573 since the C<autotie> mechanism passes C<tie> a list of arguments as a list
574 (as in the Tie::Whatever example), I<not> as an array reference (as in
575 the original Tie::Cycle example at the start of this section).
577 The argument after C<'autotie'> is a reference to a hash in which each key is
578 the name of an attribute to be created, and each value is the class to which
579 variables ascribed that attribute should be tied.
581 Note that there is no longer any need to import the Tie::Cycle module --
582 Attribute::Handlers takes care of that automagically. You can even pass
583 arguments to the module's C<import> subroutine, by appending them to the
584 class name. For example:
586 use Attribute::Handlers
587 autotie => { Dir => 'Tie::Dir qw(DIR_UNLINK)' };
589 If the attribute name is unqualified, the attribute is installed in the
590 current package. Otherwise it is installed in the qualifier's package:
594 use Attribute::Handlers autotie => {
595 Other::Good => Tie::SecureHash, # tie attr installed in Other::
596 Bad => Tie::Taxes, # tie attr installed in Here::
597 UNIVERSAL::Ugly => Software::Patent # tie attr installed everywhere
600 Autoties are most commonly used in the module to which they actually tie,
601 and need to export their attributes to any module that calls them. To
602 facilitate this, Attribute::Handlers recognizes a special "pseudo-class" --
603 C<__CALLER__>, which may be specified as the qualifier of an attribute:
605 package Tie::Me::Kangaroo:Down::Sport;
607 use Attribute::Handlers autotie => { '__CALLER__::Roo' => __PACKAGE__ };
609 This causes Attribute::Handlers to define the C<Roo> attribute in the package
610 that imports the Tie::Me::Kangaroo:Down::Sport module.
612 Note that it is important to quote the __CALLER__::Roo identifier because
613 a bug in perl 5.8 will refuse to parse it and cause an unknown error.
615 =head3 Passing the tied object to C<tie>
617 Occasionally it is important to pass a reference to the object being tied
618 to the TIESCALAR, TIEHASH, etc. that ties it.
620 The C<autotie> mechanism supports this too. The following code:
622 use Attribute::Handlers autotieref => { Selfish => Tie::Selfish };
623 my $var : Selfish(@args);
625 has the same effect as:
627 tie my $var, 'Tie::Selfish', @args;
629 But when C<"autotieref"> is used instead of C<"autotie">:
631 use Attribute::Handlers autotieref => { Selfish => Tie::Selfish };
632 my $var : Selfish(@args);
634 the effect is to pass the C<tie> call an extra reference to the variable
637 tie my $var, 'Tie::Selfish', \$var, @args;
643 If the class shown in L<SYNOPSIS> were placed in the MyClass.pm
644 module, then the following code:
649 my MyClass $slr :Good :Bad(1**1-1) :Omni(-vorous);
651 package SomeOtherClass;
656 sub fn :Ugly(sister) :Omni('po',tent()) {...}
657 my @arr :Good :Omni(s/cie/nt/);
658 my %hsh :Good(q/bye) :Omni(q/bus/);
661 would cause the following handlers to be invoked:
663 # my MyClass $slr :Good :Bad(1**1-1) :Omni(-vorous);
665 MyClass::Good:ATTR(SCALAR)( 'MyClass', # class
666 'LEXICAL', # no typeglob
670 'CHECK', # compiler phase
673 MyClass::Bad:ATTR(SCALAR)( 'MyClass', # class
674 'LEXICAL', # no typeglob
678 'CHECK', # compiler phase
681 MyClass::Omni:ATTR(SCALAR)( 'MyClass', # class
682 'LEXICAL', # no typeglob
685 '-vorous' # eval'd attr data
686 'CHECK', # compiler phase
690 # sub fn :Ugly(sister) :Omni('po',tent()) {...}
692 MyClass::UGLY:ATTR(CODE)( 'SomeOtherClass', # class
693 \*SomeOtherClass::fn, # typeglob
694 \&SomeOtherClass::fn, # referent
696 'sister' # eval'd attr data
697 'CHECK', # compiler phase
700 MyClass::Omni:ATTR(CODE)( 'SomeOtherClass', # class
701 \*SomeOtherClass::fn, # typeglob
702 \&SomeOtherClass::fn, # referent
704 ['po','acle'] # eval'd attr data
705 'CHECK', # compiler phase
709 # my @arr :Good :Omni(s/cie/nt/);
711 MyClass::Good:ATTR(ARRAY)( 'SomeOtherClass', # class
712 'LEXICAL', # no typeglob
716 'CHECK', # compiler phase
719 MyClass::Omni:ATTR(ARRAY)( 'SomeOtherClass', # class
720 'LEXICAL', # no typeglob
723 "" # eval'd attr data
724 'CHECK', # compiler phase
728 # my %hsh :Good(q/bye) :Omni(q/bus/);
730 MyClass::Good:ATTR(HASH)( 'SomeOtherClass', # class
731 'LEXICAL', # no typeglob
734 'q/bye' # raw attr data
735 'CHECK', # compiler phase
738 MyClass::Omni:ATTR(HASH)( 'SomeOtherClass', # class
739 'LEXICAL', # no typeglob
742 'bus' # eval'd attr data
743 'CHECK', # compiler phase
747 Installing handlers into UNIVERSAL, makes them...err..universal.
750 package Descriptions;
751 use Attribute::Handlers;
754 sub name { return $name{$_[2]}||*{$_[1]}{NAME} }
756 sub UNIVERSAL::Name :ATTR {
757 $name{$_[2]} = $_[4];
760 sub UNIVERSAL::Purpose :ATTR {
761 print STDERR "Purpose of ", &name, " is $_[4]\n";
764 sub UNIVERSAL::Unit :ATTR {
765 print STDERR &name, " measured in $_[4]\n";
772 my $capacity : Name(capacity)
773 : Purpose(to store max storage capacity for files)
779 sub foo : Purpose(to foo all data before barring it) { }
788 =item C<Bad attribute type: ATTR(%s)>
790 An attribute handler was specified with an C<:ATTR(I<ref_type>)>, but the
791 type of referent it was defined to handle wasn't one of the five permitted:
792 C<SCALAR>, C<ARRAY>, C<HASH>, C<CODE>, or C<ANY>.
794 =item C<Attribute handler %s doesn't handle %s attributes>
796 A handler for attributes of the specified name I<was> defined, but not
797 for the specified type of declaration. Typically encountered whe trying
798 to apply a C<VAR> attribute handler to a subroutine, or a C<SCALAR>
799 attribute handler to some other type of variable.
801 =item C<Declaration of %s attribute in package %s may clash with future reserved word>
803 A handler for an attributes with an all-lowercase name was declared. An
804 attribute with an all-lowercase name might have a meaning to Perl
805 itself some day, even though most don't yet. Use a mixed-case attribute
808 =item C<Can't have two ATTR specifiers on one subroutine>
810 You just can't, okay?
811 Instead, put all the specifications together with commas between them
812 in a single C<ATTR(I<specification>)>.
814 =item C<Can't autotie a %s>
816 You can only declare autoties for types C<"SCALAR">, C<"ARRAY">, and
817 C<"HASH">. They're the only things (apart from typeglobs -- which are
818 not declarable) that Perl can tie.
820 =item C<Internal error: %s symbol went missing>
822 Something is rotten in the state of the program. An attributed
823 subroutine ceased to exist between the point it was declared and the point
824 at which its attribute handler(s) would have been called.
826 =item C<Won't be able to apply END handler>
828 You have defined an END handler for an attribute that is being applied
829 to a lexical variable. Since the variable may not be available during END
836 Damian Conway (damian@conway.org)
840 There are undoubtedly serious bugs lurking somewhere in code this funky :-)
841 Bug reports and other feedback are most welcome.
845 Copyright (c) 2001, Damian Conway. All Rights Reserved.
846 This module is free software. It may be used, redistributed
847 and/or modified under the same terms as Perl itself.