use FP::Equal; use FP::Path; my $p= FP::Path->new_from_string ("a/../b/C") ->add(FP::Path->new_from_string("../d/../e"), 0); is $p->string, 'a/../b/C/../d/../e'; is $p->xclean->string, 'b/e'; ok not equal($p->xclean, $p); ok equal($p->xclean, $p->xclean); # obviously, assuming purity # or use the (evil?) constructor function export feature: use FP::Path "path"; is path("a/../b/C")->xclean->string, "b/C";
Not really sure why I'm creating something from scratch here? It might be cleaner:
This doesn't do I/O (access the file system, ask the system for the hostname, etc.), and it doesn't resolve ".." unless when told to (`perhaps_clean_dotdot` and derived methods (incl. `xclean` etc.)).
Port / merge with https://github.com/pflanze/chj-schemelib/blob/master/cj-posixpath.scm ?
Provide `string_to_path` constructor function?
FP::Path::t for the test suite
This is alpha software! Read the status section in the package README or on the website.