File Coverage

blib/lib/Math/OEIS.pm
Criterion Covered Total %
statement 11 23 47.8
branch 0 4 0.0
condition n/a
subroutine 4 6 66.6
pod 2 2 100.0
total 17 35 48.5


line stmt bran cond sub pod time code
1             # Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020 Kevin Ryde
2              
3             # This file is part of Math-OEIS.
4             #
5             # Math-OEIS is free software; you can redistribute it and/or modify it
6             # under the terms of the GNU General Public License as published by the Free
7             # Software Foundation; either version 3, or (at your option) any later
8             # version.
9             #
10             # Math-OEIS is distributed in the hope that it will be useful, but
11             # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12             # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13             # for more details.
14             #
15             # You should have received a copy of the GNU General Public License along
16             # with Math-OEIS. If not, see .
17              
18             package Math::OEIS;
19 5     5   73305 use 5.006;
  5         29  
20 5     5   27 use strict;
  5         8  
  5         114  
21 5     5   26 use warnings;
  5         8  
  5         131  
22 5     5   24 use File::Spec;
  5         9  
  5         1024  
23              
24             our $VERSION = 15;
25              
26             sub local_directories {
27             # my ($class) = @_;
28             # {
29             # my $path = $ENV{'OEIS_PATH'};
30             # if (defined $path) {
31             # return split /:;/, $path;
32             # }
33             # }
34             {
35 0     0 1   require File::HomeDir;
  0            
36 0           my $dir = File::HomeDir->my_home;
37 0 0         if (defined $dir) {
38 0           return File::Spec->catdir($dir, 'OEIS');
39             }
40             }
41 0           return ();
42             }
43              
44             sub local_filename {
45 0     0 1   my ($class, $filename) = @_;
46 0           foreach my $dir ($class->local_directories) {
47 0           my $fullname = File::Spec->catfile ($dir, $filename);
48 0 0         if (-e $fullname) {
49 0           return $fullname;
50             }
51             }
52 0           return undef;
53             }
54              
55             # sub anum_to_remote_url {
56             # my ($anum) = @_;
57             # return "http://oeis.org/$anum/";
58             # }
59              
60              
61             1;
62             __END__