File Coverage

blib/lib/Date/Transform/Extensions.pm
Criterion Covered Total %
statement 22 28 78.5
branch n/a
condition n/a
subroutine 7 9 77.7
pod 0 3 0.0
total 29 40 72.5


line stmt bran cond sub pod time code
1             package Date::Transform::Extensions;
2            
3 1     1   32 use 5.006;
  1         4  
  1         45  
4 1     1   6 use strict;
  1         2  
  1         40  
5 1     1   6 use warnings;
  1         2  
  1         37  
6 1     1   7 use Carp;
  1         2  
  1         68  
7            
8 1     1   6 use Tie::IxHash;
  1         10  
  1         38  
9            
10             require Exporter;
11 1     1   28 use AutoLoader qw(AUTOLOAD);
  1         3  
  1         7  
12             our @ISA = qw( Exporter );
13            
14             # Items to export into callers namespace by default. Note: do not export
15             # names by default without a very good reason. Use EXPORT_OK instead.
16             # Do not simply export all your public functions/methods/constants.
17            
18             # This allows declaration use Date::Manip::Transform ':all';
19             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
20             # will save memory.
21             our %EXPORT_TAGS = (
22             'all' => [
23             qw( Tie::IxHash::IndexFromKey Tie::IxHash::KeyFromIndex Tie::IxHash::ValueFromIndex )
24             ]
25             );
26             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
27            
28             our @EXPORT =
29             qw( Tie::IxHash::IndexFromKey Tie::IxHash::KeyFromIndex Tie::IxHash::ValueFromIndex);
30            
31             our $VERSION = '0.11';
32            
33             # Preloaded methods go here.
34            
35             ## SUBROUTINE: Tie::IxHash::IndexFromKey
36             ## Usage: ixhash_obj->IndexFromKey $key ) => $Index
37             ## Returns the index(position) of the key ,$key
38             sub Tie::IxHash::IndexFromKey {
39            
40 7     7 0 12 my $self = shift;
41 7         11 my $key = shift;
42            
43 7         20 my @indices = $self->Indices($key);
44            
45 7         79 return $indices[0];
46            
47             } # END SUBROUTINE: Tie::IxHash::Index
48            
49             ## SUBROUTINE: Tie::IxHash::KeyFromIndex
50             ## Usage: $ixhash_obj->KeyFromIndex( $Index ) = $key
51             ##
52             sub Tie::IxHash::KeyFromIndex {
53            
54 0     0 0   my $self = shift;
55 0           my $index = shift;
56            
57 0           return $self->[1]->[$index];
58            
59             } # END SUBROUTINE: tie::IxHash::KeyFromIndex
60            
61             ## SUBROUTINE: Tie::IxHash::ValueFromIndex
62             sub Tie::IxHash::ValueFromIndex {
63            
64 0     0 0   my $self = shift;
65 0           my $index = shift;
66            
67 0           return $self->FETCH( $self->[1]->[$index] );
68            
69             } # END SUBROUTINE: Tie::IxHash::ValueFromIndex
70            
71             ########
72            
73             1;
74            
75             __END__;