method splitpath
Documentation for method splitpath
assembled from the following types:
class IO::Spec::Cygwin
From IO::Spec::Cygwin
(IO::Spec::Cygwin) method splitpath
Defined as:
method splitpath(|c --> List)
Same as IO::Spec::Win32.splitpath
, except replaces backslashes with slashes in all the values of the final result.
class IO::Spec::Unix
From IO::Spec::Unix
(IO::Spec::Unix) method splitpath
Defined as:
method splitpath(Cool , : --> List)
Splits the given $path
into a list of 3 strings: volume, dirname, and file. The volume is always an empty string, returned for API compatibility with other IO::Spec types. If :$nofile
named argument is set to True
, the content of the file string is undefined and should be ignored; this is a means to get a performance boost, as implementations may use faster code path when file is not needed.
IO::Spec::Unix.splitpath('C:\foo/bar.txt').perl.say;# OUTPUT: «("", "C:\\foo/", "bar.txt")»IO::Spec::Unix.splitpath('C:\foo/bar.txt', :nofile).perl.say;# OUTPUT: «("", "C:\\foo/bar.txt", "")»IO::Spec::Unix.splitpath('/foo/').perl.say;# OUTPUT: «("", "/foo/", "")»IO::Spec::Unix.splitpath('/foo/', :nofile).perl.say;# OUTPUT: «("", "/foo/", "")»IO::Spec::Unix.splitpath('///').perl.say;# OUTPUT: «("", "///", "")»IO::Spec::Unix.splitpath('./').perl.say;# OUTPUT: «("", "./", "")»IO::Spec::Unix.splitpath('.').perl.say;# OUTPUT: «("", "", ".")»IO::Spec::Unix.splitpath('').perl.say;# OUTPUT: «("", "", "")»
class IO::Spec::Win32
From IO::Spec::Win32
(IO::Spec::Win32) method splitpath
Defined as:
method splitpath(Cool , : --> List)
Splits the given $path
into a list of 3 strings: volume, dirname, and file. The volume is always an empty string, returned for API compatibility with other IO::Spec types. If :$nofile
named argument is set to True
, the content of the file string is undefined and should be ignored; this is a means to get a performance boost, as implementations may use faster code path when file is not needed.
IO::Spec::Win32.splitpath('C:\foo/bar.txt').perl.say;# OUTPUT: «("C:", "\\foo/", "bar.txt")»IO::Spec::Win32.splitpath('C:\foo/bar.txt', :nofile).perl.say;# OUTPUT: «("C:", "\\foo/bar.txt", "")»IO::Spec::Win32.splitpath('/foo/').perl.say;# OUTPUT: «("", "/foo/", "")»IO::Spec::Win32.splitpath('/foo/', :nofile).perl.say;# OUTPUT: «("", "/foo/", "")»IO::Spec::Win32.splitpath('///').perl.say;# OUTPUT: «("", "///", "")»IO::Spec::Win32.splitpath('./').perl.say;# OUTPUT: «("", "./", "")»IO::Spec::Win32.splitpath('.').perl.say;# OUTPUT: «("", "", ".")»IO::Spec::Win32.splitpath('').perl.say;# OUTPUT: «("", "", "")»