Too bad -l was already taken. Load the file that has the CPAN configuration data. Dump the configuration in the same format that CPAN. This is useful for checking the configuration as well as using the dump as a starting point for a new, custom configuration. A comma-separated list of mirrors to use for just this run. The -P option can find them for you automatically. Drop in the CPAN. This command does this automatically if you don't specify any arguments.
Turn on cpan warnings. This checks various things, like directory permissions, and tells you about problems you might have. Find close matches to the named modules that you think you might have mistyped. There are several components in CPAN. Using a manually compiled perl. Using perlbrew, creating "virtual environments". Toggle navigation Perl Maven. Standard output, standard error and command line redirection Warning when something goes wrong What does die do?
Unknown warnings category Can't use string Symbolic references in Perl Can't locate Can't locate object method " Useless use of hash element in void context Useless use of private variable in void context readline on closed filehandle in Perl Possible precedence issue with control flow operator Scalar value Formatted printing in Perl using printf and sprintf. Prev Next. Bundles simplify handling of sets of related modules.
See Bundles below. The package contains a session manager and a cache manager. The session manager keeps track of what has been fetched, built, and installed in the current session. The cache manager keeps track of the disk space occupied by the make processes and deletes excess space using a simple FIFO mechanism. Once at the command line, type h for one-page help screen; the rest should be self-explanatory.
The function call shell takes two optional arguments: one the prompt, the second the default initial command line the latter only works if a real ReadLine interface module is installed. There are corresponding one-letter commands a , b , d , and m for each of the four categories and another, i for any of the mentioned four.
Each of the four entities is implemented as a class with slightly differing methods for displaying an object. Arguments to these commands are either strings exactly matching the identification string of an object, or regular expressions matched case-insensitively against various attributes of the objects. The parser only recognizes a regular expression when you enclose it with slashes.
The principle is that the number of objects found influences how an item is displayed. The examples illustrate several aspects: the first three queries target modules, authors, or distros directly and yield exactly one result.
The last two use regular expressions and yield several results. The last one targets all of bundles, modules, authors, and distros simultaneously. When more than one result is available, they are printed in one-line format. These commands take any number of arguments and investigate what is necessary to perform the action. Argument processing is as follows:. If the argument is a distribution file name recognized by embedded slashes , it is processed.
If it is a module, CPAN determines the distribution file in which this module is included and processes that, following any dependencies named in the module's META.
If an argument is enclosed in slashes it is treated as a regular expression: it is expanded and if the result is a single object distribution, bundle or module , this object is processed.
CPAN checks whether an install is needed and prints module up to date if the distribution file containing the module doesn't need updating. CPAN also keeps track of what it has done within the current session and doesn't try to build a package a second time regardless of whether it succeeded or not.
It does not repeat a test run if the test has been run successfully before. Same for install runs. The force pragma may precede another command currently: get , make , test , or install to execute the command from scratch and attempt to continue past certain errors. See the section below on the force and the fforce pragma. Look gets and untars if not yet done the distribution file, changes to the appropriate directory and opens a subshell process in that directory.
The listing recurses into subdirectories. The last example is very slow and outputs extra progress indicators that break the alignment of the result. This may be regarded as a bug that may be changed in some future version. The failed command reports all distributions that failed on one of make , test or install for some reason in the currently running shell session.
The files contain a signature of the currently running perl version for later perusal. If the stored signature matches the currently running perl, the stored state is loaded into memory such that persistence between sessions is effectively established.
To speed things up in complex installation scenarios, CPAN. A get , a make , and an install are not repeated. A test is repeated only if the previous test was unsuccessful. The diagnostic message when CPAN. Another situation where CPAN refuses to act is an install if the corresponding test was not successful. In all these cases, the user can override this stubborn behaviour by prepending the command with the word force, for example:.
Batch jobs can run without a lockfile and not disturb each other. The shell offers to run in downgraded mode when another process is holding the lockfile. This is an experimental feature that is not yet tested very well. This second shell then does not write the history file, does not use the metadata file, and has a different prompt.
PL or perl Build. PL subprocess. If you enter the shell command, your input is split by the Text::ParseWords::shellwords routine, which acts like most shells do.
The first word is interpreted as the method to be invoked, and the rest of the words are treated as the method's arguments. Continuation lines are supported by ending a line with a literal backslash. Duplicates of each distribution are suppressed. The name of the bundle file is based on the current date and a counter, e. This commands provides a statistical overview over recent download activities. Install all distributions that have been tested successfully but have not yet been installed.
List all build directories of distributions that have been tested successfully but have not yet been installed. If called without argument, all potential upgrades are listed; if called with arguments the list is filtered to the modules and regexps given as arguments.
It suppresses duplicates in the column in CPAN file such that distributions with many upgradeable modules are listed only once. The recent command downloads a list of recent uploads to CPAN and displays them slowly. Note : This whole command currently is just a hack and will probably change in future versions of CPAN.
XS modules with 'force' in effect. The primary purpose of this command is to finish a network installation. Imagine you have a common source tree for two different architectures. You decide to do a completely independent fresh installation. You start on one architecture with the help of a Bundle file produced earlier. So you invoke CPAN's recompile on the second architecture and you're done. Another popular use for recompile is to act as a rescue in case your perl breaks binary compatibility.
The force pragma reruns the tests and repeats every step that might have failed before. You should never do this with your normal account and better have a dedicated well separated and secured machine to do this. The smoke command takes the list of recent uploads to CPAN as provided by the recent command and tests them all. The upgrade command first runs an r command with the given arguments and then installs the newest versions of all modules that were listed by that.
Although it may be considered internal, the class hierarchy does matter for both users and programmer. Classical single polymorphism is in effect. A metaclass object registers all objects of all kinds and indexes them with a string. The strings referencing objects have a separated namespace well, not completely separated :. Modules know their associated Distribution objects.
They always refer to the most recent official release. Developers may mark their releases as unstable development versions by inserting an underscore into the module version number which will also be reflected in the distribution name when you run 'make dist' , so the really hottest and newest distribution is not always the default. But if you would like to install version 1. Distribution objects are normally distributions from the CPAN, but there is a slightly degenerate case for Distribution objects, too, of projects held on the local disk.
These distribution objects have the same name as the local directory and end with a dot. A dot by itself is also allowed for the current directory at the time CPAN. All actions such as make , test , and install are applied directly to that directory. This gives the command cpan. It figures out which of the two mantras is appropriate, fetches and installs all prerequisites, takes care of them recursively, and finally finishes the installation of the module in the current directory, be it a CPAN module or not.
The typical usage case is for private modules or working copies of projects from remote repositories on the local disk. So piping to pager or redirecting output into a file works somewhat as in a normal shell, with the stipulation that you must type extra spaces. At run time, each listed plugin is instantiated as a singleton object by running the equivalent of this pseudo code:. The generated singletons are kept around from instantiation until the end of the shell session.
While the cpan shell is running, it checks all activated plugins at each of the 8 reference points listed above and runs the respective method if it is implemented for that object. When the CPAN module is used for the first time, a configuration dialogue tries to determine a couple of site specific options.
The mkmyconfig command writes this file for you. Displays the current value s for this config variable. Without KEY, displays all subcommands and config variables. If KEY starts and ends with a slash, the string in between is treated as a regular expression and only keys matching this regexp are displayed. The empty string can be specified as usual in shells, with '' or "".
Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Related 4. Hot Network Questions. Question feed.
0コメント