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

Hi, I am trying to install perl package CGI::Application in my MAC MINI with command

perl -MCPAN -e 'CGI::Application'

and get errors as follows:
ERROR: Can't create '/Library/Perl/5.18/HTML' mkdir /Library/Perl/5.18/HTML: Permission denied at /System/Library/Pe +rl/5.18/ExtUtils/Install.pm line 469.
I know it is a question of permission...but how to solve this.. because I cannot chmod /system to read/write. Any help for this newbie would be welcome

Replies are listed 'Best First'.
Re: Install CGI::Application
by kcott (Archbishop) on Feb 22, 2016 at 07:56 UTC

    G'day perldb2,

    -- Downvoted! You asked about this topic, and got a solution, a few weeks ago in "OSX Server Perl install modules".

    You did not get the output you claim from:

    perl -MCPAN -e 'CGI::Application'

    Here's what I get (i.e. no output):

    $ perl -MCPAN -e 'CGI::Application' $

    Similar commands also producing no output:

    $ perl -MCPAN -e 1 $ $ perl -e 'CGI::Application' $ $ perl -e 1 $

    The remainder of my post is what I wasted my time on before realising you'd already been given this information.

    I'll assume "MAC MINI" uses Mac OS X: please correct me if I'm wrong. I don't which version you have and this is important: please advise.

    Apple has installed its own version of Perl for its own use. This is generally referred to as the "System Perl". Do not modify (add, change or delete) the System Perl: it can affect how the OS currently runs; your modifications will probably be overwritten by the next update. I'd recommend perlbrew: I've been using this for over five years on various Mac OS X versions.

    See also: CPAN on El Capitan and OSX Server Perl install modules.

    — Ken

Re: Install CGI::Application
by Your Mother (Archbishop) on Feb 22, 2016 at 12:53 UTC

    Chiming in on the sudo solution. This will work for a lot of things on OS X—i.e., installing as root—but you will eventually hose your system perl when you get into XS and linked library modules. Never mess the system perl on Mac. Always use a local user-owned perl. I suggest a combination of perlbrew, cpanm, and local::lib.

    Update: I would also recommend not using CGI::Application. The newer frameworks like Dancer2, Catalyst, and Mojolicious are better (if perhaps costing more upfront in learning-curve).

Re: Install CGI::Application
by beech (Parson) on Feb 22, 2016 at 06:28 UTC
Re: Install CGI::Application
by perlfan (Parson) on Feb 22, 2016 at 16:43 UTC
    Do yourself a favor. Install local::lib, App::cpanminus, then use cpanm to install Dancer2.

    You will have maximum control of your local deployment and can scale from there. CGI::Application is good for an environment where you're bound to the Apache stack, but if you're not (i.e., local development), Dancer2 is the way to go.