NAME File::Symlink::Util - Utilities related to symbolic links VERSION This document describes version 0.001 of File::Symlink::Util (from Perl distribution File-Symlink-Util), released on 2021-12-02. SYNOPSIS use File::Symlink::Util qw( symlink_rel symlink_abs adjust_rel_symlink ); chdir "/home/ujang"; # create a relative path symlink symlink "/etc/passwd", "symlink1"; # symlink1 -> ../../etc/passwd symlink "../../etc/passwd", "symlink1"; # symlink1 -> ../../etc/passwd # create an absolute path symlink symlink "/etc/passwd", "symlink1"; # symlink1 -> ../../etc/passwd symlink "../../etc/passwd", "symlink1"; # symlink1 -> ../../etc/passwd # adjust second symlink to be relative to the second path symlink "dir1/target", "symlink1"; cp "symlink1", "dir2/symlink1"; # dir2/symlink2 points to dir1/target, which is now broken adjust_rel_symlink "symlink1", "dir2/symlink1"; # dir2/symlink2 now points to ../dir1/target DESCRIPTION FUNCTIONS symlink_rel Usage: symlink_rel($dest_path, $link_path); Create a relative path symlink. Basically perform "File::Spec->abs2rel($dest_path)" before "symlink()". symlink_abs Usage: symlink_rel($dest_path, $link_path); Create an absolute path symlink. Basically perform "File::Spec->rel2abs($dest_path)" before "symlink()". adjust_rel_symlink Usage: adjust_rel_symlink($link_path1, $link_path2); Adjust relative symlink in $link_path1 so that it becomes relative to $link_path2. This is useful if you copy a relative symlink from $link_path1 to $link_path2 and want the new symlink to point to the original target. Both $link_path1 and $link_path2 must be symlink. HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . SEE ALSO Other symlink-related routines File::Symlink::Relative provides "symlink_r" to create relative symlinks, which is the same as "symlink_rel". File::MoreUtil provides "file_exists" and "l_abs_path". AUTHOR perlancar CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via: % prove -l If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me. COPYRIGHT AND LICENSE This software is copyright (c) 2021 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.