logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

String::License - detect source code license statements in a text string

Author

       Jonas Smedegaard "<dr@jones.dk>"

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.

Description

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

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.

Name

       String::License - detect source code license statements in a text string

Synopsis

           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

See Also