File::PlainPath - Construct portable filesystem paths in a simple way
version 0.02
use File::PlainPath qw(path); # Forward slash is the default directory separator my $path = path 'dir/subdir/file.txt'; # Set backslash as directory separator File::PlainPath::set_separator('\\'); my $other_path = path 'dir\\other_dir\\other_file.txt';
File::PlainPath translates filesystem paths that use a common directory separator to OS-specific paths. It allows you to replace constructs like this:
my $path = File::Spec->catfile('dir', 'subdir', 'file.txt');
with a simpler notation:
my $path = path 'dir/subdir/file.txt';
The default directory separator used in paths is the forward slash (/), but any other character can be designated as the separator:
/
File::PlainPath::set_separator(':'); my $path = path 'dir:subdir:file.txt';
Translates the provided path to OS-specific format. If more than one path is specified, the paths are concatenated to produce the resulting path.
Examples:
my $path = path 'dir/file.txt'; my $path = path 'dir', 'subdir/file.txt'; # On Unix, this produces: "dir/subdir/file.txt"
An alias for "path". Use it when there's another module that exports a subroutine named path (such as File::Spec::Functions).
path
Example:
use File::PlainPath qw(to_path); my $path = to_path 'dir/file.txt';
Sets the character to be used as directory separator.
File::PlainPath::set_separator(':');
File::Spec
Michal Wojciechowski <odyniec@cpan.org>
This software is copyright (c) 2012 by Michal Wojciechowski.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install File::PlainPath, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::PlainPath
CPAN shell
perl -MCPAN -e shell install File::PlainPath
For more information on module installation, please visit the detailed CPAN module installation guide.