File Coverage

blib/lib/Sub/DeferredPartial/Attributes.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition 1 3 33.3
subroutine 3 3 100.0
pod 0 1 0.0
total 18 21 85.7


line stmt bran cond sub pod time code
1             package Sub::DeferredPartial::Attributes;
2              
3             our $VERSION = '0.01';
4              
5             my %Subs = ();
6             # -----------------------------------------------------------------------------
7             sub import
8             # -----------------------------------------------------------------------------
9             {
10 2     2   4 my $class = shift;
11 2   33     7 my $caller = shift || caller;
12 2         4 my $isa = $caller . '::ISA';
13              
14 2         1705 push @$isa, $class;
15             }
16             # -----------------------------------------------------------------------------
17             sub MODIFY_CODE_ATTRIBUTES
18             # -----------------------------------------------------------------------------
19             {
20 1     1   3433 my $Pkg = shift;
21 1         2 my $Sub = shift;
22              
23 1         5 $Subs{$Sub} = [ @_ ];
24              
25 1         3 return ();
26             }
27             # -----------------------------------------------------------------------------
28             sub Hash
29             # -----------------------------------------------------------------------------
30             {
31 1     1 0 3 my $class = shift;
32 1         2 my $Sub = shift;
33 1         2 my %Atts;
34              
35 1         2 @Atts{@{$Subs{$Sub}}} = ();
  1         4  
36              
37 1         10 return \%Atts;
38             }
39             # -----------------------------------------------------------------------------
40             1;
41              
42             =head1 NAME
43              
44             Sub::DeferredPartial::Attributes - A simple subroutine attribute handler.
45              
46             =head1 AUTHOR
47              
48             Steffen Goeldner
49              
50             =head1 COPYRIGHT
51              
52             Copyright (c) 2004 Steffen Goeldner. All rights reserved.
53              
54             This program is free software; you can redistribute it and/or
55             modify it under the same terms as Perl itself.
56              
57             =cut