Hammy has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I have a need to read Apache header variables. I have a SAML application that will set up a secure connection between my partner's Apache and my Apache. After a connection is made they will call my perl script. My Perl script's main objective is to read the Apache header variables and pass them on. I tried Apache::Registry, but I am not sure I understand how to use it. Can anyone tell me if I am going down the correct path?

Replies are listed 'Best First'.
Re: reading Apache header variables
by perrin (Chancellor) on Oct 05, 2007 at 02:16 UTC
    The first argument to an Apache::Registry script is a request object, usually called "$r", which will allow you to read the parsed headers. You could also write a module instead of a Registry script, since you're not porting existing CGI code here.
      Thank you, I have tried the code that was listed and I get the following errors when trying to start Apache.
      Fri Oct 05 03:08:03 2007] [error] Can't locate loadable object for mod +ule Apache::Constants in @INC (@INC contains: /usr/lib/perl5/site_per +l/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-l +inux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-mu +lti /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/p +erl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl +/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/li +b/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5 +/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_p +erl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i +386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-th +read-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi / +usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl +5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_per +l/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr +/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/li +b/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/p +erl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8. +8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 . /etc/httpd) at /usr/ +lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/mod_perl.pm line 14 +\nCompilation failed in require at /usr/lib/perl5/site_perl/5.8.8/i38 +6-linux-thread-multi/Apache.pm line 6.\nBEGIN failed--compilation abo +rted at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Apache +.pm line 6.\nCompilation failed in require at /usr/lib/perl5/site_per +l/5.8.8/i386-linux-thread-multi/Apache/Registry.pm line 2.\nBEGIN fai +led--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/i386-linux +-thread-multi/Apache/Registry.pm line 2.\nCompilation failed in requi +re at (eval 2) line 3.\n [Fri Oct 05 03:08:03 2007] [error] Can't load Perl module Apache::Regi +stry for server ca.thedialogcenter.com:0, exiting... Error invoking apachectl start command
      I tried to load Apache::Constants and it tells me it is up to date.

      I tried to use CPAN to install Apache::Request and I get many many errors. I am not sure how to handle the errors.

      Any suggestions would be greatly appreciated. Thanks.
        Yuu have a broken mod_perl install. It was probably not compiled with the perl that's on this system now. Or else you have some strange version. You should be using the latest version of mod_perl 2 with Apache 2, or the latest mod_perl 1 with Apache 1. I suggest you check which mod_perl you have and either recompile or install a different version. There are full instructions for installation on the mod_perl site: http://perl.apache.org/.