A few more tests confirmed that I can't preload CGI::CommonObject in
startup.pl, otherwise the error occurs.
Everything works fine after I remove the line in startup.pl, and let
Apache::Registry load it.
Kenneth Lee wrote:
>
> This may not be mod-perl related.
>
> I wrote a module CGI::CommonObject which is a subclass of CGI.
> If I preload them both in conf/startup.pl, error occurs when I try to
> instantiate CGI::CommonObject.
>
> bash$ perl test.pl
> Bareword found where operator expected at /www/perl/test.pl line 3, near
> "new CGI::CommonObject"
> (Do you need to predeclare new?)
> [Tue Aug 1 18:51:06 2000] [error] syntax error at /www/perl/test.pl line
> 3, near "new CGI::CommonObject"
>
> Where test.pl is simply
>
> #!/usr/bin/perl
> use CGI::CommonObject;
> my $q = new CGI::CommonObject;
>
> And conf/startup.pl (irrelevant parts snipped)
>
> ...
> use CGI qw(-compile :standard);
> use CGI::CommonObject qw(:CommonObject);
> ...
>
> The error gone if I don't preload CGI before CGI::CommonObject, or if I
> run the script under shell.
>
> The question is what has confused perl that it treats "new" as a bareword?
> I couldn't find any hints both in the code of CGI.pm and my own module.
>
> Thanks,
> Kenneth