ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I'm currently running a web mail application on my server thats written in perl and its a .cgi. My problem is that its slow cause everytime you hit the page it has to compile all of the stuff before it can show it to you. This is only a P233 and that takes a little time and its almost not even acceptable as a mail app because of this delay. Is there anyway to pre-compile the cgi script so that its faster?
according to the link above, perl has the ability to compile down to c code which you can then use to compile a native executable. depending on your version of perl or distro, you may have to download some extra modules. i really don't know. i'm on red hat 7.3 and it looks like i have perlcc. i hope that's what you're looking for.
I found that I have a perlcc and I ran it as such:
perlcc -o test.out index.cgi
And its been running for about 15 minutes now. I'm not sure if its totally perl code or not. I'm guessing that its not because if I run test.pl (that comes with apache) with apache it shows me what it should. Then if I type perl test.pl it shows me what I saw on the browser window when using apache. When I type perl index.cgi it just does the same thing that cat index.cgi would have done. Hopefully this helps someone solve this. Meanwhile as I type this message I'm STILL running the perlcc command. Index.cgi is only like 174k and some change... Should it really take this long to compile? Yea its a slow box but damn!
well, perlcc, from what i've read only creates the c source code. you have to compile your index.cgi (rename it first to like index.c) using cc. so you might have something like "cc -o index.cgi index.c". now the cgi will be executable.
pearlcc actuall was calling cc1 a few times here and there in its processing and I let it run till the system started thrashing and swapping everywhere. And the files it was generating were getting near 17gig before I stopped it. Is this supposed to happen? If so I'll bring them to a faster box to compile them and then bring them back.
I once tried to compile "hello, world" (if you don't know "hello, world", go read another forum) with perlcc. BIG MISTAKE. Maybe I was just doing it wrong or something, but it took about ten minutes to generate the .c files ... then it came time to compile. I pulled up gcc (I was running win2k with cygwin at the time) and tried to compile it, but only got a page full of error messages. So I went into the source ..... heed the Camel's advice and DON'T EVER LOOK AT THE SOURCE!!! You really will go blind. Well, that was my experiance with perlcc ...
It looks like whats happening is a relationship like this
APACHE<---CGI--->Mail Program / PERL<----POP3--->Qmail
So I'm guessing that CGI and perl are two separate things and thats why I can't just run it like "perl index.cgi".
Bear with me I'm kinda new to this. I dabble in applications programing but my main focus is in programming hardware in languages such as VHDL and Verilog and what not. I thought that CGI was something that could be implemented in C++ or Perl or whatever or is it like .NET where you can do it in many languages for the same assembly?
Mod_Perl sounds interesting and I'm willing to delve into it if I know that I can somehow just make it load the index.cgi that I currently have faster. If I have to recode it to work with this new technology I'll just find something else before I go into that.