Scroll to navigation

URI::PackageURL::Util(3pm) User Contributed Perl Documentation URI::PackageURL::Util(3pm)

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.25');
  $filename = basename($urls->{download});
  $ua->mirror($urls->{download}, "/tmp/$filename");

DESCRIPTION

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

EXPORTED FUNCTIONS

purl_types

    use URI::PackageURL::Util qw(purl_types);
    @types = purl_types();

Return the list of known PURL types.

purl_to_urls

    use URI::PackageURL::Util qw(purl_to_urls);
    $urls = purl_to_urls($purl_string // URI::PackageURL->new(...));

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.25');
  print Dumper($urls);
  # $VAR1 = {
  #   'repository' => 'https://metacpan.org/release/GDT/URI-PackageURL-2.25',
  #   'download'   => 'http://www.cpan.org/authors/id/G/GD/GDT/URI-PackageURL-2.25.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-2026 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.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

=back without =over
2026-01-31 perl v5.40.1