Re: question about PerlIO

[email protected] (Nick Ing-Simmons)
Newsgroups perl.unicode
Message-ID <[email protected]>
Cremers LMG <[email protected]> writes:
>I've used your clear description in 'Encode.html' to convert from cp1252 to
>utf8,
>using the lines:
>
>use Encode;
>open (INPUT,"<:encoding(cp1252)","$in")|| die "FileOpen fail: $in $!\n";
>open (OUT,">:utf8","$out") || die "FileOpen 1 failed: $out : $!\n";
>
>The script works fine on Unix, but when I run the compiled version on PC
>(compiled with pp)

That is the problem - the 'pp' thing. At pp compile time it didn't 
know you wanted PerlIO.pm (or PerlIO::encoding).

>I get the following error:
>
>"Can't locate PerlIO.pm in @INC (@INC contains: CODE(0xcab4e8) .)..."

What is the _exact_ message?

>
>The .pm is in the lib directory. 

But (if I understand how pp works correctly) the pp compiled thing 
does not look in the lib directory, only in the magical CODE() thing.
The CODE thing is a subroutine that finds the module in compiled-in
way.

>The statement
>"push(@INC,"c:\\Perl\\lib\\PerlIO.pm");" 
>doesn't seem to help either.

It wouldn't - @INC is for directory names to look in not module names.
And a push() like that happens at run time.

 use lib "C:\\Perl\\lib"; 

might help, but I expect the equivalent was already in force anyway.

I _think_ if you add

use PerlIO qw(encoding);

To your script then pp will notice that PerlIO.pm and encoding.pm 
are needed.

(My pp like thing would.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.