String::License(3pm)

String::License3pm

Detect source code license statements in a text string

Usage

    use String::License;
    use String::License::Naming::Custom;
    my $string = 'Licensed under same terms as Perl itself';
    my $expressed  = String::License->new( string => $string );
    my $expression = $expressed->as_text;  # => "Perl"
    my $desc        = String::License::Naming::Custom->new;
    my $described   = String::License->new( string => $string, naming => $desc );
    my $description = $described->as_text;  # => "The Perl 5 License"

Version

Version v0.0.11

Overview

String::License identifies license statements in a string and serializes them in a normalized format.

Constructor

new
    my $licensed = String::License->new( string => 'Licensed under GPLv2' );

Accepts named arguments, and constructs and returns a String::License object.

The following options are recognized:

string => STRING

The scalar string to parse for licensing information.

naming => OBJ

A String::License::Naming object, used to define license naming conventions.

By default uses String::License::Naming::SPDX.

Since instantiation of naming schemes is expensive, there can be a significant speed boost in passing a pre-initialized naming object when processing multiple strings.

Methods

as_text

Returns identified licensing patterns as a string, either structured as SPDX License Expressions, or with scheme-less naming as a short description.

Releases

2 releases since Debian 12 (Bookworm); the text changed 1 time.

  1. 12
  2. 13

Author

Jonas Smedegaard "<[email protected]>"

From libstring-license-perl 0.0.11-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.