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

Hi,
I own an Apple Powerbook running OS X v10.2.3 and recently decided to learn how to program in perl. Following the advice from the Apple Developers site I downloaded v5.8.0 from CPAN and installed the .pkg file. The installation went smoothly and then I did a version check in console to make sure that it had worked properly and got the following error:
[Tybalt:/] lorna% perl -v perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LC_ALL = (unset), LANG = "en" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
After the error it listed the correct version and the lisence etc as normal. Is there anything I could/should do to fix those LC_ALL and LANG errors and will they affect me in any drastic way if I cannot? Thanks in advance :)
-Kevin

Replies are listed 'Best First'.
Re: LC_ALL and LANG errors
by jacques (Priest) on Feb 10, 2003 at 02:31 UTC
    This question has come up and been answered on usenet.

    groups.google.com

    Here's one of the posts.

    I've had this problem myself recently and I traced it down to the fact that I didn't have the locales I was requesting setup. I'm a debian user, so I'm not sure if this is the same as RedHat, but the default install only sets up the en_US locale, which is stored in /usr/lib/locale.

    To get the others setup, I had to edit a configuration file /etc/locale.gen and uncomment all of the locales that I required.

    I then had to run locale-gen (as root), this generates the required locales. After this the locales all worked fine, for everything.

    Note that this setups the locales using the strict xx_XX language codes, so if you want french - french ( as apposed to canadian french fr_CA) you have to specify fr_FR. Likewise there is no "en" on it's own, if you want these two letter versions you'll have to add an entry in /etc/locale.alias.

Re: LC_ALL and LANG errors
by sauoq (Abbot) on Feb 10, 2003 at 04:49 UTC

    You just need to set your locale settings. I'm not sure what shell you are using, but the '%' makes it look like a csh variant to me, so you probably need to put something like

    set LC_ALL=C set LANG=en_US
    in your .cshrc file.

    By the way, those aren't errors; they are only warnings. They probably won't affect your scripts.

    -sauoq
    "My two cents aren't worth a dime.";
    

      No, the warnings won't affect your scripts, but you will get bloody annoyed by the fact that the warning pops up every time you try to throw out a one-liner. Once the environment variables are set, life is much smoother :-)


      I just realized that I was using the same sig for nearly three years.

Re: LC_ALL and LANG errors
by Fletch (Bishop) on Feb 10, 2003 at 02:23 UTC

    See perldoc perldiag, search for Setting locale failed. Explains what happened and where to consult to find out how to fix it (perldoc perllocale).

Re: LC_ALL and LANG errors
by jonadab (Parson) on Feb 11, 2003 at 15:36 UTC

    Perl is complaining because certain variables in your Darwin environment aren't set in a way that matches what Perl expects.

    As the other poster correctly guessed, OS X uses a csh variant (tcsh IIRC) by default, so if you haven't changed shells (you would know if you had installed bash, for example), that's what you're using.

    Look in your home directory (hit the little house button in Finder, or cd ~ in Terminal then ls .*) for a file with a name that starts with a period and has csh in its name, like .cshrc or .tcshrc (I can't check right now the exact name, because the OS X system I have access to seems to be not responding at the moment; probably my boss isn't in right now so her iMac is asleep).

    Open that file up in your text editor. (I forget what they renamed the OS X version of SimpleText, but it's got the word "Text" in the name and is in your Applications folder.) Here you can make changes, save them, and then next time you open Terminal they should be in effect. It is a good idea to make a backup copy of the file first.

    The set commands that the other poster gave you will probably do approximately what you want; if not, open Terminal and try man csh or man tcsh and it should have some (somewhat technical) information about how your shell works. Type /environment and hit enter to scan forward to the section on setting environment variables. (You may have to scan forward several times to find the relevant section.) I can't get any more detailed than that, because I normally use bash, which does things a bit differently from csh (or eshell, which does things a lot differently from both, or DCL, which is even more different from all of the above, or COMMAND.COM which is its own thing too). My knowledge of csh is quite limited.

     --jonadab

Re: LC_ALL and LANG errors
by Cody Pendant (Prior) on Feb 10, 2003 at 23:57 UTC
    Not directly related to your problem, but in case you don't know, there's a very lively mailing list specifically for perl on OSX you might be interested in.

    macosx-subscribe@perl.org
    --

    “Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
    M-J D