MicroCosmoTalk Provides Perl
[0] Apache / mod_perl / Windows | Configure Apache | HTML Test
Linux SheBang | These Menus | Bibliography | Perl For A Penny? | Misc
MicroCosmoTalk
Contact MicroCosmoTalk
We need to figure out what that "PerlHandler ModPerl::Registry" line does. We did get Perl to work without that line, but that involved calling Perl.exe to run the script instead of running through the perl .dll's.
One of the very first lines in a Perl/mod_perl file that sends output as an HTML document must be...
print "Content-type: text/html\n\n";
Other server-side web languages do NOT require such and handle things in a different manner. Perl works in different ways and provides a variety of different advantages as well as disadvantages.
The Apache httdp.conf File
[1] Apache / mod_perl / Windows | Configure Apache | HTML Test
Linux SheBang | These Menus | Bibliography | Perl For A Penny? | Misc
So you want to know how? Insert the following lines into your httpd.conf file.
Color-coded as follows:
- # apache_comment
- apache1_directive
- apache2_directive
- perl_directive
Note We tried the Options +ExecCGI directive with the plus prefix and without. We noticed no difference in execution. We feel the plus aids in readability, but it also adds an extra byte (or more) to the size of httpd.conf.
# # We recommend using forward slashes in identifying paths # within httpd.conf. # # # PHP # LoadModule php5_module "C:/Program Files/php526/bin/php5apache2_2.dll" PHPIniDir "C:/Program Files/php" # # Perl 5.10 - change the line to perl58.dll if needed. # # The LoadFile MUST come BEFORE the LoadModule directive. # # LoadFile "C:/Program Files/ActiveState/Perl/bin/perl510.dll" LoadModule perl_module modules/mod_perl.so # # ... Other Apache directives ... # # # Finally, the PHP types and Perl types... # <IfModule alias_module> <IfModule mime_module> # PHP Types AddType application/x-httpd-php-source .phps AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml .phpt # Perl handlers / types <Files ~ "\.(cgi|pl|plx)$"> # # Next line commented out. # Does NOT work. Why? # # DefaultType text/html SetHandler perl-script Options +ExecCGI PerlHandler ModPerl::Registry PerlSendHeader On </Files> </IfModule> </IfModule>
Simple HTML Test Page
[2] Apache / mod_perl / Windows | Configure Apache | HTML Test
Linux SheBang | These Menus | Bibliography | Perl For A Penny? | Misc
Please note, that the following works when Apache gets configured properly for mod_perl on a Windows system. However, for Linux operating systems, you may need to include a shebang line.
## ## Simple HTML Test Page Presented Via mod_perl ## use strict; use warnings; print "Content-type: text/html\n\n"; print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\"> <head> <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\" /> <title>Simple Apache Server Test Page</title> </head> <body> <h1>Hello World</h1> <p>Welcome to the simple XHTML Apache Test Page Presented By Perl</p> <body></html> ";
The SheBang Line
[3] Apache / mod_perl / Windows | Configure Apache | HTML Test
Linux SheBang | These Menus | Bibliography | Perl For A Penny? | Misc
Linux operating systems (and some other OS, including Windows) require a shebang line sometimes as the first line of any Perl file.
#!perl.exe -w
We did get Windows to require the shebang. But with mod_perl running and processing the Perl source code, the requirement for the shebang line no longer exists. In the ways of Perl, we get rid of the shebang line when designing a web page to make a web page slightly smaller.
These Menus Are Written In Perl
[4] Apache / mod_perl / Windows | Configure Apache | HTML Test
Linux SheBang | These Menus | Bibliography | Perl For A Penny? | Misc
The original source code for these menus resides below. Things changed, and we did NOT update the code below, so if you notice some differences, you now know why.
sub print_menu {
# Index, Text, URI, LF
my @aMenus = (
[0, 'Apache / mod_perl / Windows', 'http://www.microcosmotalk.com/tech/mod_perl/', 0],
[1, 'Simple mod_perl HTML Test', '#simple_html_test_page', 0],
[2, 'Linux SheBang', '#shebang', 1],
[3, 'These Menus', '#these_menus', 0],
[4, 'Bibliography', '#bibliography', 0],
[5, 'Misc', '#misc', 0]
);
my $iNumberMenus = 5;
my $s1 = "<p class=\"pc\">"; # p init
my $s2 = " | "; # separator
my $s3 = "</p>\n"; # p terminator
my $sA1 = "<a href=\""; # <a href=" initializer
my $sA2 = "\">"; # "> terminator
my $sA3 = "</a>"; # </a> terminator
my $sA1T = "";
my $sA2T = "";
my $sA3T = "";
my $sBR = "";
my $i = 0;
my $iBR = 0;
my $sText = "";
my $sURI = "";
print $s1;
print "[" . @_[0] . "] ";
while ($i <= $iNumberMenus) {
$iBR = $aMenus[$i][3];
# if (@_[3] == 1) {
if ($iBR == 1) {
$s2 = "";
$sBR = "<br />\n";
} else {
$s2 = " | ";
$sBR = "";
}
if ($i == $iNumberMenus) { $s2 = ""; }
# current links
if (@_[0] == $i) {
$sText = $aMenus[$i][1];
$sURI = "";
$sA1T = $sURI;
$sA2T = $sURI;
$sA3T = $sURI;
} else {
$sText = $aMenus[$i][1];
$sURI = $aMenus[$i][2];
$sA1T = $sA1;
$sA2T = $sA2;
$sA3T = $sA3;
}
print $sA1T . $sURI . $sA2T . $sText . $sA3T . $s2 . $sBR;
$i++;
}
print $s3;
}
Bibliography
[5] Apache / mod_perl / Windows | Configure Apache | HTML Test
Linux SheBang | These Menus | Bibliography | Perl For A Penny? | Misc
Bibligraphy... the following links helped. We initially tried lines from httpd.conf files provided at the following links.
- Introduction To Mod_Perl http://perl.apache.org/
- Mod_Perl 2.0, Win32, Installation http://perl.apache.org/docs/2.0/os/win32/install.html
- Practical mod_perl by Eric Cholet and Stas Bekman http://modperlbook.org/
- Writing Apache Modules http://www.modperl.com/
- Apache HTTP Server http://httpd.apache.org/
We offer thanks to Phil Carmody, John Bokma, Eric Cholet and Stas Bekman. Thank you.
Books (Perl For 25 Cents?)
[6] Apache / mod_perl / Windows | Configure Apache | HTML Test
Linux SheBang | These Menus | Bibliography | Perl For A Penny? | Misc
Advertisements
[7] Apache / mod_perl / Windows | Configure Apache | HTML Test
Linux SheBang | These Menus | Bibliography | Perl For A Penny? | Misc
mod_perl Version
Perl Version => 5.010000
Humour
Like Sarah Palin?.
Obama Tee Shirts (Collectors Items?)
Obama Girl Supported Ralph Nader
Amber Lee Ettinger Supports Ralph Nader
The Obama girl, Amber Lee Ettinger, supporting Ralph Nader
Nice t-Shirts...
Nader Wants A Presidential Debates
Three Way Presidential Debate - Obama, McCain, and Nader
Nader Wants To Debate! Obama and McCain do not want Nader in the debates!
Tina Fey + Sarah Palin
Full Video, Sarah Palin + Tina Fey
Sarah Palin Booed
Nader Talks In West Virginia About Bailout
Ralph Nader On Wall Street Bailout

The Obama Girl
Wears A Ralph Nader T-Shirt
A rather odd country, the United States of America, run by a bunch of guys and gals that call themselves elephants and donkeys...
