in reply to Re^4: Sorry.. Same problem but some progress!
in thread Sorry.. Same problem but some progress!

Can't locate variables/variables.cgi in @INC (@INC contains: C:/strawberry/perl/site/lib/MSWin32-x64-multi-thread C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib)

Perl 5.26 removed having the current working directory in @INC as a security measure. Your Linux site works because it has an older perl. The quick fix is to use an absolute path which I guess is

require 'C:/Apache24/htdocs/choo/cgi-bin/ua/variables/variables.cgi';

The correct fix depends on how easily portable you want the code between your windows localhost and the Linux site and how many scripts you would need to edit.

poj

Replies are listed 'Best First'.
Re^6: Sorry.. Same problem but some progress!
by traincity (Sexton) on Jun 25, 2019 at 19:33 UTC
    OK thanks very much for that. Good to know. We did update the unix server 2 years ago with a new perl version and did not run into this problem so possibly this was a recent change?

    So I need no communication between this localhost site and the unix site. I'm only going to use this local site to test new code or other things before I implement them on the unix site. I'm hoping to learn more perl this way and learn to understand how my auction site works so that I can improve it.

    There are many .pl scripts and I'd rather avoid having to manually change them all. Is there a way I can go to accomplish that?

    Thanks again!!

      possibly this was a recent change?

      Relatively recent. The main change was this one in Perl 5.26.0, released in May of 2017, with some preliminary changes (these) in 5.24.1, released in January of 2017.

      There are many .pl scripts and I'd rather avoid having to manually change them all. Is there a way I can go to accomplish that?

      What change are you talking about - the include path? One way to add paths to @INC globally is by setting the PERL5LIB environment variable (taking care not to clobber its contents if it's already set).

      I'm only going to use this local site to test new code or other things before I implement them on the unix site.

      I've worked with Perl on both Windows and *NIX for many years, and let me just say that things are different on both OSes - not necessarily better or worse, but certainly different. Sure, getting Perl code to run on both is possible, but in this situation, it sounds like you've got a test/development server, which you want to set up on Windows, and a production server, which is *NIX. I do have to say that I think you'd be much happier if your test/dev system was *NIX as well, as things will mesh so much better that way - no fiddling with file permissions every time you sync the two, no differences in paths between the two, and so on. You might want to consider setting up a Linux virtual machine on your Windows system...

      Environment variable PERL5LIB can be accessed from the Control Panel

      Control Panel 
      -> System and Security 
      -> System 
      -> Advanced system settings
      -> Environment Variables
      System variables
      
      poj

      I agree with the comments about creating a Unix virtual machine to use as your test bed. Even after (if?) you get your Windows test bed set up, you may have to (re)write some of the code to work on both platforms. That could be a project in and of itself. If getting the code to work in both Windows and *nix is your goal, go for it. I think you're asking for headaches you don't need if that's not your goal.

      I have several virtual machines that I spin up, pause, clone, and delete as needed for testing. Having a separate machine for a test environment isn't always needed, either, depending on what you're testing. You can create a virtual host on your Unix site and create a copy of your code there (or use version control) to try out your new code or other things.

Re^6: Sorry.. Same problem but some progress!
by traincity (Sexton) on Jun 26, 2019 at 11:31 UTC
    OK I tried using the full path and it I get the exact same error as before:

    Wed Jun 26 07:15:20.700622 2019] [cgi:error] [pid 14444:tid 1836] [cli +ent ::1:56842] AH01215: BEGIN failed--compilation aborted at C:/Apach +e24/htdocs/choo/cgi-bin/ua/main.pl line 20.\r: C:/Apache24/htdocs/cho +o/cgi-bin/ua/main.pl [Wed Jun 26 07:16:13.581363 2019] [cgi:error] [pid 14444:tid 1832] [cl +ient ::1:56852] End of script output before headers: main.pl [Wed Jun 26 07:16:13.581363 2019] [cgi:error] [pid 14444:tid 1832] [cl +ient ::1:56852] AH01215: Can't locate variables/variables.cgi in @INC + (@INC contains: C:/strawberry/perl/site/lib/MSWin32-x64-multi-thread + C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawbe +rry/perl/lib) at C:/strawberry/perl/site/lib/UltimateAuction.pm line +44.\r: C:/Apache24/htdocs/choo/cgi-bin/ua/main.pl [Wed Jun 26 07:16:13.581363 2019] [cgi:error] [pid 14444:tid 1832] [cl +ient ::1:56852] AH01215: Compilation failed in require at C:/Apache24 +/htdocs/choo/cgi-bin/ua/main.pl line 20.\r: C:/Apache24/htdocs/choo/c +gi-bin/ua/main.pl [Wed Jun 26 07:16:13.581363 2019] [cgi:error] [pid 14444:tid 1832] [cl +ient ::1:56852] AH01215: BEGIN failed--compilation aborted at C:/Apac +he24/htdocs/choo/cgi-bin/ua/main.pl line 20.\r: C:/Apache24/htdocs/ch +oo/cgi-bin/ua/main.pl
    No matter what I change the path to, it comes back in the error as variables/variables.cgi. The error doesn't change. Could this be some sort of a compilation problem? I don't have a clue how to compile script in perl and it looks like that should happen automatically in this case?

    Thanks again for any help in resolving this.

    One other question. I'm not that familiar with perlmonk. Once you go off the first page in the question section should you just continue to ask questions within that thread or should you start another new topic of the same question to be seen?

    2019-07-01 Athanasius added code tags

      "Once you go off the first page in the question section should you just continue to ask questions within that thread or should you start another new topic of the same question to be seen?"

      Keep replying to your existing thread, we see these in various ways, Newest Nodes etc. Also, as has been mentioned several times and on the page each time you post:

      • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!

      Could it be that you made changes in another file/location? Perl can't possibly invent variables/variables.cgi if you specified a full path. Just to be clear, the error you cite can be eliminated by changing line 44 of C:/strawberry/perl/site/lib/UltimateAuction.pm to a full path. And since you are there put a comment that this needs changing whenever you relocate your code.

      Or use this method Re^7: Sorry.. Same problem but some progress! and Re^7: Sorry.. Same problem but some progress! to do it once and for all. Caveat: I hope Apache takes that variable into consideration when spawning your scripts.