chriso has asked for the wisdom of the Perl Monks concerning the following question:

When I run a syntax check on my script through PerlEditor Lite I get the following errors:

"F:\perl\web\makequiz.cgi: Can't locate UCSExt.pm in @INC 
(@INC contains: F:\perl\web\ C:/Perl/lib C:/Perl/site/lib .)
at F:\perl\web\makequiz.cgi line 6.
Tue Jul 26 11:03:12 2005 F:\perl\web\makequiz.cgi:
BEGIN failed--compilation aborted at F:\perl\web\makequiz.cgi line 6.
Can't locate UCSExt.pm in @INC 
(@INC contains: F:\perl\web\ C:/Perl/lib C:/Perl/site/lib .) 
at F:\perl\web\makequiz.cgi line 6.
BEGIN failed--compilation aborted at F:\perl\web\makequiz.cgi line 6."
Here is line 6 in my script:
use UCSExt;
I looked in the perl\lib directory and the UCSExt.pm file is there.

Also, when I execute the script from my browser, I get the following errors. I don't know if they are related or not:

"Error message:
syntax error at sys:/perl/web/makequiz.cgi line 18, near " @options $nds "
Global symbol "$nds" requires explicit package name at
  sys:/perl/web/makequiz.cgi line 18. 
Global symbol "$Ret" requires explicit package name at
  sys:/perl/web/makequiz.cgi line 19. 
Global symbol "$nds" requires explicit package name at
  sys:/perl/web/makequiz.cgi line 24. 
Global symbol "$nds" requires explicit package name at
  sys:/perl/web/makequiz.cgi line 27. 
Global symbol "$nds" requires explicit package name at
  sys:/perl/web/makequiz.cgi line 29."
Here is some of my code:
use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use strict; use UCSExt; use warnings; my ( @explain, @allanswers, @allquestions, $fullname, $anslength, @allselections, $file, $fname, $lname, $time, $reviewtime, $idinput, $id, $courselocation, $useripaddress, $questionno, @log, $clocktime, $log, $type, $value, @answers, $buttonname, %selections, @options $nds $Ret );
Here are the lines of code referred to in the error messages:
line 18,19: @options $nds $Ret ); line 24: $nds = UCSExt->new("UCX:NWDir"); line 27: $nds->{"FullName"} = "nds:\\\\nsmtree\\nsm"; line 29: $nds->login ("jane", "password");
I appologize if this is more than one related problem. I don't know how to trouble shoot this since I've declared the variables and the UCSExt.pm module is where all the other modules are.

Thanks for any help.

Chris

Replies are listed 'Best First'.
Re: Don't understand error messages
by ikegami (Patriarch) on Jul 26, 2005 at 15:47 UTC

    The syntax errors are caused by the missing commas in the my. This will also fix the "requires explicit package name" errors.

    You said UCSExt.pm is in perl\lib. Did you mean c:\perl\lib? If so, you shouldn't be having any problems. It should work if the file is:
    f:\perl\web\UCSExt.pm,
    c:\perl\lib\UCSExt.pm or
    c:\perl\site\lib\UCSExt.pm
    If it's one of those three, then you must have a permission problem.

    As an aside, a my that big is a sign of poor design. You should probably break things down into smaller functions.

      The module is located in F:\perl\lib. I noticed that this path is not listed but then, my cgi.pm module is located in the same directory and I don't get an error for that.
      use CGI qw(:standard);
      Why the error for this module? I can put it in the f:\perl\web directory, but I thought it would be better to put it with the other modules. Any ideas?

      Thanks.

        See if this line helps:
        use lib 'F:\perl\lib';
        The module is located in F:\perl\lib

        Add use lib 'F:\perl\lib'; somewhere before use UCSExt. That will tell Perl to look for it where it currently resides.

        my cgi.pm module is located in the same directory

        You must have two CGI.pm, and you're not using the one you think you are using.

        Are you sure that you are using CGI.pm from F:\perl\lib and not from somewhere else in @INC? Try running this simple script:
        use CGI.pm; print "$INC{CGI.pm}\n";
        That will tell you were Perl is really getting CGI.pm from.

        Ivan Heffner
        Sr. Software Engineer, DAS Lead
        WhitePages.com, Inc.
Re: Don't understand error messages
by muntfish (Chaplain) on Jul 26, 2005 at 15:46 UTC

    I think these are two separate problems.

    I'm not sure what's preventing it finding the the UCSExt.pm module since you say it is in your perl path.

    From your code snippets it seems like you have a syntax error on line 18:

    @options $nds $Ret

    should be

    @options, $nds, $Ret

    The subsequent "Global symbol requires explicit package name" errors are a follow-on from this. If you fix line 18 the rest will go.


    s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"$`$'\"$&\"\)"|ee;/m.+h/&&print$&