| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 2 |  |  | 2 |  | 43297 | use 5.016; | 
|  | 2 |  |  |  |  | 7 |  | 
| 2 | 2 |  |  | 2 |  | 11 | use strict; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 51 |  | 
| 3 | 2 |  |  | 2 |  | 11 | use warnings FATAL => 'all'; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 147 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | package Attribute::Universal; | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | # ABSTRACT: Install L directly into UNIVERSAL namespace | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 2 |  |  | 2 |  | 1839 | use Attribute::Handlers 0.99; | 
|  | 2 |  |  |  |  | 11205 |  | 
|  | 2 |  |  |  |  | 17 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | our $VERSION = '0.002';    # VERSION | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub import { | 
| 14 | 2 |  |  | 2 |  | 17 | my $class  = shift; | 
| 15 | 2 |  |  |  |  | 4 | my $caller = scalar caller; | 
| 16 | 2 |  |  |  |  | 11 | my %cfg    = @_; | 
| 17 | 2 |  |  |  |  | 8 | foreach my $name ( keys %cfg ) { | 
| 18 | 5 |  |  |  |  | 13 | my $cfg = uc( $cfg{$name} ); | 
| 19 |  |  |  |  |  |  | ## no critic | 
| 20 | 2 |  |  | 2 | 0 | 12 | eval qq{ | 
|  | 2 |  |  | 1 | 0 | 4 |  | 
|  | 2 |  |  | 1 | 0 | 9 |  | 
|  | 5 |  |  | 1 | 0 | 11176 |  | 
|  | 1 |  |  | 1 | 0 | 6 |  | 
|  | 1 |  |  | 1 |  | 2 |  | 
|  | 1 |  |  | 1 |  | 6 |  | 
|  | 1 |  |  | 1 |  | 842 |  | 
|  | 1 |  |  | 4 |  | 13 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 1997 |  | 
|  | 1 |  |  |  |  | 5 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 5 |  | 
|  | 1 |  |  |  |  | 5195 |  | 
|  | 5 |  |  |  |  | 432 |  | 
| 21 |  |  |  |  |  |  | sub UNIVERSAL::$name : ATTR($cfg) { | 
| 22 |  |  |  |  |  |  | goto &${caller}::ATTRIBUTE; | 
| 23 |  |  |  |  |  |  | } | 
| 24 |  |  |  |  |  |  | }; | 
| 25 |  |  |  |  |  |  | ## use critic | 
| 26 | 5 | 50 |  |  |  | 1413 | die "cannot install universal attribute $name in $caller: $@" if $@; | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub to_hash { | 
| 31 | 0 | 0 |  | 0 | 1 |  | shift if $_[0] eq __PACKAGE__; | 
| 32 | 0 |  |  |  |  |  | my ( $package, $symbol, $referent, $attribute, $payload, $phase, $file, | 
| 33 |  |  |  |  |  |  | $line ) | 
| 34 |  |  |  |  |  |  | = @_; | 
| 35 | 0 | 0 |  |  |  |  | my $label = ref($symbol) ? *{$symbol}{NAME} : undef; | 
|  | 0 |  |  |  |  |  |  | 
| 36 | 0 |  |  |  |  |  | my $type = ref $referent; | 
| 37 |  |  |  |  |  |  | return { | 
| 38 | 0 |  |  |  |  |  | package   => $package, | 
| 39 |  |  |  |  |  |  | symbol    => $symbol, | 
| 40 |  |  |  |  |  |  | referent  => $referent, | 
| 41 |  |  |  |  |  |  | attribute => $attribute, | 
| 42 |  |  |  |  |  |  | payload   => $payload, | 
| 43 |  |  |  |  |  |  | phase     => $phase, | 
| 44 |  |  |  |  |  |  | file      => $file, | 
| 45 |  |  |  |  |  |  | line      => $line, | 
| 46 |  |  |  |  |  |  | label     => $label, | 
| 47 |  |  |  |  |  |  | type      => $type, | 
| 48 |  |  |  |  |  |  | }; | 
| 49 |  |  |  |  |  |  | } | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | 1; | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | __END__ |