in reply to Re^6: Listing out the characters included in a character class [v5.38]
in thread Listing out the characters included in a character class
Looking at those errors, all the Prototype mismatch are for Test::More functions. Are you sure that Test::More is compatible with your mod_perl¹ environment? (I did a brief check that verified Test::More isn't immediately incompatible with a simple CGI² environment. But I have no experience with nor access to mod_perl, so I cannot give more details on mod_perl specifics.)
The Premature end of script headers is often seen when there's an error printed out before you've printed the headers. For that, I might recommend changing the order at the top of your script, and add a 'BEGIN' block to enforce headers before it includes other:
use strict; use warnings; BEGIN { $|=1; print "Content-Type:text/html; charset=utf-8\n"; print "Content-Language: utf8;\n\n"; } use lib '/'; use lib '/var/www/lib/'; #push @INC, '/var/www/lib/'; use RegexpCharClassesThai; #Regexp-CharClasses-Thai.pm use utf8; use Test::More;
Also, if you have access to CGI::Carp², try use CGI::Carp qw(fatalsToBrowser);, which might help by putting more info into the browser rather than buried in error logs.
Based on this sequence from your post (code then error message):
use RegexpCharClassesThai; #Regexp-CharClasses-Thai.pm ... my @inthai = &IsThaiLCons; ... Undefined subroutine &ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_tes +t_2d +thai_2dmod_2epl::IsThaiLCons called at /var/www/cgi/test-thai-mod.pl +line 19.
First, are you sure that RegexpCharClassesThai.pm exists, or is it really at the Regexp-CharClasses-Thai.pm that your comment implies? If the latter, you will need to make sure your use and your module naming match correctly.
Second, if it is loading the module properly, does the module export IsThaiLCons by default, or are you supposed to include it in an export list, like use RegexpCharClassesThai qw/IsThaiLCons/;?
Third: &subname is not the recommended syntax for function calls³. Why not just use my @inthai = IsThaiLCons; -- or, if you are like me and like an indication when something's a function without arguments, my @inthai = IsThaiLCons();?
¹: I assume that having ModPerl in the package hierarchy implies that you're in a mod_perl environment. I could easily be wrong about that.
²: not to be confused with CGI.pm, which I didn't include, nor did you -- this is to head off the people whose knee-jerk reaction to seeing the letters CGI is to say you shouldn't be using that any more.
³: Sorry, I cannot recall a reference for that off the top of my head, and I couldn't find it with a couple minutes of searching. Other monks will be able to point you to the dangers and arguments against calling a subroutine with the &sigil and no argument list.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Listing out the characters included in a character class [v5.38]
by Polyglot (Chaplain) on Oct 30, 2023 at 14:55 UTC | |
by hippo (Archbishop) on Oct 30, 2023 at 16:13 UTC |