{
    "content": [
        {
            "type": "text",
            "text": "# File::Basename (perldoc)\n\n## NAME\n\nFile::Basename - Parse file paths into directory, filename and suffix.\n\n## SYNOPSIS\n\nuse File::Basename;\n($name,$path,$suffix) = fileparse($fullname,@suffixlist);\n$name = fileparse($fullname,@suffixlist);\n$basename = basename($fullname,@suffixlist);\n$dirname  = dirname($fullname);\n\n## DESCRIPTION\n\nThese routines allow you to parse file paths into their directory, filename and suffix.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **SEE ALSO** (1 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "File::Basename",
        "section": "",
        "mode": "perldoc",
        "summary": "File::Basename - Parse file paths into directory, filename and suffix.",
        "synopsis": "use File::Basename;\n($name,$path,$suffix) = fileparse($fullname,@suffixlist);\n$name = fileparse($fullname,@suffixlist);\n$basename = basename($fullname,@suffixlist);\n$dirname  = dirname($fullname);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 121,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 1,
                "subsections": [
                    {
                        "name": "dirname",
                        "lines": 1
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "File::Basename - Parse file paths into directory, filename and suffix.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use File::Basename;\n\n($name,$path,$suffix) = fileparse($fullname,@suffixlist);\n$name = fileparse($fullname,@suffixlist);\n\n$basename = basename($fullname,@suffixlist);\n$dirname  = dirname($fullname);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "These routines allow you to parse file paths into their directory, filename and suffix.\n\nNOTE: \"dirname()\" and \"basename()\" emulate the behaviours, and quirks, of the shell and C\nfunctions of the same name. See each function's documentation for details. If your concern is\njust parsing paths it is safer to use File::Spec's \"splitpath()\" and \"splitdir()\" methods.\n\nIt is guaranteed that\n\n# Where $pathseparator is / for Unix, \\ for Windows, etc...\ndirname($path) . $pathseparator . basename($path);\n\nis equivalent to the original path for all systems but VMS.\n\n\"fileparse\"\nmy($filename, $dirs, $suffix) = fileparse($path);\nmy($filename, $dirs, $suffix) = fileparse($path, @suffixes);\nmy $filename                  = fileparse($path, @suffixes);\n\nThe \"fileparse()\" routine divides a file path into its $dirs, $filename and (optionally) the\nfilename $suffix.\n\n$dirs contains everything up to and including the last directory separator in the $path\nincluding the volume (if applicable). The remainder of the $path is the $filename.\n\n# On Unix returns (\"baz\", \"/foo/bar/\", \"\")\nfileparse(\"/foo/bar/baz\");\n\n# On Windows returns (\"baz\", 'C:\\foo\\bar\\', \"\")\nfileparse('C:\\foo\\bar\\baz');\n\n# On Unix returns (\"\", \"/foo/bar/baz/\", \"\")\nfileparse(\"/foo/bar/baz/\");\n\nIf @suffixes are given each element is a pattern (either a string or a \"qr//\") matched\nagainst the end of the $filename. The matching portion is removed and becomes the $suffix.\n\n# On Unix returns (\"baz\", \"/foo/bar/\", \".txt\")\nfileparse(\"/foo/bar/baz.txt\", qr/\\.[^.]*/);\n\nIf type is non-Unix (see \"fileparsesetfstype\") then the pattern matching for suffix\nremoval is performed case-insensitively, since those systems are not case-sensitive when\nopening existing files.\n\nYou are guaranteed that \"$dirs . $filename . $suffix\" will denote the same location as the\noriginal $path.\n\n\"basename\"\nmy $filename = basename($path);\nmy $filename = basename($path, @suffixes);\n\nThis function is provided for compatibility with the Unix shell command basename(1). It does\nNOT always return the file name portion of a path as you might expect. To be safe, if you\nwant the file name portion of a path use \"fileparse()\".\n\n\"basename()\" returns the last level of a filepath even if the last level is clearly\ndirectory. In effect, it is acting like \"pop()\" for paths. This differs from \"fileparse()\"'s\nbehaviour.\n\n# Both return \"bar\"\nbasename(\"/foo/bar\");\nbasename(\"/foo/bar/\");\n\n@suffixes work as in \"fileparse()\" except all regex metacharacters are quoted.\n\n# These two function calls are equivalent.\nmy $filename = basename(\"/foo/bar/baz.txt\",  \".txt\");\nmy $filename = fileparse(\"/foo/bar/baz.txt\", qr/\\Q.txt\\E/);\n\nAlso note that in order to be compatible with the shell command, \"basename()\" does not strip\noff a suffix if it is identical to the remaining characters in the filename.\n\n\"dirname\"\nThis function is provided for compatibility with the Unix shell command dirname(1) and has\ninherited some of its quirks. In spite of its name it does NOT always return the directory\nname as you might expect. To be safe, if you want the directory name of a path use\n\"fileparse()\".\n\nOnly on VMS (where there is no ambiguity between the file and directory portions of a path)\nand AmigaOS (possibly due to an implementation quirk in this module) does \"dirname()\" work\nlike \"fileparse($path)\", returning just the $dirs.\n\n# On VMS and AmigaOS\nmy $dirs = dirname($path);\n\nWhen using Unix or MSDOS syntax this emulates the dirname(1) shell function which is subtly\ndifferent from how \"fileparse()\" works. It returns all but the last level of a file path\neven if the last level is clearly a directory. In effect, it is not returning the directory\nportion but simply the path one level up acting like \"chop()\" for file paths.\n\nAlso unlike \"fileparse()\", \"dirname()\" does not include a trailing slash on its returned\npath.\n\n# returns /foo/bar.  fileparse() would return /foo/bar/\ndirname(\"/foo/bar/baz\");\n\n# also returns /foo/bar despite the fact that baz is clearly a\n# directory.  fileparse() would return /foo/bar/baz/\ndirname(\"/foo/bar/baz/\");\n\n# returns '.'.  fileparse() would return 'foo/'\ndirname(\"foo/\");\n\nUnder VMS, if there is no directory information in the $path, then the current default\ndevice and directory is used.\n\n\"fileparsesetfstype\"\nmy $type = fileparsesetfstype();\nmy $previoustype = fileparsesetfstype($type);\n\nNormally File::Basename will assume a file path type native to your current operating system\n(ie. /foo/bar style on Unix, \\foo\\bar on Windows, etc...). With this function you can\noverride that assumption.\n\nValid $types are \"MacOS\", \"VMS\", \"AmigaOS\", \"OS2\", \"RISCOS\", \"MSWin32\", \"DOS\" (also \"MSDOS\"\nfor backwards bug compatibility), \"Epoc\" and \"Unix\" (all case-insensitive). If an\nunrecognized $type is given \"Unix\" will be assumed.\n\nIf you've selected VMS syntax, and the file specification you pass to one of these routines\ncontains a \"/\", they assume you are using Unix emulation and apply the Unix syntax rules\ninstead, for that function call only.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "",
                "subsections": [
                    {
                        "name": "dirname",
                        "content": ""
                    }
                ]
            }
        }
    }
}