{
    "content": [
        {
            "type": "text",
            "text": "# Path::Class (perldoc)\n\n## NAME\n\nPath::Class - Cross-platform path specification manipulation\n\n## SYNOPSIS\n\nuse Path::Class;\nmy $dir  = dir('foo', 'bar');       # Path::Class::Dir object\nmy $file = file('bob', 'file.txt'); # Path::Class::File object\n# Stringifies to 'foo/bar' on Unix, 'foo\\bar' on Windows, etc.\nprint \"dir: $dir\\n\";\n# Stringifies to 'bob/file.txt' on Unix, 'bob\\file.txt' on Windows\nprint \"file: $file\\n\";\nmy $subdir  = $dir->subdir('baz');  # foo/bar/baz\nmy $parent  = $subdir->parent;      # foo/bar\nmy $parent2 = $parent->parent;      # foo\nmy $dir2 = $file->dir;              # bob\n# Work with foreign paths\nuse Path::Class qw(foreignfile foreigndir);\nmy $file = foreignfile('Mac', ':foo:file.txt');\nprint $file->dir;                   # :foo:\nprint $file->asforeign('Win32');   # foo\\file.txt\n# Interact with the underlying filesystem:\n# $dirhandle is an IO::Dir object\nmy $dirhandle = $dir->open or die \"Can't read $dir: $!\";\n# $filehandle is an IO::File object\nmy $filehandle = $file->open($mode) or die \"Can't read $file: $!\";\n\n## DESCRIPTION\n\n\"Path::Class\" is a module for manipulation of file and directory specifications (strings\ndescribing their locations, like '/home/ken/foo.txt' or 'C:\\Windows\\Foo.txt') in a\ncross-platform manner. It supports pretty much every platform Perl runs on, including Unix,\nWindows, Mac, VMS, Epoc, Cygwin, OS/2, and NetWare.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **Notes on Cross-Platform Compatibility**\n- **AUTHOR**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Path::Class",
        "section": "",
        "mode": "perldoc",
        "summary": "Path::Class - Cross-platform path specification manipulation",
        "synopsis": "use Path::Class;\nmy $dir  = dir('foo', 'bar');       # Path::Class::Dir object\nmy $file = file('bob', 'file.txt'); # Path::Class::File object\n# Stringifies to 'foo/bar' on Unix, 'foo\\bar' on Windows, etc.\nprint \"dir: $dir\\n\";\n# Stringifies to 'bob/file.txt' on Unix, 'bob\\file.txt' on Windows\nprint \"file: $file\\n\";\nmy $subdir  = $dir->subdir('baz');  # foo/bar/baz\nmy $parent  = $subdir->parent;      # foo/bar\nmy $parent2 = $parent->parent;      # foo\nmy $dir2 = $file->dir;              # bob\n# Work with foreign paths\nuse Path::Class qw(foreignfile foreigndir);\nmy $file = foreignfile('Mac', ':foo:file.txt');\nprint $file->dir;                   # :foo:\nprint $file->asforeign('Win32');   # foo\\file.txt\n# Interact with the underlying filesystem:\n# $dirhandle is an IO::Dir object\nmy $dirhandle = $dir->open or die \"Can't read $dir: $!\";\n# $filehandle is an IO::File object\nmy $filehandle = $file->open($mode) or die \"Can't read $file: $!\";",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 31,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 66,
                "subsections": []
            },
            {
                "name": "Notes on Cross-Platform Compatibility",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Path::Class - Cross-platform path specification manipulation\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 0.37\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Path::Class;\n\nmy $dir  = dir('foo', 'bar');       # Path::Class::Dir object\nmy $file = file('bob', 'file.txt'); # Path::Class::File object\n\n# Stringifies to 'foo/bar' on Unix, 'foo\\bar' on Windows, etc.\nprint \"dir: $dir\\n\";\n\n# Stringifies to 'bob/file.txt' on Unix, 'bob\\file.txt' on Windows\nprint \"file: $file\\n\";\n\nmy $subdir  = $dir->subdir('baz');  # foo/bar/baz\nmy $parent  = $subdir->parent;      # foo/bar\nmy $parent2 = $parent->parent;      # foo\n\nmy $dir2 = $file->dir;              # bob\n\n# Work with foreign paths\nuse Path::Class qw(foreignfile foreigndir);\nmy $file = foreignfile('Mac', ':foo:file.txt');\nprint $file->dir;                   # :foo:\nprint $file->asforeign('Win32');   # foo\\file.txt\n\n# Interact with the underlying filesystem:\n\n# $dirhandle is an IO::Dir object\nmy $dirhandle = $dir->open or die \"Can't read $dir: $!\";\n\n# $filehandle is an IO::File object\nmy $filehandle = $file->open($mode) or die \"Can't read $file: $!\";\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "\"Path::Class\" is a module for manipulation of file and directory specifications (strings\ndescribing their locations, like '/home/ken/foo.txt' or 'C:\\Windows\\Foo.txt') in a\ncross-platform manner. It supports pretty much every platform Perl runs on, including Unix,\nWindows, Mac, VMS, Epoc, Cygwin, OS/2, and NetWare.\n\nThe well-known module File::Spec also provides this service, but it's sort of awkward to use\nwell, so people sometimes avoid it, or use it in a way that won't actually work properly on\nplatforms significantly different than the ones they've tested their code on.\n\nIn fact, \"Path::Class\" uses \"File::Spec\" internally, wrapping all the unsightly details so you\ncan concentrate on your application code. Whereas \"File::Spec\" provides functions for some\ncommon path manipulations, \"Path::Class\" provides an object-oriented model of the world of path\nspecifications and their underlying semantics. \"File::Spec\" doesn't create any objects, and its\nclasses represent the different ways in which paths must be manipulated on various platforms\n(not a very intuitive concept). \"Path::Class\" creates objects representing files and\ndirectories, and provides methods that relate them to each other. For instance, the following\n\"File::Spec\" code:\n\nmy $absolute = File::Spec->filenameisabsolute(\nFile::Spec->catfile( @dirs, $file )\n);\n\ncan be written using \"Path::Class\" as\n\nmy $absolute = Path::Class::File->new( @dirs, $file )->isabsolute;\n\nor even as\n\nmy $absolute = file( @dirs, $file )->isabsolute;\n\nSimilar readability improvements should happen all over the place when using \"Path::Class\".\n\nUsing \"Path::Class\" can help solve real problems in your code too - for instance, how many\npeople actually take the \"volume\" (like \"C:\" on Windows) into account when writing\n\"File::Spec\"-using code? I thought not. But if you use \"Path::Class\", your file and directory\nobjects will know what volumes they refer to and do the right thing.\n\nThe guts of the \"Path::Class\" code live in the Path::Class::File and Path::Class::Dir modules,\nso please see those modules' documentation for more details about how to use them.\n\nEXPORT\nThe following functions are exported by default.\n\nfile\nA synonym for \"Path::Class::File->new\".\n\ndir A synonym for \"Path::Class::Dir->new\".\n\nIf you would like to prevent their export, you may explicitly pass an empty list to perl's\n\"use\", i.e. \"use Path::Class ()\".\n\nThe following are exported only on demand.\n\nforeignfile\nA synonym for \"Path::Class::File->newforeign\".\n\nforeigndir\nA synonym for \"Path::Class::Dir->newforeign\".\n\ntempdir\nCreate a new Path::Class::Dir instance pointed to temporary directory.\n\nmy $temp = Path::Class::tempdir(CLEANUP => 1);\n\nA synonym for \"Path::Class::Dir->new(File::Temp::tempdir(@))\".\n",
                "subsections": []
            },
            "Notes on Cross-Platform Compatibility": {
                "content": "Although it is much easier to write cross-platform-friendly code with this module than with\n\"File::Spec\", there are still some issues to be aware of.\n\n*   On some platforms, notably VMS and some older versions of DOS (I think), all filenames must\nhave an extension. Thus if you create a file called foo/bar and then ask for a list of files\nin the directory foo, you may find a file called bar. instead of the bar you were expecting.\nThus it might be a good idea to use an extension in the first place.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Ken Williams, KWILLIAMS@cpan.org\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) Ken Williams. All rights reserved.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Path::Class::Dir, Path::Class::File, File::Spec\n",
                "subsections": []
            }
        }
    }
}