File: Makefile.PL

package info (click to toggle)
libcache-cache-perl 1.08-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 332 kB
  • sloc: perl: 2,702; makefile: 5
file content (100 lines) | stat: -rw-r--r-- 2,273 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
use strict;
use ExtUtils::MakeMaker;

##
# Constants
##


my $NAME = 'Cache::Cache';
my $VERSION_FROM = 'lib/Cache/Cache.pm';
my $COMPRESS = 'gzip';
my $SUFFIX = '.gz';
my $DEFAULT_PREREQ_PM = {
                         'Digest::SHA' => '0',
                         'File::Spec' => '0.82',
                         'Storable' => '1.014',
                         'IPC::ShareLite' => '0.09',
                         'Error' => '0.15'
                        };

my @NON_IPC_TESTS = ( 't/1_test_cache_interface.t',
                      't/2_test_memory_cache.t',
                      't/3_test_file_cache.t',
                      't/5_test_size_aware_file_cache.t',
                      't/6_test_size_aware_memory_cache.t' );

##
# Main
##


Main( );


##
# Subroutines
##


sub Main
{
  my %options;

  $options{NAME} = $NAME;
  $options{VERSION_FROM} = $VERSION_FROM;
  $options{dist} = { COMPRESS => $COMPRESS, SUFFIX => $SUFFIX };
  $options{PREREQ_PM} = $DEFAULT_PREREQ_PM;

  if ( not Has_Module( 'IPC::ShareLite' ) )
  {
    Print_ShareLite_Missing_Message( );
    $options{test} = { TESTS => join( ' ', @NON_IPC_TESTS ) };
    delete $options{PREREQ_PM}->{'IPC::ShareLite'};
  }

  WriteMakefile( %options );

  Print_Make_Test_Message( );
}


sub Has_Module
{
  my ( $module ) = @_;

  print "Checking for $module... ";

  my $has_module = ( eval "require $module"  && ! $@ );

  print ( $has_module ? "found\n" : "not found\n" );

  return $has_module;
}


sub Print_ShareLite_Missing_Message
{
  print <<END

  NOTE: Your system does not seem to have IPC::ShareLite installed.
  This module is a prerequisite for the SharedMemoryCache
  implementations.  However, since it is not available on all
  platforms, the Cache::Cache module does not list it as an explicit
  dependency.  If you are able to build IPC::ShareLite (available on
  CPAN), please install it now and re run this Makefile.PL.
  Automatically disabling the tests for the SharedMemoryCache.

END
}


sub Print_Make_Test_Message
{
  print <<END
------------------------------------------------------------------
Please be patient while running "make test" as the full test suite
takes roughly two minutes to complete.
------------------------------------------------------------------
END
}