Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

G'day feumw,

I used macOS (formerly Mac OS X) for about 9-10 years. I stopped using it in the latter half of last year: reasons were not Perl-related.

"... /usr/bin/perl is the default ... Some people say it's bad ..."

It's not so much that it's bad, per se. It's usually fairly up-to-date and fully functional. The problem is that it is the system Perl and is installed by Apple for their use. This has two major implications:

  • If you install modules (which may update existing modules due to a new module's dependency requirements) you run the risk of affecting some part of the system in less than desirable ways.
  • When you update macOS, Apple may simply wipe out the previous version of Perl and install a newer version. It's not just the core Perl that's removed; all modules you installed will be also deleted.

So, you should basically leave the system Perl alone and let Apple do whatever it wants with it.

I installed Perlbrew pretty much as soon as got the new machine. Over the decade that I used it, I installed many versions of Perl. I was able to switch between them when I wanted, which was often very handy for testing. I did not have problems with installing from CPAN; the cpan utility always matched the current Perl version in use; and installed modules only affected the current Perl version in use.

The shebang line I use for all scripts is:

#!/usr/bin/env perl

That worked for all versions of Mac OS X and macOS that I had.

I see you've mentioned "perl -MCPAN -e shell" in a couple of places. The cpan utility does the same thing. See CPAN (the module) and cpan (the utility). Do note that there are some other things you can do beyond starting a CPAN shell; however, in 99% of cases, typing cpan is all I need.

"Let's say I want to split my CPANs ..."

No, that's not something you want to do. Always install modules for each version of Perl you are using. Never try to copy a module from one version of Perl to another.

"And does reinstalling a new fresh and clean cpan mean just rm -rf /Users/myusername/.cpan ?"

No, definitely don't do that either. When you switch between one version of Perl and another, Perlbrew takes care of the rest: it'll look after the $PATH environment variable, your .bashrc settings, and so on. In general, unless you know exactly what you're doing and why you're doing it, don't fiddle with things.

By the way, typing rm -rf followed by an absolute path is something I'd never do. It only takes a momentary distraction (the phone rings, you sneeze, or whatever) and you've accidentally hit Return after only typing rm -rf /Users/myusername. Here's what I'd normally do to remove an unwanted directory's contents and the directory itself:

$ cd /path/to/unwanted_dir $ rm -rf ./* $ cd .. $ rmdir unwanted_dir

I think that covers all of your points. Enjoy your Perl brewing. :-)

— Ken


In reply to Re: Understanding Perl / Brew Perl and Cpan on macOS by kcott
in thread Understanding Perl / Brew Perl and Cpan on macOS by feumw

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (9)
As of 2024-04-23 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found