Path::Class::URI(3pm)
π Path::Class::URI π
okay bestie, so this is Path::Class::URI β it serializes and deserializes Path::Class objects as file:// URI β¨ (yes, both directions, she does it all π
)
πΈ SYNOPSIS πΈ
use Path::Class;
use Path::Class::URI;
my $file = file('bob', 'john.txt');
my $uri = $file->uri; # file:bob/john.txt
file('', 'tmp', 'bar.txt')->uri; # file:///tmp/bar.txt
my $file = file_from_uri("file:///tmp/bar.txt"); # or URI::file object
$fh = $file->open;
π¦ DESCRIPTION π¦
So Path::Class::URI is an extension to Path::Class that lets you serialize a file path from and to file:// form URI objects. it's giving glow-up for your paths, fr fr π«Ά
This module encodes and decodes non URI-safe characters using its literal byte encodings. And heads up: if you call uri methods on Win32 Path::File objects, you'll get local filename encodings. that's just how she is π
If you want to avoid that and always use UTF-8 filename encodings in URI, go check out Path::Class::Unicode, which is bundled in this distribution. she's the sister module, no cap π
π METHODS π
β¨ uri (Path::Class::Entity)
$uri = $file->uri;
$uri = $dir->uri;
returns a URI object representing Path::Class file and directory. periodt π
β¨ from_uri (Path::Class::Entity)
$file = Path::Class::File->from_uri($uri);
$dir = Path::Class::Dir->from_uri($uri);
Deserializes a URI object (or a string, she's flexible like that π) into Path::Class objects.
β¨ file_from_uri, dir_from_uri
Shortcuts for those from_uri methods. Exported by default π so you don't even have to ask, she's already there.
π AUTHOR π
Tatsuhiko Miyagawa <miyagawa@cpan.org> β icon, legend, the moment π
π LICENSE π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
π₯ SEE ALSO π₯
Path::ClassURI::file
mwah π that's the whole page bestie. this one's from perl v5.36.0, dated 2023-02-11 β go forth and URI-ify ur paths, ily π«Άβ¨
π¦ where this page comes from
- debian trixie: libpath-class-uri-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libpath-class-uri-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libpath-class-uri-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libpath-class-uri-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms