lib/Attribute/Handlers.pm Attribute::Handlers
lib/Attribute/Handlers/README Attribute::Handlers
lib/Attribute/Handlers/t/constants.t Test constants and Attribute::Handlers
+lib/Attribute/Handlers/t/data_convert.t Test attribute data conversion
lib/Attribute/Handlers/t/linerep.t See if Attribute::Handlers works
lib/Attribute/Handlers/t/multi.t See if Attribute::Handlers works
lib/attributes.pm For "sub foo : attrlist"
use warnings;
use strict;
use vars qw($VERSION $AUTOLOAD);
-$VERSION = '0.78_06';
+$VERSION = '0.78_07';
# $DB::single=1;
my %symcache;
my $sym = findsym($pkg, $ref);
$sym ||= $type eq 'CODE' ? 'ANON' : 'LEXICAL';
no warnings;
- my $evaled = !$raw && eval("package $pkg; no warnings;
+ my $evaled = !$raw && eval("package $pkg; no warnings; no strict;
local \$SIG{__WARN__}=sub{die}; [$data]");
$data = ($evaled && $data =~ /^\s*\[/) ? [$evaled]
: ($evaled) ? $evaled
--- /dev/null
+#!/usr/bin/perl -w
+
+# Test attribute data conversion using examples from the docs
+
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+}
+
+use Test::More tests => 8;
+
+package LoudDecl;
+use Attribute::Handlers;
+
+sub Loud :ATTR {
+ my ($package, $symbol, $referent, $attr, $data, $phase) = @_;
+
+ ::is_deeply( $data, $referent->(), *{$symbol}{NAME} );
+}
+
+
+sub test1 :Loud(till=>ears=>are=>bleeding) {
+ [qw(till ears are bleeding)]
+}
+
+sub test2 :Loud(['till','ears','are','bleeding']) {
+ [[qw(till ears are bleeding)]]
+}
+
+sub test3 :Loud(qw/till ears are bleeding/) {
+ [qw(till ears are bleeding)]
+}
+
+sub test4 :Loud(qw/my, ears, are, bleeding/) {
+ [('my,', 'ears,', 'are,', 'bleeding')]
+}
+
+sub test5 :Loud(till,ears,are,bleeding) {
+ [qw(till ears are bleeding)]
+}
+
+sub test6 :Loud(my,ears,are,bleeding) {
+ 'my,ears,are,bleeding';
+}
+
+sub test7 :Loud(qw/my ears are bleeding) {
+ 'qw/my ears are bleeding'; #'
+}
+
+sub test8 :Loud("turn it up to 11, man!") {
+ 'turn it up to 11, man!';
+}