AndySummers has asked for the wisdom of the Perl Monks concerning the following question:

How do I solve this, the application (ASSP) that I am trying to use says the package is not installed but it is! Because it is a Win32 OS the double colon needs replacing with a dash?

C:\Documents and Settings\Administrator>ppm query Win32::Unicode *** no packages installed matching 'Win32::Unicode' *** C:\Documents and Settings\Administrator>ppm install Win32::Unicode No missing packages to install C:\Documents and Settings\Administrator>ppm query Win32-Unicode +--------------------------------------------------------------------- +-+ name versionabstract area +-------------+-------+-------------------------------------------+--- +- Win32-Unicode0.28 perl unicode-friendly wrapper for win32api.site Win32-Unicode0.28 perl unicode-friendly wrapper for win32api.perl +--------------------------------------------------------------------- +-+ (2 packages installed matching 'Win32-Unicode')

PPM Query says it is not installed, but PPM Install says it is!

Thanks, Andy.

Replies are listed 'Best First'.
Re: Problem installing packages
by tobyink (Canon) on Apr 03, 2012 at 08:07 UTC

    The separator used for packages is "::". (Alternatively a single quote can be used, though this is rare.) For example: Win32::Unicode or Win32'Unicode.

    By convention, packages tend to be stored in modules (i.e. files ending in ".pm") named by replacing the "::" with a directory separator, which will be operating system specific - e.g. "\" on Windows. So the Win32::Unicode package would be stored in a file called "Win32\Unicode.pm".

    The syntax of Perl's require and use keywords strongly encourages the above convention.

    Lastly there are distributions (a.k.a. releases) which are bundles of modules, scripts, documentation and other supporting files. What CPAN (and PPM) provide are distributions. The convention with distributions is to name them after the most important package contained within them, replacing "::" with a dash.

    So the Win32::Unicode package would usually be inside a file called Win32/Unicode.pm which would be distributed as part of the Win32-Unicode distribution.

    Somewhat confusingly, the PPM interface and documentation often refers to distributions as "packages".

    It seems that ppm query expects to be given a distribution name to query (i.e. with a dash), but ppm install expects a package name (i.e. with "::").

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'