Ninjakreborn Posted October 19, 2007 Share Posted October 19, 2007 #!d:/xampp/perl/bin/perl.exe # ^^^ this must be the first line of the script! ^^^ # start code # print header and start the markup output print 'hello'; # end code does not work (returns server error). #!d:/xampp/perl/bin/perl.exe # ^^^ this must be the first line of the script! ^^^ # start code use strict; use CGI; my $q = new CGI; # print header and start the markup output print $q->header( "text/html" ),$q->start_html( "hello from perl cgi!" ); print $q->h2("Hello World!"); print $q->end_html; # end code This works. Why do I have to do it OOP Like this instead of standard perl. I have downloaded activeperl from there website and modified my "apache" config files to do what they need to do (for pl and cgi files). Now that it's done. I have basically 3 questions. 1. What is the reason behind one form of coding working, and another not (as explained above). 2. What is the difference between Perl in CGI and Mod_perl. Are they inherently different, or does the syntax/functionality of them change. 3. Which one am I most likely to encounter during a standard development project, cgi mode, or Mod_perl in apache. There is also something in php called php perl, is this something else or just another form of mod_perl with the same syntax? Quote Link to comment https://forums.phpfreaks.com/topic/74009-solved-perl-not-working/ Share on other sites More sharing options...
effigy Posted October 20, 2007 Share Posted October 20, 2007 I have no idea why you're getting an error unless Apache requires you to use CGI. What does Apache's error log have to say about it? I've heard mod_perl is better; however, I've never used Perl with Apache, so you might want to ask your question at perlmonks.net. Quote Link to comment https://forums.phpfreaks.com/topic/74009-solved-perl-not-working/#findComment-373716 Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Author Share Posted October 20, 2007 I don't understand but it's doing it on both my server at 1and1 and my local machine. The normal one doesn't work the longer one does. Apache returns just header error when I am running the script. When I run it with all that OOP code it works fine. It is rather strange. Quote Link to comment https://forums.phpfreaks.com/topic/74009-solved-perl-not-working/#findComment-373956 Share on other sites More sharing options...
effigy Posted October 20, 2007 Share Posted October 20, 2007 Well the second bit of code you posted sends a header, so I'm assuming this is required. This could be a Perl thing, or an Apache configuration issue. I would use CGI; since it seems to handle much of the work for you. If want to go the other route, try sending a header. Quote Link to comment https://forums.phpfreaks.com/topic/74009-solved-perl-not-working/#findComment-374105 Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Author Share Posted October 20, 2007 The thing I am confused about is this standard programming. I have seen lot's of perl scripts without the stuff in that. I think that's what is confusing me about perl. Quote Link to comment https://forums.phpfreaks.com/topic/74009-solved-perl-not-working/#findComment-374296 Share on other sites More sharing options...
fenway Posted October 22, 2007 Share Posted October 22, 2007 effigy is right -- your comment says you're going to print a header, but you don't... the following should work. #!d:/xampp/perl/bin/perl.exe # ^^^ this must be the first line of the script! ^^^ # start code # print header and start the markup output print "Content-Type: text/html\n\n"; print 'hello'; # end code Quote Link to comment https://forums.phpfreaks.com/topic/74009-solved-perl-not-working/#findComment-375440 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.