]> iEval git - app-musicexpo.git/commitdiff
Mark optional modules as "recommends"
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 22 Oct 2016 17:35:02 +0000 (18:35 +0100)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 22 Oct 2016 17:35:02 +0000 (18:35 +0100)
Makefile.PL
README

index 9cb29a95d908696544964a7c0bbf47bf1ef7c097..e5063e7e909b02ad00e79b2e4ec1baef1e22b085 100644 (file)
@@ -1,6 +1,30 @@
 use 5.014000;
 use ExtUtils::MakeMaker;
 
 use 5.014000;
 use ExtUtils::MakeMaker;
 
+my @optionals = (
+       qw/Audio::FLAC::Header           0
+          Audio::Opusfile               0
+          MP3::Info                     0
+          MP4::Info                     0
+          Ogg::Vorbis::Header::PurePerl 0/,
+);
+
+sub is_installed {
+       my ($module) = @_;
+       eval "require $module"
+}
+
+my @extra_prereqs;
+
+unless (grep \&is_installed, @optionals) {
+       my $answer = '';
+       while (!$answer) {
+               my $yn = lc prompt 'None of the optional dependencies are installed. Install all of them? (default: y) [y/n]', 'y';
+               $answer = $yn if $yn eq 'y' || $yn eq 'n';
+       }
+       @extra_prereqs = @optionals if $answer eq 'y';
+}
+
 WriteMakefile(
        NAME             => 'App::MusicExpo',
        VERSION_FROM     => 'lib/App/MusicExpo.pm',
 WriteMakefile(
        NAME             => 'App::MusicExpo',
        VERSION_FROM     => 'lib/App/MusicExpo.pm',
@@ -11,19 +35,16 @@ WriteMakefile(
        LICENSE          => 'perl',
        SIGN             => 1,
        PREREQ_PM        => {
        LICENSE          => 'perl',
        SIGN             => 1,
        PREREQ_PM        => {
-               qw/Audio::FLAC::Header           0
-                  Audio::Opusfile               0
-                  HTML::Template::Compiled      0
+               qw/HTML::Template::Compiled      0
                   Memoize                       0
                   Memoize                       0
-                  MP3::Info                     0
-                  MP4::Info                     0
-                  DB_File                       0
-                  Ogg::Vorbis::Header::PurePerl 0/,
+                  DB_File                       0/,
+               @extra_prereqs
        },
        META_MERGE         => {
        },
        META_MERGE         => {
-               dynamic_config => 0,
+               dynamic_config => 1,
                resources      => {
                        repository => 'http://git.ieval.ro/?p=app-musicexpo.git'
                },
                resources      => {
                        repository => 'http://git.ieval.ro/?p=app-musicexpo.git'
                },
+               recommends     => { @optionals },
        }
 );
        }
 );
diff --git a/README b/README
index 42debf7661badb152be03eba7a95a4c344650bf1..340e4d72c42e5f1c85b8c9e0c5b50cfa053efcc7 100644 (file)
--- a/README
+++ b/README
@@ -27,9 +27,14 @@ DEPENDENCIES
 
 This module requires these other modules and libraries:
 
 
 This module requires these other modules and libraries:
 
+  * HTML::Template::Compiled
+
+The following modules are optional; they determine the formats that
+can be read by MusicExpo. Be sure to install at least one of them,
+otherwise MusicExpo won't be able to do much!
+
   * Audio::FLAC::Header
   * Audio::Opusfile
   * Audio::FLAC::Header
   * Audio::Opusfile
-  * HTML::Template::Compiled
   * MP3::Info
   * MP4::Info
   * Ogg::Vorbis::Header::PurePerl
   * MP3::Info
   * MP4::Info
   * Ogg::Vorbis::Header::PurePerl
This page took 0.035738 seconds and 4 git commands to generate.