homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

Perl CGI and C++
I want to run a C++ program through a perl webpage

 3:58 am on Aug 30, 2008 (gmt 0)

Hi there,

I am about to start a project for my Software Engineering class, a group project. We are looking at doing a web project but half of the team is c++ based. They are familiar with Java, but they prefer c++. So, what I want to know is if a perl page can be made to run a c++ program or not, and whether a c++ program can be made to return data and not just an exit response.

I'm most familiar with PHP and JSP, but I do have 2 books on Perl - one just on Perl and the other on Perl and CGI. I've never had a reason to use it though, so this is a good opportunity.

I am fairly certain it is, but just to check - is Perl run on the server side or client side? In my book I saw some compatibility issues. Though I think that was just a matter of what Operating System your running the script on, not the browser.




 5:22 am on Aug 30, 2008 (gmt 0)

Perl is server side.

You can execute non-perl / external programs and system commands on the server using:



and other methods.


 5:29 am on Aug 30, 2008 (gmt 0)

lexipixel is right - running external software with PERL is easy. Do not try to return data from C++, instead, print it to stdout - the data you send to stdout will then be accepted by PERL. Unfortunately it will be stringtype only; so your PERL script will have to parse the response into whatever types and arrays you expect.


 6:29 am on Aug 30, 2008 (gmt 0)

Thank you both for your informative responses, this will likely be we will be using then. I have to run it by them first of course though.


 7:29 am on Aug 30, 2008 (gmt 0)

if they know c++ they can comfortably program in a similar style with perl.
you can say pretty much the same thing about php and perl.
the learning curve to get started should be very flat for all of you.


 3:21 am on Aug 31, 2008 (gmt 0)

True, but I don't think they know HTML or CSS, so that would be an issue. But it looks like its going to be a fairly good sized project - so there shouldn't be a problem dividing it 5 ways so that everyone can do what they are familiar with.


 5:43 am on Aug 31, 2008 (gmt 0)

maybe you should divide it 5 ways so everybody learns something new...


 8:43 am on Aug 31, 2008 (gmt 0)

Not that I'm against it - but being realistic, I can't assume my classmates want to learn a whole new branch of programming. I would myself - but I'm not exactly ordinary (I've been programming since 6th grade). Also, it's not a good idea to split up a group project like this (the sole project of the class) so that everyone starts off not having any idea of what they are doing. I'll be learning Perl - but as mentioned it will be a fairly flat learning curve. Not that HTML or CSS would be a steep learning curve - but it is quite a bit to memorize, not to mention all of the techniques involved.

Also, I have 4 computer science courses, 1 photography class, 1 Hebrew class, and 2 Bowling Classes (Yea!) - I don't want to devote all my time to this project and I'm sure they don't either.


 10:32 am on Aug 31, 2008 (gmt 0)

Careful. If your examiner thinks like me, he'll mark you down severely if you didn't use the best tool for the job through not wanting to learn.


 11:17 am on Aug 31, 2008 (gmt 0)

Of course - I'm not going to go out of my way to use a language that isn't fit for the job. Hence I am personally looking at Perl rather than PHP or JSP. Of course, we haven't really sat down and talked about how were going to implement the program (or even finalized what were doing for that matter) - all I'm doing right now is looking at my options. Also, my instructor (from what I can tell) is mostly concerned with 1)Using the Software Engineering techniques discussed in class & 2)Participation. Participation is VERY important to him.


 11:24 am on Aug 31, 2008 (gmt 0)

csuguy, good point; however - if your other team members are using rather poor choices of programming language and forcing the PERL to do unnecessary extra parsing, that will reflect badly upon the whole team.


 1:26 pm on Aug 31, 2008 (gmt 0)

But will reflect very well on MY participation ;)

Your right though - we are definitely going to have to look at whether or not using c++ in the way I'm thinking is a good choice or not. Again, we haven't thought about implementation too much at this point. Hopefully I will be able to convince them to use Java, which would be the better choice for a web based project. Especially when the server supports JSP and Java Servlets.


 1:34 pm on Aug 31, 2008 (gmt 0)

This maybe off topic, but are you a professor vincevincevince? I get that sense from your post where you said you'd mark me down severly ;).

Anyways, if you are I'd like to know what you teach and the process you went through to get there. Maybe good to open a new topic or just send the sticky mails. I'd love to become a Professor of Computer Science (and more specifically of Graphics and Web Design/Programming).

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved