Setting Up CPAN

To install Perl modules using cpan, you need to configure it and install the necessary open source dependencies.

Follow these steps to set it up:

Prerequisites

Before setting up CPAN, ensure the following additional open source tools are installed:
  • wget
  • tar
  • bzip2
  • gzip

You can install wget, tar, gzip, and bzip2 from the zopen community.

Configuring CPAN

1. Initialize CPAN

Run the following command to enter the CPAN shell:

cpan

If this is the first time running CPAN, it will prompt for initial configuration. You can choose automatic configuration (press enter) unless you need custom settings.

If the current CPAN configuration is incorrect, reset it using:

rm -rf ~/.cpan
cpan

2. Set Up CPAN Configuration

If cpan detects the z/OS version of make and tar and fails the initial setup, then you can configure it to pick up the zopen tools with the following:

cpan
o conf make /path/to/oef/make
o conf tar /path/to/zopen/tar
# do the same for wget, gzip, and others as needed...
o conf commit

Verify that the ~/.cpan/CPAN/MyConfig.pm file is updated accordingly by viewing it.

3. Install Required Modules

Once CPAN is set up, install Perl modules as needed:

cpan install Switch

Troubleshooting

  • If CPAN fails due to missing dependencies, verify that wget, tar, make, gzip, and bzip2 are properly installed and referenced in the ~/.cpan/CPAN/MyConfig.pm file.
  • If CPAN configuration is incorrect, reset it using:
    rm -rf ~/.cpan
    Then re-run cpan to reconfigure.