The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

File::RelDir - Perl module that returns relative path between two directories

SYNOPSIS

   use File::RelDir;

   $ref=File::RelDir->New("/tmp/here");

   $relative_path = $ref->Path("/tmp/there");

   #returns "../there"

   $ref=File::RelDir->New('d:\users\me\excel');

   $relative_path = $ref->Path('d:\users\me\word');

   #returns '../word'

   $relative_path = File::RelDir->Diff('d:\users\me\excel',  e:\users\me\word');

   #returns undef

   $relative_path = File::RelDir->Diff('d:\users\me\excel',  d:\users\me\word');

   #returns '../word'

DESCRIPTION

The File:RelDir provides a mechanism to determine the relative path between two directory structures. It honours case sensitivity unless one (or both) the paths compared appears to be a windows path, when it becomes case insensitive.

It returns undef when no similarity between the directories supplied is determined.

METHODS

New(DirA)

The New method establishes a reference based on the directory name provided.

Path(DirB)

The Path method returns the relative path to the directory name supplied, or undef in the event the two directories are not compatible.

The case of the relative path is retained (wether a windows style case insensitive directory comparison was performed). The directory seperator will be forward slash based (/), unless a backslash (\) based directory path is provided to the New call.

Diff(DirA,DirB)

The Diff method provides a simpler method of achieving the same end for the occasional relative path, use New and Path if you have multiple calls on the same base directory.

REQUIRED MODULES

None.

AUTHOR

Dave Roberts <droberts@cpan.org>

SUPPORT

You can send bug reports and suggestions for improvements on this module to me at droberts@cpan.org. However, I can't promise to offer any other support for this package.

COPYRIGHT

This module is Copyright © 2012 Dave Roberts. All rights reserved.

This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The copyright holder of this script can not be held liable for any general, special, incidental or consequential damages arising out of the use of the script.

CHANGE HISTORY

1 POD Error

The following errors were encountered while parsing the POD:

Around line 210:

Non-ASCII character seen before =encoding in '©'. Assuming CP1252