[htmltmpl] praise and suggestions
Brought to you by:
samtregar
From: Raful Mr M. H <RA...@us...> - 2006-09-07 18:48:22
|
All: I worked on a script that does lots of snmp queries via Apache and Perl. = I was using Mason. However, some of my Net::SNMP return values were = garbled. My assumption was it was the fact that embedded templating = uses a callback method. I rewrote everything in HTML::Template and = voilla! I'm thrilled. Now I need some feedback to see if I am taking = full advantage of mod_perl. Should I change any of the following: relevant piece from apache2.conf PerlModule Apache::DBI Alias /perl/ /usr/lib/cgi-bin/ PerlModule ModPerl::Registry <Location /perl/> SetHandler modperl PerlFixupHandler +Apache::DB PerlResponseHandler ModPerl::Registry Options +ExecCGI PerlOptions +GlobalRequest PerlSendHeader On Allow from all </Location> <Perl> use Carp </Perl> PerlPostConfigRequire /usr/local/lib/site_perl/Apache2/startup.pl relevant portion from sites-enabled/default (I am using Ubuntu.) <VirtualHost *> ServerAdmin webmaster@localhost DocumentRoot /home/mitch/www-dev/yanma ServerName yanmadev.usmc-mccs.org <Directory /home/mitch/www-dev/yanma> DirectoryIndex index.html AllowOverride None Order allow,deny allow from all </Directory> <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> <Location /perl> SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI Order allow,deny Allow from all=20 </Location> Finally startup.pl #!/usr/bin/perl use lib qw(/usr/local/lib/site_perl/Apache2); use HTML::Template; use File::Find; use ModPerl::Util; use ModPerl::Registry (); use Apache::DBI; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::RequestUtil (); use Apache2::ServerRec (); use Apache2::ServerUtil (); use Apache2::Connection (); use Apache2::Log (); use APR::Pool (); use APR::Table (); use Apache2::Const -compile =3D> ':common'; use APR::Const -compile =3D> ':common'; use Socket qw(:DEFAULT :crlf); use Net::SNMP; use Net::Ping; use Net::NBName; use DBI; use DBD::ODBC; Apache::DBI->connect_on_init( 'dbi:ODBC:MRIServer2k', '******', = '******', { PrintError =3D> 1, RaiseError =3D> 0, = AutoCommit =3D> 1 } ); print STDERR "Pre-loading HTML Template...\n"; find ( sub { return unless /\.tmpl$/; HTML::Template->new( filename =3D> "$File::Find::dir/$_", cache =3D> 1, ); }, '/home/mitch/www-dev/yanma/', ); 1; Thanks, Mitch Mitch Raful, MCSE CCNP Network Engineer HQMC MCCS 3044 Catlin Avenue Quantico, VA 22134 703-784-5991 "T'm Mitch Raful, and I approved this message."=20 |