summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-11-29 18:11:44 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-11-29 18:11:44 +0000
commit1313c7b1895233213fe08a385455594c773f4128 (patch)
tree69f992e28352b3488512f6fa5a0987ec1c1dc8b1 /lib
parent50a6311a5ab77e72a7604a53cacdd58ac5fba275 (diff)
downloadperl-1313c7b1895233213fe08a385455594c773f4128.tar.gz
Revert changes 32496 and 32497 (keep them for a next version
of Attribute::Handlers) p4raw-id: //depot/perl@32555
Diffstat (limited to 'lib')
-rw-r--r--lib/Attribute/Handlers.pm19
-rw-r--r--lib/Attribute/Handlers/t/data_convert.t16
2 files changed, 11 insertions, 24 deletions
diff --git a/lib/Attribute/Handlers.pm b/lib/Attribute/Handlers.pm
index 6c0efc58ed..aa4eada57d 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<ref_type>)>, but the
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
diff --git a/lib/Attribute/Handlers/t/data_convert.t b/lib/Attribute/Handlers/t/data_convert.t
index 14788c107e..b0c37c360d 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!';
+}