File Coverage

blib/lib/Math/Formula/Config.pm
Criterion Covered Total %
statement 21 23 91.3
branch 2 4 50.0
condition n/a
subroutine 8 10 80.0
pod 5 6 83.3
total 36 43 83.7


line stmt bran cond sub pod time code
1             # This code is part of Perl distribution Math-Formula version 0.18.
2             # The POD got stripped from this file by OODoc version 3.03.
3             # For contributors see file ChangeLog.
4              
5             # This software is copyright (c) 2023-2025 by Mark Overmeer.
6              
7             # This is free software; you can redistribute it and/or modify it under
8             # the same terms as the Perl 5 programming language system itself.
9             # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
10              
11             #oodist: *** DO NOT USE THIS VERSION FOR PRODUCTION ***
12             #oodist: This file contains OODoc-style documentation which will get stripped
13             #oodist: during its release in the distribution. You can use this file for
14             #oodist: testing, however the code of this development version may be broken!
15              
16             package Math::Formula::Config;{
17             our $VERSION = '0.18';
18             }
19              
20              
21 2     2   2493 use warnings;
  2         5  
  2         200  
22 2     2   15 use strict;
  2         6  
  2         136  
23              
24 2     2   17 use Log::Report qw/math-formula/;
  2         3  
  2         19  
25              
26 2     2   787 use File::Spec ();
  2         6  
  2         740  
27              
28             #--------------------
29              
30 1     1 1 2 sub new(%) { my $class = shift; (bless {}, $class)->init({@_}) }
  1         6  
31              
32             sub init($)
33 1     1 0 2 { my ($self, $args) = @_;
34             my $dir = $self->{MFC_dir} = $args->{directory}
35 1 50       21 or error __x"Save directory required";
36              
37 1 50       21 -d $dir
38             or error __x"Save directory '{dir}' does not exist", dir => $dir;
39              
40 1         3 $self;
41             }
42              
43             #--------------------
44              
45 3     3 1 71 sub directory { $_[0]->{MFC_dir} }
46              
47              
48             sub path_for($$)
49 3     3 1 7 { my ($self, $file) = @_;
50 3         29 File::Spec->catfile($self->directory, $file);
51             }
52              
53             #--------------------
54              
55 0     0 1   sub save($%) { ... }
56              
57              
58 0     0 1   sub load($%) { ... }
59              
60             1;