-2

I use perl5.8.8 for msys on windows7 pro.

I use this perl as CGI with Apache2.2 for windows.

I take following error massage ..

Can't locate encoding.pm in @INC (@INC contains: 
   /usr/lib/perl5/5.8/msys
   /usr/lib/perl5/5.8
   /usr/lib/perl5/site_perl/5.8/msys
   /usr/lib/perl5/site_perl/5.8
   /usr/lib/perl5/site_perl/5.8
   /usr/lib/perl5/vendor_perl/5.8/msys
   /usr/lib/perl5/vendor_perl/5.8
   /usr/lib/perl5/vendor_perl/5.8
   .)

[Line breaks added for readability.]

This is my code

#!/opt/gnu/bin/perl
print "Content-type: text/plain; charset=iso-8859-1\n\n";
use encoding qw(utf8);

encoding.pm is in C:\usr\lib\perl5\5.8\msys\Encode and there isn’t any error message if I type from DOS prompt.

C:\usr\bin>perl -e 'use encoding qw(utf-8)
C:\usr\bin>

Actually lib under \usr is symbolic link to \mingw\msys\1.0.\lib

How can I locate encoding.pm?

ikegami
  • 367,544
  • 15
  • 269
  • 518
user1345414
  • 3,745
  • 9
  • 36
  • 56

1 Answers1

2

encoding.pm is in C:\usr\lib\perl5\5.8\msys\Encode

The file in that directory is named Encoding.pm (not encoding.pm), and it would be the Encode::Encoding module, not the encoding module.

So it sounds like the module doesn't exist on your system. That's weird since it came with Perl 5.8, but then again, you're using an ancient port of an ancient version of Perl. On the plus side, the encoding module is dual-lived, so it can be installed without reinstalling all of Perl. How exactly to do that on msys, I can't help you.

That it's not on your system isn't really a bad thing since you really shouldn't use that module anyway; its design is fundamentally flawed. However, without knowing what you are trying to achieve by using it, I can't tell you what you should be using instead.

ikegami
  • 367,544
  • 15
  • 269
  • 518
  • I modified my article `encodinging` to `encoding` – user1345414 Dec 17 '15 at 05:34
  • Adjusted answer for the new question – ikegami Dec 17 '15 at 05:46
  • Actually I have to migrate a web site from A to B. One of perl code which someone wrote includes `use encoding wq(utf8)` When I tested B site this perl code didn’t work by locating problem. So I made short code includes `use encoding wq(utf8)` to find the cause. – user1345414 Dec 17 '15 at 06:01
  • 1
    That doesn't affect my answer, except to add: Why are you migrating to such ancient systems????? – ikegami Dec 17 '15 at 06:04
  • What is the matter if the system is ancient or design is flawed? If changing or updating the system and design is affect, I will add it on a list of solution. – user1345414 Dec 17 '15 at 06:26
  • 1
    Did you seriously just ask what's wrong with using something buggy? – ikegami Dec 17 '15 at 06:29
  • I'm also very surprised you don't see the problems with trying to get something ancient working. At the very least, it requires far far far more effort – ikegami Dec 17 '15 at 06:33
  • Yes exactly. And to be honest I’m very beginner of perl too, needed much more effort as you said. What should I know at the first to have enough knowledge to fix this problem? – user1345414 Dec 17 '15 at 06:56
  • 2
    You should know that if you port software today, it's a bad idea to port it to [a version released in 2006](http://dev.perl.org/perl5/news/2006/perl-5.8.8.html) that has long fallen out of maintenance. It's is a bit like deciding to relocating your office to an abandoned office building. – reinierpost Dec 17 '15 at 08:36