NAME

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

SYNOPSIS

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

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

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

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.20');

print Dumper($urls);

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

SUPPORT

Bugs / Feature Requests

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.

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/giterlizzi/perl-URI-PackageURL

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

AUTHOR

  • Giuseppe Di Terlizzi <gdt@cpan.org>

LICENSE AND COPYRIGHT

This software is copyright (c) 2022-2024 by Giuseppe Di Terlizzi.

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