Linux command
carton 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Install dependencies from cpanfile
carton install
Update all dependencies
carton update
Run a command with local dependencies
carton exec [perl script.pl]
Run a Plack application with local dependencies
carton exec plackup [app.psgi]
Show installed modules
carton list
Show dependency tree
carton tree
Check if all dependencies are satisfied
carton check
Install exact versions from cpanfile.snapshot (deployment mode)
carton install --deployment
Install from cached archives (offline)
carton install --cached
Bundle dependencies into vendor/cache directory
carton bundle
说明
Carton is a Perl module dependency manager, similar to Bundler for Ruby or npm for Node.js. It manages project-specific dependencies defined in a cpanfile, installing them into a local directory isolated from the system Perl. Dependencies are specified in a cpanfile using a simple DSL. Running carton install creates a cpanfile.snapshot that locks exact versions, ensuring reproducible installations across environments. The carton exec command runs programs with the correct library paths set, avoiding conflicts with system Perl modules. This enables multiple projects with different dependency versions to coexist on the same system.
参数
- install
- Install dependencies specified in cpanfile.
- update _modules_
- Update dependencies to latest versions.
- exec _command_
- Execute command with local lib paths.
- list
- List installed modules.
- bundle
- Bundle dependencies into vendor/cache.
- check
- Verify dependencies are satisfied.
- tree
- Display dependency tree.
- --deployment
- Install exact versions from cpanfile.snapshot.
- --cached
- Install from cached archives (offline).
- --path _directory_
- Specify local lib directory (default: local/).
FAQ
What is the carton command used for?
Carton is a Perl module dependency manager, similar to Bundler for Ruby or npm for Node.js. It manages project-specific dependencies defined in a cpanfile, installing them into a local directory isolated from the system Perl. Dependencies are specified in a cpanfile using a simple DSL. Running carton install creates a cpanfile.snapshot that locks exact versions, ensuring reproducible installations across environments. The carton exec command runs programs with the correct library paths set, avoiding conflicts with system Perl modules. This enables multiple projects with different dependency versions to coexist on the same system.
How do I run a basic carton example?
Run `carton install` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does install do in carton?
Install dependencies specified in cpanfile.