NAME
    File::Object - Object system for filesystem paths.

SYNOPSIS
     use File::Object;
     my $obj = File::Object->new(%parameters);
     $obj->dir($dir);
     $obj->file($file);
     my $dir = $obj->get_dir($dir_num);
     my $file = $obj->get_file;
     $obj->reset;
     my $path = $obj->s;
     $obj->up($num);

METHODS
    "new(%parameters)"
            Constructor.

            *       "dir"

                     Directory path.

            *       "file"

                     File path.

            *       "type"

                     Type of path.
                     Types:
                     - file
                     - dir

    "dir(@dir)"
             Add directory or directories to object.
             Returns main object.

    "file(@file)"
             Add file or directory/directories with file to object.
             Returns main object.

    "get_dir($dir_num)"
             Returns $dir_num level directory.
             Default value of $dir_num is 1.

    "get_file()"
             Returns:
             - Filename if object is file path.
             - undef if object is directory path.

    "reset()"
             Reset to constructor values.

    "s()"
             Serialize path and return.

    "up($up_num)"
             Go to $up_num upper directory. 
             Returns main object.

ERRORS
     Mine:
             'dir' parameter must be a reference to array.
             Bad 'type' parameter.
             Cannot go up.
                     PATH -> path;

     From Class::Utils::set_params():
             Unknown parameter '%s'.

EXAMPLE1
     # Pragmas.
     use strict;
     use warnings;

     # Modules.
     use File::Object;

     # Print actual directory path.
     print File::Object->new->s."\n";

EXAMPLE2
     # Pragmas.
     use strict;
     use warnings;

     # Modules.
     use File::Object;

     # Print parent directory path.
     print File::Object->new->up->s."\n";

EXAMPLE3
     # Pragmas.
     use strict;
     use warnings;

     # Modules.
     use File::Object;

     # Object with directory path.
     my $obj = File::Object->new(
             'dir' => ['path', 'to', 'subdir'],
     );

     # Relative path to file1.
     print $obj->file('file1')->s."\n";

     # Relative path to file2.
     print $obj->file('file2')->s."\n";

     # Output:
     # path/to/subdir/file1
     # path/to/subdir/file2

EXAMPLE4
     # Pragmas.
     use strict;
     use warnings;

     # Modules.
     use File::Object;

     # Object with directory path.
     my $obj = File::Object->new(
             'dir' => ['path', 'to', 'subdir'],
     );

     # Relative path to dir1.
     print $obj->dir('dir1')->s."\n";

     # Relative path to dir2.
     print $obj->reset->dir('dir2')->s."\n";

     # Output:
     # path/to/subdir/dir1
     # path/to/subdir/dir2

DEPENDENCIES
    Class::Utils, Error::Pure, FindBin, File::Spec::Functions.

REPOSITORY
    <https://github.com/tupinek/File-Object>

AUTHOR
    Michal Špaček <mailto:skim@cpan.org>

    <http://skim.cz>

LICENSE AND COPYRIGHT
    BSD license.

VERSION
    0.02

