Two additional follow-ups:

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:

# 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.
(updated to fix indenting)

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.