First, why are you even using Unicode::Map in the first place? What does it do for you that Encode (or PerlIO encoding layers) can't do?
Second, to answer your questions 1 and 3, which I didn't answer in my first reply:
1. This problem comes up for perl programmers who are using a machine where they want to install non-core modules but don't have root privileges (and so cannot write stuff into the standard /usr directory tree). When the desired module involves any sort of OS/cpu dependency (usually, when parts of the module involve compiling code in C), the standard module install process will look at the current perl being used -- i.e. the version/build of perl that is first in the current path -- and create an OS/build-specific place for the compiled code.
This applies to non-root installations, going into some user-writable path like "/home/lib/perl5". It's good for the cases where this path might be shared by multiple machines having different builds of perl (or even by different perl builds available on a single machine, e.g. with and without thread support).
3. I think there would be a fairly easy, generally useful way to "elaborate" your default @INC inventory, but it would involve always using "require" (not "use") for modules that you expect to find in a non-root installation path. Other monks should be able to improve on this in significant ways:
(updated to fix indenting)# get the current perl version as a string: my $pversion = join(".",map{ord()}split //,$^V); # find paths in @INC that contain or end in that string: my %inc; my $build; for (sort grep m!/\Q$pversion\E(?:/|$)!, @INC) { if ( m!/$pversion$! ) { $inc{$_} = 0; } elsif ( m!(.*?$pversion)/([^/]+)$! ) { $inc{$1} = 1; $build ||= $2; } } for ( keys %inc ) { if ( $inc{$_} == 0 and -d "$_/$build" ) { warn "adding $_/$build to INC array\n"; push @INC, "$_/$build"; } } # now we can "require" modules that have build-specific components # in paths that have just been added.
If it's a problem that comes up a lot, I might wrap that in a module... (and make the warning message go away, or only show up when invoked with a "verbose" option).
Even with that, the person writing the script that depends on the "non-root installed" modules still needs to know which modules fall into that category, so as to "require" them after going through the gyrations above, and not just "use" them.
I am absolutely not an expert on this matter. I hope someone more knowledgeable will show us some better way of handling it.
In reply to Re: Unicode::Map cannot be loaded
by graff
in thread Unicode::Map cannot be loaded
by utku
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |