| Filename | /Users/brian/bin/perls/cpan5.26.1 |
| Statements | Executed 3 statements in 25µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 537 | 6 | 4 | 3.55ms | 3.55ms | UNIVERSAL::isa (xsub) |
| 1 | 1 | 1 | 377µs | 377µs | main::CORE:pack (opcode) |
| 76 | 11 | 5 | 281µs | 281µs | UNIVERSAL::can (xsub) |
| 129 | 1 | 1 | 144µs | 144µs | mro::method_changed_in (xsub) |
| 129 | 1 | 1 | 137µs | 137µs | Internals::SvREADONLY (xsub) |
| 0 | 0 | 0 | 0s | 0s | main::BEGIN |
| 0 | 0 | 0 | 0s | 0s | main::RUNTIME |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 0 | 1 | 752µs | Profile data that couldn't be associated with a specific line: # spent 752µs making 1 call to CPAN::END | ||
| 1 | #!/usr/local/perls/perl-5.26.1/bin/perl | ||||
| 2 | 1 | 1µs | eval 'exec /usr/local/perls/perl-5.26.1/bin/perl -S $0 ${1+"$@"}' | ||
| 3 | if $running_under_some_shell; | ||||
| 4 | #!/usr/local/bin/perl | ||||
| 5 | |||||
| 6 | BEGIN { pop @INC if $INC[-1] eq '.' } | ||||
| 7 | use strict; | ||||
| 8 | use vars qw($VERSION); | ||||
| 9 | |||||
| 10 | use App::Cpan '1.64'; | ||||
| 11 | 1 | 2µs | $VERSION = '1.64'; | ||
| 12 | |||||
| 13 | 1 | 22µs | 1 | 119s | my $rc = App::Cpan->run( @ARGV ); # spent 119s making 1 call to App::Cpan::run |
| 14 | |||||
| 15 | # will this work under Strawberry Perl? | ||||
| 16 | exit( $rc || 0 ); | ||||
| 17 | |||||
| 18 | =head1 NAME | ||||
| 19 | |||||
| 20 | cpan - easily interact with CPAN from the command line | ||||
| 21 | |||||
| 22 | =head1 SYNOPSIS | ||||
| 23 | |||||
| 24 | # with arguments and no switches, installs specified modules | ||||
| 25 | cpan module_name [ module_name ... ] | ||||
| 26 | |||||
| 27 | # with switches, installs modules with extra behavior | ||||
| 28 | cpan [-cfFimtTw] module_name [ module_name ... ] | ||||
| 29 | |||||
| 30 | # use local::lib | ||||
| 31 | cpan -I module_name [ module_name ... ] | ||||
| 32 | |||||
| 33 | # one time mirror override for faster mirrors | ||||
| 34 | cpan -p ... | ||||
| 35 | |||||
| 36 | # with just the dot, install from the distribution in the | ||||
| 37 | # current directory | ||||
| 38 | cpan . | ||||
| 39 | |||||
| 40 | # without arguments, starts CPAN.pm shell | ||||
| 41 | cpan | ||||
| 42 | |||||
| 43 | # without arguments, but some switches | ||||
| 44 | cpan [-ahpruvACDLOPX] | ||||
| 45 | |||||
| 46 | =head1 DESCRIPTION | ||||
| 47 | |||||
| 48 | This script provides a command interface (not a shell) to CPAN. At the | ||||
| 49 | moment it uses CPAN.pm to do the work, but it is not a one-shot command | ||||
| 50 | runner for CPAN.pm. | ||||
| 51 | |||||
| 52 | =head2 Options | ||||
| 53 | |||||
| 54 | =over 4 | ||||
| 55 | |||||
| 56 | =item -a | ||||
| 57 | |||||
| 58 | Creates a CPAN.pm autobundle with CPAN::Shell->autobundle. | ||||
| 59 | |||||
| 60 | =item -A module [ module ... ] | ||||
| 61 | |||||
| 62 | Shows the primary maintainers for the specified modules. | ||||
| 63 | |||||
| 64 | =item -c module | ||||
| 65 | |||||
| 66 | Runs a `make clean` in the specified module's directories. | ||||
| 67 | |||||
| 68 | =item -C module [ module ... ] | ||||
| 69 | |||||
| 70 | Show the F<Changes> files for the specified modules | ||||
| 71 | |||||
| 72 | =item -D module [ module ... ] | ||||
| 73 | |||||
| 74 | Show the module details. This prints one line for each out-of-date module | ||||
| 75 | (meaning, modules locally installed but have newer versions on CPAN). | ||||
| 76 | Each line has three columns: module name, local version, and CPAN | ||||
| 77 | version. | ||||
| 78 | |||||
| 79 | =item -f | ||||
| 80 | |||||
| 81 | Force the specified action, when it normally would have failed. Use this | ||||
| 82 | to install a module even if its tests fail. When you use this option, | ||||
| 83 | -i is not optional for installing a module when you need to force it: | ||||
| 84 | |||||
| 85 | % cpan -f -i Module::Foo | ||||
| 86 | |||||
| 87 | =item -F | ||||
| 88 | |||||
| 89 | Turn off CPAN.pm's attempts to lock anything. You should be careful with | ||||
| 90 | this since you might end up with multiple scripts trying to muck in the | ||||
| 91 | same directory. This isn't so much of a concern if you're loading a special | ||||
| 92 | config with C<-j>, and that config sets up its own work directories. | ||||
| 93 | |||||
| 94 | =item -g module [ module ... ] | ||||
| 95 | |||||
| 96 | Downloads to the current directory the latest distribution of the module. | ||||
| 97 | |||||
| 98 | =item -G module [ module ... ] | ||||
| 99 | |||||
| 100 | UNIMPLEMENTED | ||||
| 101 | |||||
| 102 | Download to the current directory the latest distribution of the | ||||
| 103 | modules, unpack each distribution, and create a git repository for each | ||||
| 104 | distribution. | ||||
| 105 | |||||
| 106 | If you want this feature, check out Yanick Champoux's C<Git::CPAN::Patch> | ||||
| 107 | distribution. | ||||
| 108 | |||||
| 109 | =item -h | ||||
| 110 | |||||
| 111 | Print a help message and exit. When you specify C<-h>, it ignores all | ||||
| 112 | of the other options and arguments. | ||||
| 113 | |||||
| 114 | =item -i module [ module ... ] | ||||
| 115 | |||||
| 116 | Install the specified modules. With no other switches, this switch | ||||
| 117 | is implied. | ||||
| 118 | |||||
| 119 | =item -I | ||||
| 120 | |||||
| 121 | Load C<local::lib> (think like C<-I> for loading lib paths). Too bad | ||||
| 122 | C<-l> was already taken. | ||||
| 123 | |||||
| 124 | =item -j Config.pm | ||||
| 125 | |||||
| 126 | Load the file that has the CPAN configuration data. This should have the | ||||
| 127 | same format as the standard F<CPAN/Config.pm> file, which defines | ||||
| 128 | C<$CPAN::Config> as an anonymous hash. | ||||
| 129 | |||||
| 130 | =item -J | ||||
| 131 | |||||
| 132 | Dump the configuration in the same format that CPAN.pm uses. This is useful | ||||
| 133 | for checking the configuration as well as using the dump as a starting point | ||||
| 134 | for a new, custom configuration. | ||||
| 135 | |||||
| 136 | =item -l | ||||
| 137 | |||||
| 138 | List all installed modules with their versions | ||||
| 139 | |||||
| 140 | =item -L author [ author ... ] | ||||
| 141 | |||||
| 142 | List the modules by the specified authors. | ||||
| 143 | |||||
| 144 | =item -m | ||||
| 145 | |||||
| 146 | Make the specified modules. | ||||
| 147 | |||||
| 148 | =item -M mirror1,mirror2,... | ||||
| 149 | |||||
| 150 | A comma-separated list of mirrors to use for just this run. The C<-P> | ||||
| 151 | option can find them for you automatically. | ||||
| 152 | |||||
| 153 | =item -n | ||||
| 154 | |||||
| 155 | Do a dry run, but don't actually install anything. (unimplemented) | ||||
| 156 | |||||
| 157 | =item -O | ||||
| 158 | |||||
| 159 | Show the out-of-date modules. | ||||
| 160 | |||||
| 161 | =item -p | ||||
| 162 | |||||
| 163 | Ping the configured mirrors and print a report | ||||
| 164 | |||||
| 165 | =item -P | ||||
| 166 | |||||
| 167 | Find the best mirrors you could be using and use them for the current | ||||
| 168 | session. | ||||
| 169 | |||||
| 170 | =item -r | ||||
| 171 | |||||
| 172 | Recompiles dynamically loaded modules with CPAN::Shell->recompile. | ||||
| 173 | |||||
| 174 | =item -s | ||||
| 175 | |||||
| 176 | Drop in the CPAN.pm shell. This command does this automatically if you don't | ||||
| 177 | specify any arguments. | ||||
| 178 | |||||
| 179 | =item -t module [ module ... ] | ||||
| 180 | |||||
| 181 | Run a `make test` on the specified modules. | ||||
| 182 | |||||
| 183 | =item -T | ||||
| 184 | |||||
| 185 | Do not test modules. Simply install them. | ||||
| 186 | |||||
| 187 | =item -u | ||||
| 188 | |||||
| 189 | Upgrade all installed modules. Blindly doing this can really break things, | ||||
| 190 | so keep a backup. | ||||
| 191 | |||||
| 192 | =item -v | ||||
| 193 | |||||
| 194 | Print the script version and CPAN.pm version then exit. | ||||
| 195 | |||||
| 196 | =item -V | ||||
| 197 | |||||
| 198 | Print detailed information about the cpan client. | ||||
| 199 | |||||
| 200 | =item -w | ||||
| 201 | |||||
| 202 | UNIMPLEMENTED | ||||
| 203 | |||||
| 204 | Turn on cpan warnings. This checks various things, like directory permissions, | ||||
| 205 | and tells you about problems you might have. | ||||
| 206 | |||||
| 207 | =item -x module [ module ... ] | ||||
| 208 | |||||
| 209 | Find close matches to the named modules that you think you might have | ||||
| 210 | mistyped. This requires the optional installation of Text::Levenshtein or | ||||
| 211 | Text::Levenshtein::Damerau. | ||||
| 212 | |||||
| 213 | =item -X | ||||
| 214 | |||||
| 215 | Dump all the namespaces to standard output. | ||||
| 216 | |||||
| 217 | =back | ||||
| 218 | |||||
| 219 | =head2 Examples | ||||
| 220 | |||||
| 221 | # print a help message | ||||
| 222 | cpan -h | ||||
| 223 | |||||
| 224 | # print the version numbers | ||||
| 225 | cpan -v | ||||
| 226 | |||||
| 227 | # create an autobundle | ||||
| 228 | cpan -a | ||||
| 229 | |||||
| 230 | # recompile modules | ||||
| 231 | cpan -r | ||||
| 232 | |||||
| 233 | # upgrade all installed modules | ||||
| 234 | cpan -u | ||||
| 235 | |||||
| 236 | # install modules ( sole -i is optional ) | ||||
| 237 | cpan -i Netscape::Booksmarks Business::ISBN | ||||
| 238 | |||||
| 239 | # force install modules ( must use -i ) | ||||
| 240 | cpan -fi CGI::Minimal URI | ||||
| 241 | |||||
| 242 | # install modules but without testing them | ||||
| 243 | cpan -Ti CGI::Minimal URI | ||||
| 244 | |||||
| 245 | =head2 Environment variables | ||||
| 246 | |||||
| 247 | There are several components in CPAN.pm that use environment variables. | ||||
| 248 | The build tools, L<ExtUtils::MakeMaker> and L<Module::Build> use some, | ||||
| 249 | while others matter to the levels above them. Some of these are specified | ||||
| 250 | by the Perl Toolchain Gang: | ||||
| 251 | |||||
| 252 | Lancaster Concensus: L<https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md> | ||||
| 253 | |||||
| 254 | Oslo Concensus: L<https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/oslo-consensus.md> | ||||
| 255 | |||||
| 256 | =over 4 | ||||
| 257 | |||||
| 258 | =item NONINTERACTIVE_TESTING | ||||
| 259 | |||||
| 260 | Assume no one is paying attention and skips prompts for distributions | ||||
| 261 | that do that correctly. C<cpan(1)> sets this to C<1> unless it already | ||||
| 262 | has a value (even if that value is false). | ||||
| 263 | |||||
| 264 | =item PERL_MM_USE_DEFAULT | ||||
| 265 | |||||
| 266 | Use the default answer for a prompted questions. C<cpan(1)> sets this | ||||
| 267 | to C<1> unless it already has a value (even if that value is false). | ||||
| 268 | |||||
| 269 | =item CPAN_OPTS | ||||
| 270 | |||||
| 271 | As with C<PERL5OPTS>, a string of additional C<cpan(1)> options to | ||||
| 272 | add to those you specify on the command line. | ||||
| 273 | |||||
| 274 | =item CPANSCRIPT_LOGLEVEL | ||||
| 275 | |||||
| 276 | The log level to use, with either the embedded, minimal logger or | ||||
| 277 | L<Log::Log4perl> if it is installed. Possible values are the same as | ||||
| 278 | the C<Log::Log4perl> levels: C<TRACE>, C<DEBUG>, C<INFO>, C<WARN>, | ||||
| 279 | C<ERROR>, and C<FATAL>. The default is C<INFO>. | ||||
| 280 | |||||
| 281 | =item GIT_COMMAND | ||||
| 282 | |||||
| 283 | The path to the C<git> binary to use for the Git features. The default | ||||
| 284 | is C</usr/local/bin/git>. | ||||
| 285 | |||||
| 286 | =back | ||||
| 287 | |||||
| 288 | =head1 EXIT VALUES | ||||
| 289 | |||||
| 290 | The script exits with zero if it thinks that everything worked, or a | ||||
| 291 | positive number if it thinks that something failed. Note, however, that | ||||
| 292 | in some cases it has to divine a failure by the output of things it does | ||||
| 293 | not control. For now, the exit codes are vague: | ||||
| 294 | |||||
| 295 | 1 An unknown error | ||||
| 296 | |||||
| 297 | 2 The was an external problem | ||||
| 298 | |||||
| 299 | 4 There was an internal problem with the script | ||||
| 300 | |||||
| 301 | 8 A module failed to install | ||||
| 302 | |||||
| 303 | =head1 TO DO | ||||
| 304 | |||||
| 305 | * one shot configuration values from the command line | ||||
| 306 | |||||
| 307 | =head1 BUGS | ||||
| 308 | |||||
| 309 | * none noted | ||||
| 310 | |||||
| 311 | =head1 SEE ALSO | ||||
| 312 | |||||
| 313 | Most behaviour, including environment variables and configuration, | ||||
| 314 | comes directly from CPAN.pm. | ||||
| 315 | |||||
| 316 | =head1 SOURCE AVAILABILITY | ||||
| 317 | |||||
| 318 | This code is in Github in the CPAN.pm repository: | ||||
| 319 | |||||
| 320 | https://github.com/andk/cpanpm | ||||
| 321 | |||||
| 322 | The source used to be tracked separately in another GitHub repo, | ||||
| 323 | but the canonical source is now in the above repo. | ||||
| 324 | |||||
| 325 | =head1 CREDITS | ||||
| 326 | |||||
| 327 | Japheth Cleaver added the bits to allow a forced install (-f). | ||||
| 328 | |||||
| 329 | Jim Brandt suggest and provided the initial implementation for the | ||||
| 330 | up-to-date and Changes features. | ||||
| 331 | |||||
| 332 | Adam Kennedy pointed out that exit() causes problems on Windows | ||||
| 333 | where this script ends up with a .bat extension | ||||
| 334 | |||||
| 335 | =head1 AUTHOR | ||||
| 336 | |||||
| 337 | brian d foy, C<< <bdfoy@cpan.org> >> | ||||
| 338 | |||||
| 339 | =head1 COPYRIGHT | ||||
| 340 | |||||
| 341 | Copyright (c) 2001-2015, brian d foy, All Rights Reserved. | ||||
| 342 | |||||
| 343 | You may redistribute this under the same terms as Perl itself. | ||||
| 344 | |||||
| 345 | =cut | ||||
| 346 | |||||
| 347 | 1; | ||||
# spent 137µs within Internals::SvREADONLY which was called 129 times, avg 1µs/call:
# 129 times (137µs+0s) by constant::import at line 164 of constant.pm, avg 1µs/call | |||||
# spent 281µs within UNIVERSAL::can which was called 76 times, avg 4µs/call:
# 60 times (187µs+0s) by Archive::Tar::Constant::_list_consts at line 100 of Archive/Tar/Constant.pm, avg 3µs/call
# 4 times (19µs+0s) by CPAN::Shell::expand at line 1322 of CPAN/Shell.pm, avg 5µs/call
# 3 times (12µs+0s) by CPAN::shell at line 447 of CPAN.pm, avg 4µs/call
# 2 times (17µs+0s) by CPAN::FTP::_get_urllist at line 216 of CPAN/FTP.pm, avg 8µs/call
# once (14µs+0s) by CPAN::savehist at line 1332 of CPAN.pm
# once (8µs+0s) by CPAN::shell at line 305 of CPAN.pm
# once (6µs+0s) by CPAN::Shell::rematein at line 1869 of CPAN/Shell.pm
# once (6µs+0s) by CPAN::Module::rematein at line 487 of CPAN/Module.pm
# once (5µs+0s) by CPAN::shell at line 286 of CPAN.pm
# once (4µs+0s) by CPAN::Shell::rematein at line 1876 of CPAN/Shell.pm
# once (3µs+0s) by CPAN::Module::rematein at line 488 of CPAN/Module.pm | |||||
# spent 3.55ms within UNIVERSAL::isa which was called 537 times, avg 7µs/call:
# 500 times (3.45ms+0s) by File::Path::rmtree at line 250 of File/Path.pm, avg 7µs/call
# 27 times (72µs+0s) by IO::Compress::Base::Common::isaFilehandle at line 115 of IO/Compress/Base/Common.pm, avg 3µs/call
# 5 times (21µs+0s) by File::Path::mkpath at line 94 of File/Path.pm, avg 4µs/call
# 3 times (5µs+0s) by IO::Compress::Base::Common::isaFilename at line 129 of IO/Compress/Base/Common.pm, avg 2µs/call
# once (3µs+0s) by CPAN::Index::read_metadata_cache at line 577 of CPAN/Index.pm
# once (2µs+0s) by Safe::reval at line 358 of Safe.pm | |||||
# spent 377µs within main::CORE:pack which was called:
# once (377µs+0s) by IO::Compress::Gzip::BEGIN@15 at line 145 of IO/Compress/Gzip/Constants.pm | |||||
# spent 144µs within mro::method_changed_in which was called 129 times, avg 1µs/call:
# 129 times (144µs+0s) by constant::import at line 198 of constant.pm, avg 1µs/call |