1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
[](https://github.com/giterlizzi/perl-URI-PackageURL/releases) [](https://github.com/giterlizzi/perl-URI-PackageURL/actions) [](https://github.com/giterlizzi/perl-URI-PackageURL) [](https://github.com/giterlizzi/perl-URI-PackageURL) [](https://github.com/giterlizzi/perl-URI-PackageURL) [](https://github.com/giterlizzi/perl-URI-PackageURL/issues) [](https://coveralls.io/github/giterlizzi/perl-URI-PackageURL)
# URI::PackageURL - Perl extension for Package URL (aka "purl")
## Synopsis
```.pl
use URI::PackageURL;
# OO-interface
# Encode components in PackageURL string
$purl = URI::PackageURL->new(type => cpan, namespace => 'GDT', name => 'URI-PackageURL', version => '2.21');
say $purl; # pkg:cpan/GDT/URI-PackageURL@2.21
# Parse PackageURL string
$purl = URI::PackageURL->from_string('pkg:cpan/GDT/URI-PackageURL@2.21');
# exported functions
$purl = decode_purl('pkg:cpan/GDT/URI-PackageURL@2.21');
say $purl->type; # cpan
$purl_string = encode_purl(type => cpan, namespace => 'GDT', name => 'URI::PackageURL', version => '2.21');
```
## purl-tool a CLI for URI::PackageURL module
Inspect and export "purl" string in various formats (JSON, YAML, Data::Dumper, ENV):
```console
$ purl-tool pkg:cpan/GDT/URI-PackageURL@2.21 --json | jq
{
"name": "URI-PackageURL",
"namespace": "GDT",
"qualifiers": {},
"subpath": null,
"type": "cpan",
"version": "2.21"
}
```
Download package using "purl" string:
```console
$ wget $(purl-tool pkg:cpan/GDT/URI-PackageURL@2.21 --download-url)
```
Use "purl" string in your shell-scripts:
```.bash
#!bash
set -e
PURL="pkg:cpan/GDT/URI-PackageURL@2.21"
eval $(purl-tool "$PURL" --env)
echo "Download $PURL_NAME $PURL_VERSION"
wget $PURL_DOWNLOAD_URL
echo "Build and install module $PURL_NAME $PURL_VERSION"
tar xvf $PURL_NAME-$PURL_VERSION.tar.gz
cd $PURL_NAME-$PURL_VERSION
perl Makefile.PL
make && make install
```
Create on-the-fly a "purl" string:
```console
$ purl-tool --type cpan \
--namespace GDT \
--name URI-PackageURL \
--version 2.21
```
## Install
Using Makefile.PL:
To install `URI::PackageURL` distribution, run the following commands.
perl Makefile.PL
make
make test
make install
Using App::cpanminus:
cpanm URI::PackageURL
## Documentation
- `perldoc URI::PackageURL`
- https://metacpan.org/release/URI-PackageURL
- https://github.com/package-url/purl-spec
## Copyright
- Copyright 2022-2024 © Giuseppe Di Terlizzi
|