{
    "mode": "perldoc",
    "parameter": "User",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/User/json",
    "generated": "2026-06-14T04:14:44Z",
    "synopsis": "use User;\nmy $cfg = Config::IniFiles->new\n(\n-file    => sprintf(\"%s/%s\", User->Home, \".ncfg\"),\n-default => 'Default'\n);\nprint \"Your login is \", User->Login, \"\\n\";",
    "sections": {
        "NAME": {
            "content": "User - API for locating user information regardless of OS\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use User;\n\nmy $cfg = Config::IniFiles->new\n(\n-file    => sprintf(\"%s/%s\", User->Home, \".ncfg\"),\n-default => 'Default'\n);\n\nprint \"Your login is \", User->Login, \"\\n\";\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module is allows applications to retrieve per-user characteristics.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Home\nReturns a location that can be expected to be a users \"Home\" directory on either Windows or\nUnix.\n\nWhile one way of writing this would be to check for operating system and then check the\nexpected location for an operation system of that type, I chose to do the following:\n\nsub Home {\n\nreturn $ENV{HOME}        if $ENV{HOME};\nreturn $ENV{USERPROFILE} if $ENV{USERPROFILE};\nreturn  \"\";\n\n}\n\nIn other words, if $HOME is defined in the user's environment, then that is used. Otherwise\n$USERPROFILE is used. Otherwise \"\" is returned.\n\nA contribution for Macintosh (or any other number of OS/arch combinations) is greatly\nsolicited.\n\nLogin\nReturns login id of user on either Unix or NT by checking \"getlogin\", \"getpwuid\", and\nvarious environment variables.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "File::HomeDir seems to be a very well-done update of the same concept as this module.\n",
            "subsections": []
        },
        "COPYRIGHT INFO": {
            "content": "Copyright: Copyright (c) 2002-2010 Terrence Brannon. All rights reserved. This program is free\nsoftware; you can redistribute it and/or modify it under the same terms as Perl itself.\n\nLicense: GPL, Artistic, available in the Debian Linux Distribution at\n/usr/share/common-licenses/{GPL,Artistic}\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "T.M. Brannon, tbone@cpan.org\n\nI am grateful for additions by Rob Napier and Malcom Nooning.\n",
            "subsections": []
        },
        "ACKNOWLEDGEMENTS": {
            "content": "I would like to offer profuse thanks to my fellow perl monk at www.perlmonks.org, theslycer,\nwho told me where HOME could be found on Windows machines.\n\nI would also like to thank Bob Armstrong for providing me with the text of the copyright notice\nand for including this in the Debian Linux distribution.\n",
            "subsections": [
                {
                    "name": "perl",
                    "content": ""
                }
            ]
        }
    },
    "summary": "User - API for locating user information regardless of OS",
    "flags": [],
    "examples": [],
    "see_also": []
}