my $sym = findsym($pkg, $ref);
$sym ||= $type eq 'CODE' ? 'ANON' : 'LEXICAL';
no warnings;
- if ($raw) {
- $data = [$data];
- }
- else {
- $data = !$raw && eval("package $pkg; no warnings; no strict;
- local \$SIG{__WARN__}=sub{die}; [$data]");
- if (my $error = $@) {
- $error =~ s{\s+ at \s+ \(eval \s+ \S+\) \s+ line \s+ \S+}{}x;
- die "Bad data for $attr attribute: $error\n";
- }
- }
+ my $evaled = !$raw && eval("package $pkg; no warnings; no strict;
+ local \$SIG{__WARN__}=sub{die}; [$data]");
+ $data = $evaled || [$data];
$pkg->$handler($sym,
(ref $sym eq 'GLOB' ? *{$sym}{ref $ref}||$ref : $ref),
$attr,
type of referent it was defined to handle wasn't one of the five permitted:
C<SCALAR>, C<ARRAY>, C<HASH>, C<CODE>, or C<ANY>.
-=item C<Bad data for %s attribute: %s>
-
-The data specified as part of the named attribute wasn't valid Perl.
-The error message indicates why it didn't compile.
-
=item C<Attribute handler %s doesn't handle %s attributes>
A handler for attributes of the specified name I<was> defined, but not
[qw(till ears are bleeding)]
}
-sub test6 :Loud("turn it up to 11, man!") {
- 'turn it up to 11, man!';
+sub test6 :Loud(my,ears,are,bleeding) {
+ 'my,ears,are,bleeding';
}
-::ok !defined eval q{
- sub test7 :Loud(my,ears,are,bleeding) {}
-}, 'test7';
+sub test7 :Loud(qw/my ears are bleeding) {
+ 'qw/my ears are bleeding'; #'
+}
-::ok !defined eval q{
- sub test8 :Loud(qw/my ears are bleeding) {}
-}, 'test8';
+sub test8 :Loud("turn it up to 11, man!") {
+ 'turn it up to 11, man!';
+}