From: Rafael Garcia-Suarez Date: Thu, 29 Nov 2007 18:11:44 +0000 (+0000) Subject: Revert changes 32496 and 32497 (keep them for a next version X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1313c7b1895233213fe08a385455594c773f4128;p=p5sagit%2Fp5-mst-13.2.git Revert changes 32496 and 32497 (keep them for a next version of Attribute::Handlers) p4raw-id: //depot/perl@32555 --- diff --git a/lib/Attribute/Handlers.pm b/lib/Attribute/Handlers.pm index 6c0efc5..aa4eada 100644 --- a/lib/Attribute/Handlers.pm +++ b/lib/Attribute/Handlers.pm @@ -190,17 +190,9 @@ sub _apply_handler_AH_ { 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, @@ -819,11 +811,6 @@ An attribute handler was specified with an C<:ATTR(I)>, but the type of referent it was defined to handle wasn't one of the five permitted: C, C, C, C, or C. -=item C - -The data specified as part of the named attribute wasn't valid Perl. -The error message indicates why it didn't compile. - =item C A handler for attributes of the specified name I defined, but not diff --git a/lib/Attribute/Handlers/t/data_convert.t b/lib/Attribute/Handlers/t/data_convert.t index 14788c1..b0c37c3 100644 --- a/lib/Attribute/Handlers/t/data_convert.t +++ b/lib/Attribute/Handlers/t/data_convert.t @@ -41,14 +41,14 @@ sub test5 :Loud(till,ears,are,bleeding) { [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!'; +}