Hi, Daniel. This error can happen even under regular Perl in some circumstances 
when a package redefines a core function ((like what importing Time::HiRes does 
here with time).

I would change "use Time::HiRes qw(time);" to "use Time::HiRes ();" and then 
change "time()" on line 13 to "Time::HiRes::time()." Does that make the message 
go away?

Even better would be to move or add "use Time::HiRes ();" to your startup.pl. I 
think it's generally a good idea (I want to say "best practice" even) to not 
import any functions or variables in your startup.pl, so I always add " ()" to 
my "use" statements there. You can then *usually* import specific functions 
with "use Whatever qw(func);" in your scripts. The problem here though is that 
the import is redefining the core function, and I think that can just be 
problematic.

I think the moral here is that ModPerl::PerlRun* is not a perfect drop-in 
replacement for a Perl CGI. With mod_perl, there's usually something you need 
to tweak (like how global variables and things like that) slightly in order to 
get it working as intended, but the changes are usually minor and make sense 
once you wrap your head around how mod_perl works.

Hope this helps!

Regards,
Ed

On May 14, 2021, at 9:36 AM, Daniel Ragle <dan...@biblestuph.com> wrote:
> I'm investigating short term solutions for site performance (long term is a 
> full rewrite of the app) and I'm working for the first time with 
> ModPerl::PerlRun (and ModPerl::PerlRunPrefork, both seem to exhibit the same 
> behavior) and feel like I'm missing something obvious.
> 
> I have this reduction (as test2.pl):
> 
> ####################
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> use Time::HiRes qw(time);
> 
> use CGI;
> my $cgi = CGI->new();
> 
> print $cgi->header();
> print "<h1>Hello World</h1>\n";
> print "<h1>HiRes time is: ", time(), "</h1>\n";
> #####################
> 
> The script runs properly as far as I can see, but I'm getting Prototype 
> Mismatch warnings in the log with each hit after the first one:
> 
> Prototype mismatch: sub 
> ModPerl::ROOT::ModPerl::PerlRunPrefork::var_www_test_test2_2epl::time: none 
> vs () at /var/www/test/test2.pl line 6.

Reply via email to