"... any help on this would be much appreciated."
That's nigh impossible without seeing /var/www/cgi/test-thai-mod.pl.
ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_test_2dthai_2dmod_2epl looks like a very unusual module name.
Perhaps a typo on "/var/www/cgi/test-thai-mod.pl line 24".
When you post test-thai-mod.pl,
the reason for showing Regexp::CharClasses::Thai on your scratchpad may become apparent:
without further information, it seems irrelevant.
| [reply] [d/l] [select] |
I uncommented some of the test lines in my script, which adds more error messages. First the script (which has be with "pre" tags due to using UTF8 characters):
#!/usr/bin/perl
#TEST THAI MODULE
use strict;
use warnings;
use lib '/';
use lib '/var/www/lib/';
#push @INC, '/var/www/lib/';
use RegexpCharClassesThai; #Regexp-CharClasses-Thai.pm
use utf8;
use Test::More;
$|=1;
print "Content-Type:text/html; charset=utf-8\n";
print "Content-Language: utf8;\n\n";
my @inthai = &IsThaiLCons;
my $sample = 'โมดูลนี้เป็นส่วนเสริมคำจำกัดความคลาสอักขระ';
my $part = $sample;
$part =~ s/\p{IsThaiHCons}/H/g;
print <<PAGE;
<html lang="utf8">
<body>
<h3>Checking the Thai module</h3>
PAGE
use_ok('RegexpCharClassesThai');
my $text = 'ข่าวนี้ได้แพร่สะพัดออกไปอย่างรวดเร็ว';
my $syllables = 0;
print "<p>Syllables: $syllables; $text\n";
print "<p>Syllables: $syllables; $text\n";
is( 'ก' =~ /\p{IsKokai}/,1,' Match for "ก" =~ /\p{IsKokai}/<br>');
is( 'ก' =~ /\p{InThai}/,1,' Match for "ก" =~ /\p{InThai}/<br>');
is( 'ก' =~ /\p{InThaiAlpha}/,1,' Match for "ก" =~ /\p{InThaiAlpha}/<br>');
is( 'ก' =~ /\p{InThaiCons}/,1,' Match for "ก" =~ /\p{InThaiCons}/<br>');
isnt( 'ก' =~ /\p{InThaiHCons}/,1,' No match for "ก" =~ /\p{InThaiHCons}/<br>');
is( 'ก' =~ /\p{InThaiMCons}/,1,' Match for "ก" =~ /\p{InThaiMCons}/<br>');
isnt( 'ก' =~ /\p{InThaiLCons}/,1,' No match for "ก" =~ /\p{InThaiLCons}/<br>');
isnt( 'ก' =~ /\p{InThaiDigit}/,1,' No match for "ก" =~ /\p{InThaiDigit}/<br>');
isnt( 'ก' =~ /\p{InThaiTone}/,1,' No match for "ก" =~ /\p{InThaiTone}/<br>');
isnt( 'ก' =~ /\p{InThaiVowel}/,1,' No match for "ก" =~ /\p{InThaiVowel}/<br>');
isnt( 'ก' =~ /\p{InThaiCompVowel}/,1,' No match for "ก" =~ /\p{InThaiCompVowel}/<br>');
isnt( 'ก' =~ /\p{InThaiPreVowel}/,1,' No match for "ก" =~ /\p{InThaiPreVowel}/<br>');
isnt( 'ก' =~ /\p{InThaiPostVowel}/,1,' No match for "ก" =~ /\p{InThaiPostVowel}/<br>');
isnt( 'ก' =~ /\p{InThaiPunct}/,1,' No match for "ก" =~ /\p{InThaiPunct}/<br>');
is( 'ก' =~ /\p{InThaiFinCons}/,1,' Match for "ก" =~ /\p{InThaiFinCons}/<br>');
isnt( 'ก' =~ /\p{InThaiMute}/,1,' Match for "ก" =~ /\p{InThaiMute}/<br>');
is( 'ไ' =~ /\p{InThai}/,1,' Match for "ไ" =~ /\p{InThai}/<br>');
is( 'ไ' =~ /\p{InThaiAlpha}/,1,' Match for "ไ" =~ /\p{InThaiAlpha}/<br>');
isnt( 'ไ' =~ /\p{InThaiCons}/,1,' No match for "ไ" =~ /\p{InThaiCons}/<br>');
isnt( 'ไ' =~ /\p{InThaiHCons}/,1,' No match for "ไ" =~ /\p{InThaiHCons}/<br>');
isnt( 'ไ' =~ /\p{InThaiMCons}/,1,' No match for "ไ" =~ /\p{InThaiMCons}/<br>');
isnt( 'ไ' =~ /\p{InThaiLCons}/,1,' No match for "ไ" =~ /\p{InThaiLCons}/<br>');
isnt( 'ไ' =~ /\p{InThaiDigit}/,1,' No match for "ไ" =~ /\p{InThaiDigit}/<br>');
isnt( 'ไ' =~ /\p{InThaiTone}/,1,' No match for "ไ" =~ /\p{InThaiTone}/<br>');
is( 'ไ' =~ /\p{InThaiVowel}/,1,' Match for "ไ" =~ /\p{InThaiVowel}/<br>');
isnt( 'ไ' =~ /\p{InThaiCompVowel}/,1,' No match for "ไ" =~ /\p{InThaiCompVowel}/<br>');
is( 'ไ' =~ /\p{InThaiPreVowel}/,1,' Match for "ไ" =~ /\p{InThaiPreVowel}/<br>');
isnt( 'ไ' =~ /\p{InThaiPostVowel}/,1,' No match for "ไ" =~ /\p{InThaiPostVowel}/<br>');
isnt( 'ไ' =~ /\p{InThaiPunct}/,1,' No match for "ไ" =~ /\p{InThaiPunct}/<br>');
is( 'ไ' =~ /\p{IsSaraaimaimalai}/,1,' Match for "ไ" =~ /\p{IsSaraaimaimalai}/<br>');
print "\n";
print <<PAGE;
<h3>Check:</h3>
<p>InThai: @inthai</p>
<p>Sample: $sample</p>
<p>Part: $part</p>
<p>PATH: $ENV{PATH}</p>
<p>INC: @INC</p>
</body>
</html>
PAGE
And then the error messages...
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::ok: none vs ($;$) at /usr/share/perl/5.34/Expo
+rter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::use_ok: none vs ($;@) at /usr/share/perl/5.34/
+Exporter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::require_ok: none vs ($) at /usr/share/perl/5.3
+4/Exporter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::is: none vs ($$;$) at /usr/share/perl/5.34/Exp
+orter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::isnt: none vs ($$;$) at /usr/share/perl/5.34/E
+xporter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::like: none vs ($$;$) at /usr/share/perl/5.34/E
+xporter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::unlike: none vs ($$;$) at /usr/share/perl/5.34
+/Exporter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::cmp_ok: none vs ($$$;$) at /usr/share/perl/5.3
+4/Exporter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::pass: none vs (;$) at /usr/share/perl/5.34/Exp
+orter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::fail: none vs (;$) at /usr/share/perl/5.34/Exp
+orter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::can_ok: none vs ($@) at /usr/share/perl/5.34/E
+xporter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
Prototype mismatch: sub ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_t
+est_2dthai_2dmod_2epl::isa_ok: none vs ($$;$) at /usr/share/perl/5.34
+/Exporter.pm line 63.
at /var/www/cgi/test-thai-mod.pl line 12.
[Mon Oct 30 13:00:32.189740 2023] [core:error] [pid 188075:tid 1396601
+72908096] [client 192.168.1.101:55600] Premature end of script header
+s: test-thai-mod.pl
[Mon Oct 30 13:00:32.189767 2023] [perl:warn] [pid 188075:tid 13966017
+2908096] /cgi/test-thai-mod.pl did not send an HTTP header
[Mon Oct 30 13:00:32.189819 2023] [:error] [pid 188075:tid 13966017290
+8096] Undefined subroutine &ModPerl::ROOT::ModPerl::PerlRun::var_www_
+cgi_test_2dthai_2dmod_2epl::IsThaiLCons called at /var/www/cgi/test-t
+hai-mod.pl line 19.\n
| [reply] [d/l] |
package Regexp::CharClasses::Thai;
but your script (above) has:
use RegexpCharClassesThai; #Regexp-CharClasses-Thai.pm
There's a naming mismatch. Assuming at least one of those is correct, you should have one of these three combinations:
package Regexp::CharClasses::Thai;
use Regexp::CharClasses::Thai;
# Regexp/CharClasses/Thai.pm
package RegexpCharClassesThai;
use RegexpCharClassesThai;
# RegexpCharClassesThai.pm
package Regexp-CharClasses-Thai;
use Regexp-CharClasses-Thai;
# Regexp-CharClasses-Thai.pm
Of course, it's possible all of those are incorrect
and you should have a fourth combination.
| [reply] [d/l] [select] |
The first thing those error messages tell me is that
ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_test_2dthai_2dmod_2epl is not a typo;
so, my guess without seeing any code, was incorrect.
All of the new errors are "Prototype mismatch".
Myself, and many others, would generally advise against using prototypes (see the recent thread: "Too many arguments for subroutine").
Probably the best thing to do is just get rid of them;
failing that, ensure you call your subroutines such that there is no mismatch with their prototypes.
The last error you list, which you showed in your earlier post, "Undefined subroutine", is easily fixed:
add sub IsThaiLCons { ... whatever it's supposed to do ... } to
ModPerl::ROOT::ModPerl::PerlRun::var_www_cgi_test_2dthai_2dmod_2epl.
| [reply] [d/l] [select] |
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. | [reply] [d/l] [select] |