.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "File::Spec::Link 3pm" .TH File::Spec::Link 3pm 2024-03-05 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME File::Spec::Link \- Perl extension for reading and resolving symbolic links .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 5 \& use File::Spec::Link; \& my $file = File::Spec::Link\->linked($link); \& my $file = File::Spec::Link\->resolve($link); \& my $dirname = File::Spec::Link\->chopfile($file); \& my $newname = File::Spec::Link\->relative_to_file($path, $link); \& \& my $realname = File::Spec::Link\->full_resolve($file); \& my $realname = File::Spec::Link\->resolve_path($file); \& my $realname = File::Spec::Link\->resolve_all($file); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`File::Spec::Link\*(C'\fR is an extension to \f(CW\*(C`File::Spec\*(C'\fR, adding methods for resolving symbolic links; it was created to implement \f(CW\*(C`File::Copy::Link\*(C'\fR. .ie n .IP linked($link) 4 .el .IP \f(CWlinked($link)\fR 4 .IX Item "linked($link)" Returns the filename linked to by \f(CW$link\fR: by \f(CW\*(C`readlink\*(C'\fRing \f(CW$link\fR, and resolving that path relative to the directory of \f(CW$link\fR. .ie n .IP resolve($link) 4 .el .IP \f(CWresolve($link)\fR 4 .IX Item "resolve($link)" Returns the non-link ultimately linked to by \f(CW$link\fR, by repeatedly calling \f(CW\*(C`linked\*(C'\fR. Returns \f(CW\*(C`undef\*(C'\fR if the link can not be resolved. .ie n .IP chopfile($file) 4 .el .IP \f(CWchopfile($file)\fR 4 .IX Item "chopfile($file)" Returns the directory of \f(CW$file\fR, by splitting the path of \f(CW$file\fR and returning (the volumne and) directory parts. .ie n .IP """relative_to_file($path, $file)""" 4 .el .IP "\f(CWrelative_to_file($path, $file)\fR" 4 .IX Item "relative_to_file($path, $file)" Returns the path of \f(CW$path\fR relative to the directory of file \&\f(CW$file\fR. If \f(CW$path\fR is absolute, just returns \f(CW$path\fR. .ie n .IP resolve_all($file) 4 .el .IP \f(CWresolve_all($file)\fR 4 .IX Item "resolve_all($file)" Returns the filename of \f(CW$file\fR with all links in the path resolved, wihout using \f(CW\*(C`Cwd\*(C'\fR. .ie n .IP full_resolve($file) 4 .el .IP \f(CWfull_resolve($file)\fR 4 .IX Item "full_resolve($file)" Returns the filename of \f(CW$file\fR with all links in the path resolved. .Sp This sub tries to use \f(CW\*(C`Cwd::abs_path\*(C'\fR via \f(CW\*(C`\->resolve_path\*(C'\fR. .ie n .IP resolve_path($file) 4 .el .IP \f(CWresolve_path($file)\fR 4 .IX Item "resolve_path($file)" Returns the filename of \f(CW$file\fR with all links in the path resolved. .Sp This sub uses \f(CW\*(C`Cwd::abs_path\*(C'\fR and is independent of the rest of \&\f(CW\*(C`File::Spec::Link\*(C'\fR. .SS "Object methods" .IX Subsection "Object methods" .ie n .IP new([$path]) 4 .el .IP \f(CWnew([$path])\fR 4 .IX Item "new([$path])" create new path object: stores path as a list .ie n .IP """path""" 4 .el .IP \f(CWpath\fR 4 .IX Item "path" returns path as a string, using catpath .ie n .IP """canonical""" 4 .el .IP \f(CWcanonical\fR 4 .IX Item "canonical" returns canonical path, using canonpath .ie n .IP """vol""" 4 .el .IP \f(CWvol\fR 4 .IX Item "vol" returns volume element of path, see File::Spec\->splitpath .ie n .IP """dir""" 4 .el .IP \f(CWdir\fR 4 .IX Item "dir" returns directory element of path, as a string, see File::Spec\->splitpath .ie n .IP """dirs""" 4 .el .IP \f(CWdirs\fR 4 .IX Item "dirs" return list of directory components in path, see File::Spec\->splitdir .ie n .IP """pop""" 4 .el .IP \f(CWpop\fR 4 .IX Item "pop" remove last component of the path .ie n .IP push($file) 4 .el .IP \f(CWpush($file)\fR 4 .IX Item "push($file)" add a file component to the path, ignoring empty strings .ie n .IP add($file) 4 .el .IP \f(CWadd($file)\fR 4 .IX Item "add($file)" add a component to the path: treating \f(CW\*(C`updir\*(C'\fR as \f(CW\*(C`pop\*(C'\fR, and ignoring \f(CW\*(C`curdir\*(C'\fR and empty strings .ie n .IP split($path) 4 .el .IP \f(CWsplit($path)\fR 4 .IX Item "split($path)" populate a path object, using splitpath .ie n .IP """chop""" 4 .el .IP \f(CWchop\fR 4 .IX Item "chop" remove and return a file component from path, an empty string returns means this was root dir. .ie n .IP relative($path) 4 .el .IP \f(CWrelative($path)\fR 4 .IX Item "relative($path)" replace the path object with the supplied path, where the new path is relative to the path object .ie n .IP """follow""" 4 .el .IP \f(CWfollow\fR 4 .IX Item "follow" follow the link, where the path object is a link .ie n .IP """resolved""" 4 .el .IP \f(CWresolved\fR 4 .IX Item "resolved" resolve the path object, by repeatedly following links .ie n .IP """resolvedir""" 4 .el .IP \f(CWresolvedir\fR 4 .IX Item "resolvedir" resolve the links at all component levels within the path object .SS "Other class methods" .IX Subsection "Other class methods" .ie n .IP canonpath($path) 4 .el .IP \f(CWcanonpath($path)\fR 4 .IX Item "canonpath($path)" Wrapper round File::Spec::canonpath, fatal if empty input .ie n .IP catdir(@dirs) 4 .el .IP \f(CWcatdir(@dirs)\fR 4 .IX Item "catdir(@dirs)" Wrapper round File::Spec::catdir, returns \f(CW\*(C`curdir\*(C'\fR from empty list .ie n .IP splitlast($path) 4 .el .IP \f(CWsplitlast($path)\fR 4 .IX Item "splitlast($path)" Get component from \f(CW$path\fR (using \f(CW\*(C`chop\*(C'\fR) and returns remaining path and compenent, as strings. [Not used] .SS EXPORT .IX Subsection "EXPORT" None \- all subs are methods for \f(CW\*(C`File::Spec::Link\*(C'\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBFile::Spec\fR\|(3) \fBFile::Copy::Link\fR\|(3) .SH AUTHOR .IX Header "AUTHOR" Robin Barker, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 2003, 2005, 2006, 2007, 2011, 2014 by Robin Barker .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.