Skip to content

odyniec/File-PlainPath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

File::PlainPath - Construct portable filesystem paths in a simple way

VERSION

version 0.030

SYNOPSIS

use File::PlainPath qw(path);

# Forward slash is the default directory separator
my $path = path 'dir/subdir/file.txt';

# Set backslash as directory separator
use File::PlainPath -separator => '\\';   
my $other_path = path 'dir\\other_dir\\other_file.txt';

DESCRIPTION

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:

use File::PlainPath -separator => ':';
my $path = path 'dir:subdir:file.txt';

This is lexically scoped.

FUNCTIONS

path

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" 

to_path

An alias for "path". Use it when there's another module that exports a subroutine named path (such as File::Spec::Functions).

Example:

use File::PlainPath qw(to_path);

my $path = to_path 'dir/file.txt';

SEE ALSO

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at https://github.com/odyniec/File-PlainPath/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/odyniec/File-PlainPath

git clone https://github.com/odyniec/File-PlainPath.git

AUTHOR

Michal Wojciechowski <odyniec@cpan.org>

CONTRIBUTOR

Toby Inkster <tobyink@cpan.org>

COPYRIGHT AND LICENSE

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.

About

Construct portable filesystem paths in a simple way

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages