NAME
My::Module::Recommend::Any - Recommend unless any of a list of modules is installed.
SYNOPSIS
use My::Module::Recommend::Any qw{ __any };
my $rec = __any( Fubar => <<'EOD' );
This module is needed to frozz a gaberbucket. If your
gaberbucket does not need frozzing you do not need this module.
EOD
print $rec->recommend();
DESCRIPTION
This module is private to this package, and may be changed or retracted without notice. Documentation is for the benefit of the author only.
This module checks whether any modules in given list are installed. If not, it is capable of generating an explanatory message.
I am using this rather than the usual install tools' recommendation machinery for greater flexibility, and because I personally have found their output rather Draconian, and my correspondance indicates that my users do too.
METHODS
This class supports the following methods which are private to this package and can be changed or retracted without notice.
new
my $rec = My::Module::Recommend::Any->new( Foo => "bar\n" );
This static method instantiates the object. The arguments are module names, of which at least one must be installed. The last argument, however, is text giving the reason you need one of the modules.
__any
my $rec = __any( Foo => "bar\n" );
This convenience subroutine (not method) wraps new(). It is not exported by default, but can be requested explicitly.
check
$rec->check()
and warn 'Modules are missing';
This method checks to see if any of the given modules are installed. The check is by eval "require $module_name; 1" on each module. If at least one of the modules are installed it returns nothing. If not, it returns the names of the missing modules in list context, and the number of missing modules in scalar context.
modules
say 'Optional modules: ', join ', ', $rec->modules();
This method just returns the names of the modules with which the object was initialized.
recommend
my $msg;
defined( $msg = $rec->recommend() )
and print $msg;
This method computes and returns a recommendation on modules to install. This will consist of a line of text listing the missing modules followed by the explanatory text with which the object was initialized. If no modules are needed it returns nothing.
SUPPORT
Support is by the author. Please file bug reports at https://rt.cpan.org/Public/Dist/Display.html?Name=Astro-SpaceTrack, https://github.com/trwyant/perl-Astro-SpaceTrack/issues/, or in electronic mail to the author.
AUTHOR
Tom Wyant (wyant at cpan dot org)
COPYRIGHT AND LICENSE
Copyright (C) 2016-2026 by Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the files LICENSE-Artistic and LICENSE-GPL.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.