Current Path : /usr/opt/perl530/man/man3/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/perl530/man/man3/Module::Load::Conditional.3 |
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Module::Load::Conditional 3" .TH Module::Load::Conditional 3 "2019-10-24" "perl v5.30.2" "Perl Programmers Reference Guide" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Module::Load::Conditional \- Looking up module information / loading at runtime .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Module::Load::Conditional qw[can_load check_install requires]; \& \& \& my $use_list = { \& CPANPLUS => 0.05, \& LWP => 5.60, \& \*(AqTest::More\*(Aq => undef, \& }; \& \& print can_load( modules => $use_list ) \& ? \*(Aqall modules loaded successfully\*(Aq \& : \*(Aqfailed to load required modules\*(Aq; \& \& \& my $rv = check_install( module => \*(AqLWP\*(Aq, version => 5.60 ) \& or print \*(AqLWP is not installed!\*(Aq; \& \& print \*(AqLWP up to date\*(Aq if $rv\->{uptodate}; \& print "LWP version is $rv\->{version}\en"; \& print "LWP is installed as file $rv\->{file}\en"; \& \& \& print "LWP requires the following modules to be installed:\en"; \& print join "\en", requires(\*(AqLWP\*(Aq); \& \& ### allow M::L::C to peek in your %INC rather than just \& ### scanning @INC \& $Module::Load::Conditional::CHECK_INC_HASH = 1; \& \& ### reset the \*(Aqcan_load\*(Aq cache \& undef $Module::Load::Conditional::CACHE; \& \& ### don\*(Aqt have Module::Load::Conditional issue warnings \-\- \& ### default is \*(Aq1\*(Aq \& $Module::Load::Conditional::VERBOSE = 0; \& \& ### The last error that happened during a call to \*(Aqcan_load\*(Aq \& my $err = $Module::Load::Conditional::ERROR; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Module::Load::Conditional provides simple ways to query and possibly load any of the modules you have installed on your system during runtime. .PP It is able to load multiple modules at once or none at all if one of them was not able to load. It also takes care of any error checking and so forth. .SH "Methods" .IX Header "Methods" .ie n .SS "$href = check_install( module => \s-1NAME\s0 [, version => \s-1VERSION,\s0 verbose => \s-1BOOL\s0 ] );" .el .SS "\f(CW$href\fP = check_install( module => \s-1NAME\s0 [, version => \s-1VERSION,\s0 verbose => \s-1BOOL\s0 ] );" .IX Subsection "$href = check_install( module => NAME [, version => VERSION, verbose => BOOL ] );" \&\f(CW\*(C`check_install\*(C'\fR allows you to verify if a certain module is installed or not. You may call it with the following arguments: .IP "module" 4 .IX Item "module" The name of the module you wish to verify \*(-- this is a required key .IP "version" 4 .IX Item "version" The version this module needs to be \*(-- this is optional .IP "verbose" 4 .IX Item "verbose" Whether or not to be verbose about what it is doing \*(-- it will default to \f(CW$Module::Load::Conditional::VERBOSE\fR .PP It will return undef if it was not able to find where the module was installed, or a hash reference with the following keys if it was able to find the file: .IP "file" 4 .IX Item "file" Full path to the file that contains the module .IP "dir" 4 .IX Item "dir" Directory, or more exact the \f(CW@INC\fR entry, where the module was loaded from. .IP "version" 4 .IX Item "version" The version number of the installed module \- this will be \f(CW\*(C`undef\*(C'\fR if the module had no (or unparsable) version number, or if the variable \&\f(CW$Module::Load::Conditional::FIND_VERSION\fR was set to true. (See the \f(CW\*(C`GLOBAL VARIABLES\*(C'\fR section below for details) .IP "uptodate" 4 .IX Item "uptodate" A boolean value indicating whether or not the module was found to be at least the version you specified. If you did not specify a version, uptodate will always be true if the module was found. If no parsable version was found in the module, uptodate will also be true, since \f(CW\*(C`check_install\*(C'\fR had no way to verify clearly. .Sp See also \f(CW$Module::Load::Conditional::DEPRECATED\fR, which affects the outcome of this value. .ie n .SS "$bool = can_load( modules => { \s-1NAME\s0 => \s-1VERSION\s0 [,NAME => \s-1VERSION\s0] }, [verbose => \s-1BOOL,\s0 nocache => \s-1BOOL,\s0 autoload => \s-1BOOL\s0] )" .el .SS "\f(CW$bool\fP = can_load( modules => { \s-1NAME\s0 => \s-1VERSION\s0 [,NAME => \s-1VERSION\s0] }, [verbose => \s-1BOOL,\s0 nocache => \s-1BOOL,\s0 autoload => \s-1BOOL\s0] )" .IX Subsection "$bool = can_load( modules => { NAME => VERSION [,NAME => VERSION] }, [verbose => BOOL, nocache => BOOL, autoload => BOOL] )" \&\f(CW\*(C`can_load\*(C'\fR will take a list of modules, optionally with version numbers and determine if it is able to load them. If it can load *ALL* of them, it will. If one or more are unloadable, none will be loaded. .PP This is particularly useful if you have More Than One Way (tm) to solve a problem in a program, and only wish to continue down a path if all modules could be loaded, and not load them if they couldn't. .PP This function uses the \f(CW\*(C`load\*(C'\fR function or the \f(CW\*(C`autoload_remote\*(C'\fR function from Module::Load under the hood. .PP \&\f(CW\*(C`can_load\*(C'\fR takes the following arguments: .IP "modules" 4 .IX Item "modules" This is a hashref of module/version pairs. The version indicates the minimum version to load. If no version is provided, any version is assumed to be good enough. .IP "verbose" 4 .IX Item "verbose" This controls whether warnings should be printed if a module failed to load. The default is to use the value of \f(CW$Module::Load::Conditional::VERBOSE\fR. .IP "nocache" 4 .IX Item "nocache" \&\f(CW\*(C`can_load\*(C'\fR keeps its results in a cache, so it will not load the same module twice, nor will it attempt to load a module that has already failed to load before. By default, \f(CW\*(C`can_load\*(C'\fR will check its cache, but you can override that by setting \f(CW\*(C`nocache\*(C'\fR to true. .IP "autoload" 4 .IX Item "autoload" This controls whether imports the functions of a loaded modules to the caller package. The default is no importing any functions. .Sp See the \f(CW\*(C`autoload\*(C'\fR function and the \f(CW\*(C`autoload_remote\*(C'\fR function from Module::Load for details. .ie n .SS "@list = requires( \s-1MODULE\s0 );" .el .SS "\f(CW@list\fP = requires( \s-1MODULE\s0 );" .IX Subsection "@list = requires( MODULE );" \&\f(CW\*(C`requires\*(C'\fR can tell you what other modules a particular module requires. This is particularly useful when you're intending to write a module for public release and are listing its prerequisites. .PP \&\f(CW\*(C`requires\*(C'\fR takes but one argument: the name of a module. It will then first check if it can actually load this module, and return undef if it can't. Otherwise, it will return a list of modules and pragmas that would have been loaded on the module's behalf. .PP Note: The list \f(CW\*(C`require\*(C'\fR returns has originated from your current perl and your current install. .SH "Global Variables" .IX Header "Global Variables" The behaviour of Module::Load::Conditional can be altered by changing the following global variables: .ie n .SS "$Module::Load::Conditional::VERBOSE" .el .SS "\f(CW$Module::Load::Conditional::VERBOSE\fP" .IX Subsection "$Module::Load::Conditional::VERBOSE" This controls whether Module::Load::Conditional will issue warnings and explanations as to why certain things may have failed. If you set it to 0, Module::Load::Conditional will not output any warnings. The default is 0; .ie n .SS "$Module::Load::Conditional::FIND_VERSION" .el .SS "\f(CW$Module::Load::Conditional::FIND_VERSION\fP" .IX Subsection "$Module::Load::Conditional::FIND_VERSION" This controls whether Module::Load::Conditional will try to parse (and eval) the version from the module you're trying to load. .PP If you don't wish to do this, set this variable to \f(CW\*(C`false\*(C'\fR. Understand then that version comparisons are not possible, and Module::Load::Conditional can not tell you what module version you have installed. This may be desirable from a security or performance point of view. Note that \f(CW$FIND_VERSION\fR code runs safely under \f(CW\*(C`taint mode\*(C'\fR. .PP The default is 1; .ie n .SS "$Module::Load::Conditional::CHECK_INC_HASH" .el .SS "\f(CW$Module::Load::Conditional::CHECK_INC_HASH\fP" .IX Subsection "$Module::Load::Conditional::CHECK_INC_HASH" This controls whether \f(CW\*(C`Module::Load::Conditional\*(C'\fR checks your \&\f(CW%INC\fR hash to see if a module is available. By default, only \&\f(CW@INC\fR is scanned to see if a module is physically on your filesystem, or available via an \f(CW\*(C`@INC\-hook\*(C'\fR. Setting this variable to \f(CW\*(C`true\*(C'\fR will trust any entries in \f(CW%INC\fR and return them for you. .PP The default is 0; .ie n .SS "$Module::Load::Conditional::FORCE_SAFE_INC" .el .SS "\f(CW$Module::Load::Conditional::FORCE_SAFE_INC\fP" .IX Subsection "$Module::Load::Conditional::FORCE_SAFE_INC" This controls whether \f(CW\*(C`Module::Load::Conditional\*(C'\fR sanitises \f(CW@INC\fR by removing "\f(CW\*(C`.\*(C'\fR". The current default setting is \f(CW0\fR, but this may change in a future release. .ie n .SS "$Module::Load::Conditional::CACHE" .el .SS "\f(CW$Module::Load::Conditional::CACHE\fP" .IX Subsection "$Module::Load::Conditional::CACHE" This holds the cache of the \f(CW\*(C`can_load\*(C'\fR function. If you explicitly want to remove the current cache, you can set this variable to \&\f(CW\*(C`undef\*(C'\fR .ie n .SS "$Module::Load::Conditional::ERROR" .el .SS "\f(CW$Module::Load::Conditional::ERROR\fP" .IX Subsection "$Module::Load::Conditional::ERROR" This holds a string of the last error that happened during a call to \&\f(CW\*(C`can_load\*(C'\fR. It is useful to inspect this when \f(CW\*(C`can_load\*(C'\fR returns \&\f(CW\*(C`undef\*(C'\fR. .ie n .SS "$Module::Load::Conditional::DEPRECATED" .el .SS "\f(CW$Module::Load::Conditional::DEPRECATED\fP" .IX Subsection "$Module::Load::Conditional::DEPRECATED" This controls whether \f(CW\*(C`Module::Load::Conditional\*(C'\fR checks if a dual-life core module has been deprecated. If this is set to true \f(CW\*(C`check_install\*(C'\fR will return false to \f(CW\*(C`uptodate\*(C'\fR, if a dual-life module is found to be loaded from \f(CW$Config{privlibexp}\fR .PP The default is 0; .SH "See Also" .IX Header "See Also" \&\f(CW\*(C`Module::Load\*(C'\fR .SH "BUG REPORTS" .IX Header "BUG REPORTS" Please report bugs or other issues to <bug\-module\-load\-conditional@rt.cpan.org>. .SH "AUTHOR" .IX Header "AUTHOR" This module by Jos Boumans <kane@cpan.org>. .SH "COPYRIGHT" .IX Header "COPYRIGHT" This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.