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::SHA1 => '2.02', 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 <