Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Release Actions Status License Starts Forks Issues Coverage Status

URI::PackageURL - Perl extension for Package URL (aka "purl")

Synopsis

use URI::PackageURL;

# OO-interface

# Encode components in PackageURL string
$purl = URI::PackageURL->new(type => cpan, namespace => 'GDT', name => 'URI-PackageURL', version => '2.23');

say $purl; # pkg:cpan/GDT/URI-PackageURL@2.23

# Parse PackageURL string
$purl = URI::PackageURL->from_string('pkg:cpan/GDT/URI-PackageURL@2.23');


# use setter methods

my $purl = URI::PackageURL->new(type => 'cpan', namespace => 'GDT', name => 'URI-PackageURL');

say $purl; # pkg:cpan/GDT/URI-PackageURL
say $purl->version; # undef

$purl->version('2.23');
say $purl; # pkg:cpan/GDT/URI-PackageURL@2.23
say $purl->version; # 2.23


# exported functions

$purl = decode_purl('pkg:cpan/GDT/URI-PackageURL@2.23');
say $purl->type;  # cpan

$purl_string = encode_purl(type => cpan, namespace => 'GDT', name => 'URI::PackageURL', version => '2.23');

purl-tool a CLI for URI::PackageURL module

Inspect and export "purl" string in various formats (JSON, YAML, Data::Dumper, ENV):

$ purl-tool pkg:cpan/GDT/URI-PackageURL@2.23 --json | jq
{
  "name": "URI-PackageURL",
  "namespace": "GDT",
  "qualifiers": {},
  "subpath": null,
  "type": "cpan",
  "version": "2.23"
}

Download package using "purl" string:

$ wget $(purl-tool pkg:cpan/GDT/URI-PackageURL@2.23 --download-url)

Use "purl" string in your shell-scripts:

#!bash

set -e 

PURL="pkg:cpan/GDT/URI-PackageURL@2.23"

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:

$ purl-tool --type cpan \
            --namespace GDT \
            --name URI-PackageURL \
            --version 2.23

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

Copyright

  • Copyright 2022-2025 © Giuseppe Di Terlizzi

About

Perl extension for Package URL

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages