You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by James Taylor <jt...@hatesville.com> on 2004/10/05 04:15:29 UTC
Mod Perl Helper Functions Library
Hi everyone, I'm running apache 1.3.x with the associated version of
mod_perl, but am having trouble creating regular old include
files to be used with helper functions. Works just great with regular
old CGI, mod_perl doesn't like it. Say for example I have two files,
main.pl and helper.pl.
Contents of helper.cgi are:
# helper.pl
sub dowhatever() { # this is completely pointless, i'm just using it
as an example
my %params=@_; my $p;
foreach my $k(sort keys %params) { $k =~ s/'$//g; $p.=$k; }
return $p;
}
1;
# main.pl
#!/usr/bin/perl
use strict;
use Apache::Constants qw(OK DECLINED SERVER_ERROR FORBIDDEN);
use Apache::Cookie ();
require('helper.pl');
#..............some stuff
my $q=&dowhatever(%somehash);
That doesn't work in the least, I keep getting errors in my apache logs
saying sub dowhatever is an undefined function, etc. Is it possible to
even do anything like this in mod_perl, or do I need to write an Apache
module / Perl Module just to have helper functions in there?
Also, I know it's poor style to put multiple statements on 1 line, I
just wanted to make this message shorter, so no style tips please.
Thanks for any help!
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html