File Coverage

blib/lib/Decision/Depends.pm
Criterion Covered Total %
statement 23 26 88.4
branch 0 2 0.0
condition n/a
subroutine 9 10 90.0
pod 1 6 16.6
total 33 44 75.0


line stmt bran cond sub pod time code
1             # --8<--8<--8<--8<--
2             #
3             # Copyright (C) 2008 Smithsonian Astrophysical Observatory
4             #
5             # This file is part of Decision::Depends
6             #
7             # Decision-Depends is free software: you can redistribute it and/or modify
8             # it under the terms of the GNU General Public License as published by
9             # the Free Software Foundation, either version 3 of the License, or (at
10             # your option) any later version.
11             #
12             # This program is distributed in the hope that it will be useful,
13             # but WITHOUT ANY WARRANTY; without even the implied warranty of
14             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15             # GNU General Public License for more details.
16             #
17             # You should have received a copy of the GNU General Public License
18             # along with this program. If not, see .
19             #
20             # -->8-->8-->8-->8--
21              
22             package Decision::Depends;
23              
24             require 5.005_62;
25 11     11   346841 use strict;
  11         30  
  11         485  
26 11     11   63 use warnings;
  11         21  
  11         1617  
27              
28             require Exporter;
29              
30             our @ISA = qw(Exporter);
31              
32             # Items to export into callers namespace by default. Note: do not export
33             # names by default without a very good reason. Use EXPORT_OK instead.
34             # Do not simply export all your public functions/methods/constants.
35              
36             # This allows declaration use Decision::Depends ':all';
37             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
38             # will save memory.
39             our %EXPORT_TAGS = ( 'all' => [ qw(
40            
41             ) ] );
42              
43             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
44              
45             our @EXPORT = qw(
46             if_dep
47             action
48             test_dep
49             );
50              
51             our $VERSION = '0.20';
52              
53 11     11   66 use Carp;
  11         41  
  11         1253  
54 11     11   8182 use Decision::Depends::OO;
  11         35  
  11         4019  
55              
56             our $self = Decision::Depends::OO->new();
57              
58             ## no critic ( ProhibitSubroutinePrototypes )
59             sub if_dep(&@)
60             {
61 20     20 0 119 my ( $deps, $run ) = @_;
62 20         87 my @args = &$deps;
63              
64 20         315 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
65              
66 20         133 $self->if_dep( \@args, $run );
67             }
68              
69 20     20 0 30137 sub action(&) { $_[0] }
70              
71             sub test_dep
72             {
73 4     4 0 61923 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
74              
75 4         110 $self->test_dep( @_ );
76             }
77              
78             sub Configure
79             {
80 38     38 1 380690 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
81              
82 38         1958 $self->configure( @_ );
83             }
84              
85             sub init
86             {
87 0     0 0 0 my ( $state_file, $attr ) = @_;
88              
89 0         0 print STDERR "Decision::Depends::init is obsolete. Please use Decision::Depends::Configure instead\n";
90              
91 0 0       0 Configure( { File => $state_file, $attr ? %$attr : () } );
92             }
93              
94             sub renew
95             {
96 46     46 0 187296 undef $self;
97 46         1613 $self = Decision::Depends::OO->new();
98             }
99              
100             1;
101              
102             __END__