DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Why Tailwind CSS Can Be Used Instead of Bootstrap CSS
  • CORS Misconfigurations: The Simple API Header That Took Down Our Frontend
  • How Node.js Works Behind the Scenes (HTTP, Libuv, and Event Emitters)
  • Monorepo Development With React, Node.js, and PostgreSQL With Prisma and ClickHouse

Trending

  • Jakarta EE 11 and the Road Ahead With Jakarta EE 12
  • Beyond the Glass Slab: How AI Voice Assistants are Morphing Into Our Real-Life JARVIS
  • MCP Client Agent: Architecture and Implementation
  • Rust: The Must-Adopt Language for Modern Software Development
  1. DZone
  2. Coding
  3. JavaScript
  4. Perl in Node.js

Perl in Node.js

By 
Hemanth HM user avatar
Hemanth HM
·
Sep. 14, 12 · Interview
Likes (1)
Comment
Save
Tweet
Share
16.7K Views

Join the DZone community and get the full member experience.

Join For Free

Yes, Perl5 can be embedded in node.js! First of all, do a npm install perl. (P.S. node-perl requires a perl5 binary built with -fPIC and -Duseshrplib.) This is synchronous but useful embedded Perl5 for node.js. If you want to try any version of perl, you must check out perl-node.

#>git clone git://github.com/hideo55/node-perl.git
#>cd node-perl
#>node-waf configure
#>node-waf build
#>node-waf install

And then:

var Perl = require('perl').Perl();
var perl = new Perl();
 
perl.Run({
    opts : ["-Mfeature=say","-e","say 'Hello world'"]
}, function(out,err){
    console.log(out);
});
 
perl.Run({
    script : 'example.pl',
    args : ['foo', 'bar']
});

If you opted for Perl5:

var Perl = require('perl-simple').Perl;
var perl = new Perl();
var ret = perl.evaluate("reverse 'yoeman'");
console.log(ret); // => nameoy
 
var Perl = require('../index.js').Perl;
var perl = new Perl();
perl.use('LWP::UserAgent');
var ua = perl.getClass('LWP::UserAgent').new();
var res = ua.get('http://utf-8.jp/');
console.log(res.as_string());

Happy hacking!

Node.js Perl (programming language)

Published at DZone with permission of Hemanth HM, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Why Tailwind CSS Can Be Used Instead of Bootstrap CSS
  • CORS Misconfigurations: The Simple API Header That Took Down Our Frontend
  • How Node.js Works Behind the Scenes (HTTP, Libuv, and Event Emitters)
  • Monorepo Development With React, Node.js, and PostgreSQL With Prisma and ClickHouse

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: