Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Using Perl 5.24 Red Hat Software Collection

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

    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

    • Debugging image mode with Red Hat OpenShift 4.20: A practical guide

    • EvalHub: Because "looks good to me" isn't a benchmark

    • SQL Server HA on RHEL: Meet Pacemaker HA Agent v2 (tech preview)

    • Deploy with confidence: Continuous integration and continuous delivery for agentic AI

    • Every layer counts: Defense in depth for AI agents with Red Hat AI

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.