Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Using Perl 5.24 Red Hat Software Collection

January 23, 2017
Jitka Plesnikova
Related topics:
Linux
Related products:
Red Hat Enterprise Linux

Share:

    Red Hat Software Collection (RHSCL) 2.3 brings new rh-perl524 collection.

    It includes Perl 5.24.0, which provides a number of bug fixes and enhancements over the previously released rh-perl520 Software Collection. The details about the changes can be found in 5.22.0 perldelta and 5.24.0 perldelta. The new collection adds package rh-perl524-perl-App-cpanminus, which contains the cpanm utility for getting, extracting, building, and installing modules from the Comprehensive Perl Archive Network (CPAN) repository.

    RHSCL is distributed as a collection of RPM packages that can be installed, updated and uninstalled by using the standard package management tools or as a Docker image based on RHSCL.

    Using collection of RPM packages

    This way could be used on RHEL 6 and 7 systems

    To start using Perl 5.24 RHSCL, we have to install the rh-perl524 as root:

    # yum install rh-perl524

    Now we can verify the Perl version:

    # scl enable rh-perl524 'perl -v'
    This is perl 5, version 24, subversion 0 (v5.24.0)
    

    Now we create a Perl program that can be run from the command line:

    $ cat hello.pl
    #!/usr/bin/env perl
    print "Hello from Perl $^V\n";
    $ chmod +x hello.pl
    

    We can run the scripts by using scl enable:

    $ scl enable rh-perl524 './hello.pl'

    On the other hand, run shell session with a software collection as default and then run the script:

    $ scl enable rh-perl524 bash
    ./hello
    

    If we want to permanent enable a software collection in a development environment, then we add the following line to your ~/.bashrc:

    # Add Perl 5.24 from RHSCL to my login environment
    source scl_source enable rh-perl524
    

    After making the change, you should log out and log back in again.

    If we want to find additional Perl packages in RHSCL, run:

    $ yum list available rh-perl524-\*

    You can also see Red Hat Software Collection for more details.

    Using Perl 5.24 Docker image for deploying PSGI application

    This way can be used only for RHEL 7 servers.

    The basic idea is to combine the application code from Git tree and Red Hat’s rhscl/perl-524-rhel7 base image into an application image that will run the application in an environment. Your application can either be a simple Common Gateway Interface (CGI) script or a full-fledged Perl Web Server Gateway Interface (PSGI) application.

    First, we have to install docker and start the service:

    # yum install docker
    # systemctl start docker
    

    Then we download the rhscl/perl-524-rhel7 Docker image:

    # docker pull rhscl/perl-524-rhel7
    

    Now we can verify that the base image really contains Perl 5.24:

    # docker run --rm -ti rhscl/perl-524-rhel7 perl -v
    
    This is perl 5, version 24, subversion 0 (v5.24.0) built for x86_64-linux-thread-multi
     (with 29 registered patches, see perl -V for more detail)
    [...]
    

    For creating the application image, we will use s2i. The tool is provided by the source-to-image package, so install it:

    # yum install source-to-image

    Then we will need git tool for creating application repository, so we will install it:

    # yum install git

    We will begin with an empty Git repository:

    $ mkdir application
    $ cd application
    $ git init-db .
    Initialized empty Git repository in /root/application/.git/
    

    As an example application, we download application.psgi, which provides simple form. We need to declare the application dependencies. We will use a cpanfile for that. cpanfile for this example is here:

    If you haven’t yet configured your Git identity, you can do it now:

    $ git config --global user.email "developer@example.com"
    $ git config --global user.name "Developer"
    

    Then commit the sources into Git tree:

    $ git add application.psgi cpanfile
    $ git commit -m 'Simple application'
    [master (root-commit) 7d4cbc3] Simple application
    2 files changed, 2 insertions(+)
    create mode 100644 application.psgi
    create mode 100644 cpanfile
    

    Now we are ready to build our application image. The magic command to build an application from a base Docker image and a Git tree is:

    # s2i build file://$PWD rhscl/perl-524-rhel7 application
     ---> Installing application source ...
     ---> PSGI application found in ./application.psgi
     ---> Installing modules from cpanfile ...
     [...]
     <== Installed dependencies for .. Finishing.
     31 distributions installed
    

    The second argument is a URL to the Git tree with your application. We used a current working directory in this example. But you can use any remote location. For example a repository on the GitHub. The third argument is base Docker image identifier. We used the Red Hat’s Perl 5.24 RHSCL image. The last argument is a tag for the resulting application image.

    The application image was built successfully. And we can verify it in Docker images listing:

    # docker images
    REPOSITORY              TAG      IMAGE ID        CREATED           SIZE
    application             latest   75ec8cce098e    16 seconds ago    497.2 MB
    rhscl/perl-524-rhel7    latest   1c4d4f1b4d03    6 weeks ago       477 MB
    

    Now, we can run the application:

    # docker run --rm -ti application
    [Fri Jan 13 12:25:48.981151 2017] [so:warn] [pid 1] AH01574: module perl_module is already loaded, skipping
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
    

    And the application will be available on the reported IP address and TCP port 8080. You can use docker’s option -p to publish the container’s port 8080 on a different external port number.

    Finally, we can use a web browser to connect to the application and use it:

    There is an example of building the test application from the public GitHub sti-perl repository, underneath the 2.4/test/psi/ directory:

    # s2i build https://github.com/openshift/sti-perl.git --context-dir=5.24/test/psgi rhscl/perl-524-rhel7 perl-524-rhel7-psgi
    [...]
    ---> Installing application source ...
    ---> PSGI application found in ./application.psgi
    ---> Installing modules from cpanfile ...
    [...]
    <== Installed dependencies for .. Finishing.
    44 distributions installed
    

    The option --context-dir specifies sub-directory inside repository with application code.

    You can see Using Red Hat Software Collections Container Images for more details.


    Red Hat Software Collections are available for download, you can read more at Red Hat Software Collections. 


     

    Last updated: November 1, 2023

    Recent Posts

    • Storage considerations for OpenShift Virtualization

    • Upgrade from OpenShift Service Mesh 2.6 to 3.0 with Kiali

    • EE Builder with Ansible Automation Platform on OpenShift

    • How to debug confidential containers securely

    • Announcing self-service access to Red Hat Enterprise Linux for Business Developers

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue