logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Path::Class::URI - Serializes and deserializes Path::Class objects as file:// URI

Author

       Tatsuhiko Miyagawa <miyagawa@cpan.org>

Description

       Path::Class::URI is an extension to Path::Class to serialize file path from and to file:// form URI
       objects.

       This module encodes and decodes non URI-safe characters using its literal byte encodings. If you call uri
       methods on Win32 Path::File objects, you'll get local filename encodings.

       If you want to avoid that and always use UTF-8 filename encodings in URI, see Path::Class::Unicode
       bundled in this distribution.

License

       This  library  is  free  software;  you can redistribute it and/or modify it under the same terms as Perl
       itself.

Methods

       uri (Path::Class::Entity)
             $uri = $file->uri;
             $uri = $dir->uri;

           returns URI object representing Path::Class file and directory.

       from_uri (Path::Class::Entity)
             $file = Path::Class::File->from_uri($uri);
             $dir  = Path::Class::Dir->from_uri($uri);

           Deserializes URI object (or string) into Path::Class objects.

       file_from_uri, dir_from_uri
           Shortcuts for those from_uri methods. Exported by default.

Name

       Path::Class::URI - Serializes and deserializes Path::Class objects as file:// URI

See Also

       Path::Class, URI::file

perl v5.36.0                                       2023-02-11                              Path::Class::URI(3pm)

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;

See Also