in reply to Are %INC keys OS dependent?

perl -Mstrict -Mwarnings -e "print join(',', %INC)" __END__ Carp.pm,C:/usr/perl/lib/Carp.pm,warnings.pm, C:/usr/perl/lib/warnings.pm, Exporter.pm,C:/usr/perl/lib/Exporter.pm, strict.pm,C:/usr/perl/lib/strict.pm
Yes they are apparently system dependent, not that it ought to matter since perl generates the right paths for the platform you're on. If, for some reason you're generating things for another platform you could look at File::Spec.

PS> You're asking about the values, not the keys ;-)
PPS> The -M are used to load some modules, otherwise %INC is empty.

--
I'm not belgian but I play one on TV.

Replies are listed 'Best First'.
Re: Re: Are %INC keys OS dependent?
by grantm (Parson) on Jul 23, 2003 at 01:29 UTC
    You're asking about the values, not the keys ;-)

    Actually, I think the original poster was asking about the keys and not the values.

    If your code does this ...

    use LWP::Simple;

    ... then once the Simple.pm file has been located via @INC the pathname will be stored in %INC as the value associated with the key 'LWP/Simple.pm'.

    It is my understanding that a package name is always converted to a key by replacing '::' with '/' and appending '.pm' regardless of the naming conventions of the platform where the code is running. The full pathname to the file (ie: the value in %INC) is in a platform dependent format.

    So the answer to the original question: No the keys in %INC are not OS dependent.

Re: Re: Are %INC keys OS dependent?
by diotalevi (Canon) on Jul 23, 2003 at 04:16 UTC

    I've wanted to do this to convince perl that a module was already loaded. In fact I'd gotten the impression that it was stored in unix-form regardless of the platform but I guess I'm wrong. Oops! But definately the keys.