Platform engineering ·
Where Perl Still Belongs Next to Kubernetes and OCI
By Manu Mathew, Technical Lead Engineer · Published 3 October 2026 · Last updated 5 October 2026

Many hosting platforms and business systems that have run for years were built in Perl and PHP. When the infrastructure around them moves to containers and cloud services, the question comes up quickly: does the Perl have to go too?
Usually not. Legacy Perl modernisation is mostly about the platform around the code, not the language. This post explains where Perl still belongs and what has to change for it to run well on a modern setup.
Quick answer
Perl still belongs wherever it runs reliably and the cost of rewriting outweighs the gain. A legacy Perl application can move onto a modern platform, such as containers on Kubernetes or Oracle Cloud (OCI), without a rewrite, as long as it has a repeatable build, configuration from the environment, logs on standard output and a health check.
Why not just rewrite old Perl code?
Because a rewrite throws away years of fixes for edge cases that nobody wrote down, and the risk lands on customers.
Replacing code for its own sake doesn’t make a migration. Replacing it where it blocks availability, testing or a cleaner boundary does. Most of the time, the better first step is to make the existing code easier to build, run and observe.
What does a Perl service need before it moves to containers?
The same things any service needs to run well on a platform like Kubernetes:
- A repeatable build: dependencies pinned in a
cpanfile, installed the same way in every image. - Configuration from the environment, not edited files on the server, as the twelve-factor app guidance describes.
- Logs written to standard output, so the platform can collect them.
- A health check the platform can call, such as a small status URL, used by Kubernetes liveness and readiness probes.
- Some automated tests, even a few, so changes during the move can be checked.
The container, the pipeline and the cloud infrastructure don’t require the application language to change. They do require the service to be predictable.
How can an old CGI application move step by step?
Keep it running the whole time, and move one piece at a time.
- Add tests around today’s behaviour, especially for the pages people use most.
- Run the existing scripts under a persistent Perl web server through PSGI, Perl’s standard interface between web servers and applications, using a CGI wrapper so the scripts themselves barely change.
- Move routes one at a time into a modern Perl framework such as Mojolicious or Dancer2, checking each against the tests.
- Package it as a container with the build, configuration, logging and health check described above.
- Retire the old entry points once nothing uses them.
This is the approach I take: small, reversible steps, with the application serving users between each one.
When is a rewrite the right call?
When the code can’t be changed safely any more, or a new requirement doesn’t fit its design. Even then, replace it gradually behind the same interface where you can.
What about the older Perl notes on this site?
Many of the Perl notes here date from 2013 onwards, from earlier practice. I have rewritten them with tested code, because the language questions are still useful, for example Perl arrays or DBI transactions. They describe the language, not my current job, which is internal tools and platform engineering at Newfold Digital.
Frequently asked questions
Can Perl run in Docker and Kubernetes?
Yes. A Perl application runs in a container like any other program: start from an official Perl image or a slim Linux base, install the modules it needs from a pinned list, and run it as a long-lived web service or as a scheduled job. Kubernetes then handles restarts, scaling and health checks.
How do I pin Perl module versions?
List the modules and minimum versions in a cpanfile, and install from it with Carton or cpanm, which can record the exact versions used. Build the container image from that file, so every environment runs the same modules rather than whatever was newest on the day.
Is Perl still maintained?
Yes. Perl 5 has a new stable release roughly once a year, with security fixes for recent versions, and CPAN continues to receive module updates. Older applications should move to a supported Perl version, which is usually a smaller job than a rewrite.
When is rewriting a Perl application the right choice?
When the code can no longer be changed safely, nobody can maintain it, or a new requirement doesn’t fit its design at all. Even then, a gradual replacement, one part at a time behind the same interface, is usually less risky than switching everything over in one go.
Related posts: what platform engineering owns; CI/CD and production troubleshooting; checking whether a Perl module is installed.
Need help with Perl code?
If you have Perl code that needs fixing, extending or upgrading, I’m happy to take a look. I work remotely from Kozhikode, Kerala, with teams across India and elsewhere; Perl development and maintenance explains how I help.
You can reach me through the contact section or email me at manu@manu.co.in. A few lines about the system and what you need is a good start.
Sources: The twelve-factor app: config; Kubernetes: liveness, readiness and startup probes; Oracle Cloud: Kubernetes Engine.