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

URI::PackageURL::Util - Utility for URI::PackageURL

Author

       •   Giuseppe Di Terlizzi <gdt@cpan.org>

Description

       URL::PackageURL::Util is the utility package for URL::PackageURL.

       %normalized_purl_components = purl_components_normalize(%purl_components)
           Normalize the given Package URL components

       $urls = purl_to_urls($purl_string | URI::PackageURL)
           Converts  the  given  Package  URL  string  or  URI::PackageURL  instance  and  return  the hash with
           "repository" and/or "download" URL.

           NOTE: This utility support few purl  types  ("bitbucket",   "cargo",  "composer",  "cpan",  "docker",
           "gem", "github", "gitlab", "luarocks", "maven", "npm", "nuget", "pypi").

             +-----------+------------+--------------+
             | Type      | Repository | Download (*) |
             +-----------+------------+--------------|
             | bitbucket | YES        | YES          |
             | cargo     | YES        | YES          |
             | composer  | YES        | NO           |
             | cpan      | YES        | YES          |
             | docker    | YES        | NO           |
             | gem       | YES        | YES          |
             | generic   | NO         | YES (**)     |
             | github    | YES        | YES          |
             | gitlab    | YES        | YES          |
             | luarocks  | YES        | NO           |
             | maven     | YES        | YES          |
             | npm       | YES        | YES          |
             | nuget     | YES        | YES          |
             | pypi      | YES        | NO           |
             |-----------|------------|--------------+

           (*)  Only with version component (**) Only if download_url qualifier is provided

             $urls = purl_to_urls('pkg:cpan/GDT/URI-PackageURL@2.22');

             print Dumper($urls);

             # $VAR1 = {
             #           'repository' => 'https://metacpan.org/release/GDT/URI-PackageURL-2.22',
             #           'download' => 'http://www.cpan.org/authors/id/G/GD/GDT/URI-PackageURL-2.22.tar.gz'
             #         };

Name

       URI::PackageURL::Util - Utility for URI::PackageURL

Support

Bugs/FeatureRequests
       Please     report    any    bugs    or    feature    requests    through    the    issue    tracker    at
       <https://github.com/giterlizzi/perl-URI-PackageURL/issues>.  You will be notified  automatically  of  any
       progress on your issue.

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

       <https://github.com/giterlizzi/perl-URI-PackageURL>

           git clone https://github.com/giterlizzi/perl-URI-PackageURL.git

Synopsis

         use URI::PackageURL::Util qw(purl_to_urls);

         $urls = purl_to_urls('pkg:cpan/GDT/URI-PackageURL@2.22');

         $filename = basename($urls->{download});
         $ua->mirror($urls->{download}, "/tmp/$filename");

See Also