From: Sascha Blank (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-28750-
1197114466-1411.48355-75-0@perl.org>
p4raw-id: //depot/perl@32598
my $sym = findsym($pkg, $ref);
$sym ||= $type eq 'CODE' ? 'ANON' : 'LEXICAL';
no warnings;
- my $evaled = !$raw && eval("package $pkg; no warnings; no strict;
- local \$SIG{__WARN__}=sub{die}; [$data]");
- $data = $evaled unless $@;
+ if (!$raw && defined($data)) {
+ if ($data ne '') {
+ my $evaled = eval("package $pkg; no warnings; no strict;
+ local \$SIG{__WARN__}=sub{die}; [$data]");
+ $data = $evaled unless $@;
+ }
+ else { $data = undef }
+ }
$pkg->$handler($sym,
(ref $sym eq 'GLOB' ? *{$sym}{ref $ref}||$ref : $ref),
$attr,
require './test.pl';
}
-plan tests => 1;
+plan tests => 4;
# test for bug #38475: parsing errors with multiline attributes
::ok(0);
}
+sub CheckData :ATTR(RAWDATA) {
+ # check that the $data element contains the given attribute parameters.
+
+ if ($_[4] eq "12, 14") {
+ ::ok(1)
+ }
+ else {
+ ::ok(0)
+ }
+}
+
+sub CheckEmptyValue :ATTR() {
+ if (not defined $_[4]) {
+ ::ok(1)
+ }
+ else {
+ ::ok(0)
+ }
+}
+
package Deer;
use base 'Antler';
}
something();
+
+sub c :CheckData(12, 14) {};
+
+sub d1 :CheckEmptyValue() {};
+sub d2 :CheckEmptyValue {};