Skip to content

Commit 2a954d5

Browse files
committed
Updated documentations
1 parent a1b0a2b commit 2a954d5

File tree

8 files changed

+140
-86
lines changed

8 files changed

+140
-86
lines changed

lib/URI/PackageURL.pm

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use constant DEBUG => $ENV{PURL_DEBUG};
1717

1818
use overload '""' => 'to_string', fallback => 1;
1919

20-
our $VERSION = '2.23_7';
20+
our $VERSION = '2.23_8';
2121
our @EXPORT = qw(encode_purl decode_purl);
2222

2323
my $PURL_REGEXP = qr{^pkg:(([/]{1,})?)([A-Za-z][A-Za-z0-9\.\-]*)([/]{1,}).+};
@@ -363,6 +363,9 @@ sub _url_decode {
363363
1;
364364

365365
__END__
366+
367+
=encoding utf-8
368+
366369
=head1 NAME
367370
368371
URI::PackageURL - Perl extension for PURL (Package URL)
@@ -458,7 +461,7 @@ Components are separated by a specific character for unambiguous parsing.
458461
459462
The definition for each components is:
460463
461-
=over
464+
=over 2
462465
463466
=item * "scheme": this is the URL scheme with the constant value of "pkg".
464467
One of the primary reason for this single scheme is to facilitate the future
@@ -486,7 +489,7 @@ Optional.
486489
487490
C<cpan> is an official PURL type (L<https://github.com/package-url/purl-spec/blob/main/types-doc/cpan-definition.md>)
488491
489-
=over
492+
=over 2
490493
491494
=item * The default repository is C<https://www.cpan.org/>.
492495
@@ -528,98 +531,94 @@ B<NOTE>: This is only to be used for compatibility purposes (it will be removed
528531
529532
They are exported by default:
530533
531-
=over
534+
=head3 B<encode_purl>
532535
533-
=item $purl_string = encode_purl(%purl_components)
536+
$purl_string = encode_purl(%purl_components)
534537
535538
Converts the given PURL components to PURL string. Croaks on error.
536539
537540
This function call is functionally identical to:
538541
539542
$purl_string = URI::PackageURL->new(%purl_components)->to_string;
540543
541-
=item $purl_components = decode_purl($purl_string)
544+
=head3 B<decode_purl>
545+
546+
$purl_components = decode_purl($purl_string)
542547
543548
Converts the given PURL string to PURL components. Croaks on error.
544549
545550
This function call is functionally identical to:
546551
547552
$purl = URI::PackageURL->from_string($purl_string);
548553
549-
=back
550-
551554
=head2 OBJECT-ORIENTED INTERFACE
552555
553-
=over
554-
555-
=item $purl = URI::PackageURL->new(%components)
556-
557-
Create new B<URI::PackageURL> instance using provided PURL components
558-
(type, name, version, etc).
556+
=head3 B<new>
559557
560-
=item $purl = PURL->new(%components)
558+
$purl = URI::PackageURL->new(%components)
559+
$purl = PURL->new(%components)
561560
562-
Create new B<URI::PackageURL> instance using provided PURL components
561+
Create new L<URI::PackageURL> instance using provided PURL components
563562
(type, name, version, etc).
564563
565-
=item $purl->scheme
564+
=head3 B<scheme>
566565
567566
The scheme is a constant with the value "pkg".
568567
569-
=item $purl->type
568+
=head3 B<type>
570569
571570
The package "type" or package "protocol" such as cpan, maven, npm, nuget, gem, pypi, etc.
572571
573-
=item $purl->namespace
572+
=head3 B<namespace>
574573
575574
Some name prefix such as a Maven groupid, a Docker image owner, a GitHub user or
576575
organization. Optional and type-specific.
577576
578-
=item $purl->name
577+
=head3 B<name>
579578
580579
The "name" of the package.
581580
582-
=item $purl->version
581+
=head3 B<version>
583582
584583
The "version" of the package.
585584
586-
=item $purl->qualifiers
585+
=head3 B<qualifiers>
587586
588587
Extra qualifying data for a package such as an OS, architecture, a distro, etc.
589588
590-
=item $purl->subpath
589+
=head3 B<subpath>
591590
592591
Extra subpath within a package, relative to the package root.
593592
594-
=item $purl->to_string
593+
=head3 B<to_string>
595594
596595
Stringify Package URL components.
597596
598-
=item $purl->to_urls
597+
=head3 B<to_urls>
599598
600599
Return B<download> and/or B<repository> URLs.
601600
602-
=item $purl->download_url
601+
=head3 B<download_url>
603602
604603
Return B<download> URL.
605604
606605
See C<purl_to_urls> in L<URI::PackageURL::Util>.
607606
608-
=item $purl->repository_url
607+
=head3 B<repository_url>
609608
610609
Return B<repository> URL.
611610
612611
See C<purl_to_urls> in L<URI::PackageURL::Util>.
613612
614-
=item $purl->to_hash
613+
=head3 B<to_hash>
615614
616615
Turn PURL components into a hash reference.
617616
618-
=item $purl->definition
617+
=head3 B<definition>
619618
620619
Return L<URI::PackageURL::Type> instance.
621620
622-
=item $purl->clone
621+
=head3 B<clone>
623622
624623
Clone PURL object.
625624
@@ -630,7 +629,7 @@ Clone PURL object.
630629
say $cloned; # pkg:cpan/GDT/URI-PackageURL@1.00
631630
say $purl; # pkg:cpan/GDT/URI-PackageURL@2.23
632631
633-
=item $purl->TO_JSON
632+
=head3 B<TO_JSON>
634633
635634
Helper method for JSON modules (L<JSON>, L<JSON::PP>, L<JSON::XS>, L<Cpanel::JSON::XS>, L<Mojo::JSON>, etc).
636635
@@ -648,11 +647,13 @@ Helper method for JSON modules (L<JSON>, L<JSON::PP>, L<JSON::XS>, L<Cpanel::JSO
648647
# "version" : "2.23"
649648
# }
650649
651-
=item $purl = URI::PackageURL->from_string($purl_string);
650+
=head3 B<from_string>
652651
653-
Converts the given PURL string to PURL components. Croaks on error.
652+
$purl = URI::PackageURL->from_string($purl_string);
653+
$purl = PURL->from_string($purl_string);
654654
655-
=back
655+
Converts the given PURL string to PURL components and return L<URI::PackageURL>
656+
instance. Croaks on error.
656657
657658
658659
=head1 SUPPORT
@@ -675,7 +676,7 @@ L<https://github.com/giterlizzi/perl-URI-PackageURL>
675676
676677
=head1 AUTHOR
677678
678-
=over 4
679+
=over
679680
680681
=item * Giuseppe Di Terlizzi <gdt@cpan.org>
681682

lib/URI/PackageURL/Type.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use List::Util qw(first);
1313

1414
use constant DEBUG => $ENV{PURL_DEBUG};
1515

16-
our $VERSION = '2.23_7';
16+
our $VERSION = '2.23_8';
1717

1818

1919
my %ALGO_LENGTH = ('md5' => 32, 'sha1' => 40, 'sha256' => 64, 'sha384' => 96, 'sha512' => 128);
@@ -526,7 +526,7 @@ L<https://github.com/giterlizzi/perl-URI-PackageURL>
526526
527527
=head1 AUTHOR
528528
529-
=over 4
529+
=over
530530
531531
=item * Giuseppe Di Terlizzi <gdt@cpan.org>
532532

lib/URI/PackageURL/Util.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use warnings;
77

88
use Exporter qw(import);
99

10-
our $VERSION = '2.23_7';
10+
our $VERSION = '2.23_8';
1111
our @EXPORT = qw(purl_to_urls);
1212

1313

@@ -518,7 +518,7 @@ L<https://github.com/giterlizzi/perl-URI-PackageURL>
518518
519519
=head1 AUTHOR
520520
521-
=over 4
521+
=over
522522
523523
=item * Giuseppe Di Terlizzi <gdt@cpan.org>
524524

lib/URI/VersionRange.pm

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use overload '""' => 'to_string', fallback => 1;
2121

2222
BEGIN { *VERS:: = *URI::VersionRange:: }
2323

24-
our $VERSION = '2.23_7';
24+
our $VERSION = '2.23_8';
2525
our @EXPORT = qw(encode_vers decode_vers);
2626

2727
my $VERS_REGEXP = qr{^vers:[a-z\\.\\-\\+][a-z0-9\\.\\-\\+]*/.+};
@@ -308,6 +308,9 @@ sub _pairwise {
308308
1;
309309

310310
__END__
311+
312+
=encoding utf-8
313+
311314
=head1 NAME
312315
313316
URI::VersionRange - Perl extension for VERS (Version Range Specifier)
@@ -380,50 +383,53 @@ L<TC54 - Software and system transparency|https://tc54.org/>
380383
381384
They are exported by default:
382385
383-
=over
386+
=head3 B<encode_vers>
384387
385-
=item $vers_string = encode_vers(%params);
388+
$vers_string = encode_vers(%params);
386389
387390
Converts the given C<vers> components to "vers" string. Croaks on error.
388391
389392
This function call is functionally identical to:
390393
391394
$vers_string = URI::VersionRange->new(%params)->to_string;
392395
393-
=item $vers = decode_vers($vers_string);
396+
=head3 B<decode_vers>
397+
398+
$vers = decode_vers($vers_string);
394399
395400
Converts the given "vers" string to L<URI::VersionRange> object. Croaks on error.
396401
397402
This function call is functionally identical to:
398403
399404
$vers = URI::VersionRange->from_string($vers_string);
400405
401-
=back
402406
403407
=head2 OBJECT-ORIENTED INTERFACE
404408
405-
=over
409+
=head3 B<new>
406410
407-
=item $vers = URI::VersionRange->new( scheme => STRING, constraints => ARRAY )
411+
$vers = URI::VersionRange->new( scheme => STRING, constraints => ARRAY )
412+
$vers = VERS->new( scheme => STRING, constraints => ARRAY )
408413
409-
Create new B<URI::VersionRange> instance using provided VERS components
414+
Create new L<URI::VersionRange> instance using provided VERS components
410415
(scheme, constraints).
411416
412-
=item $vers = VERS->new( scheme => STRING, constraints => ARRAY )
413-
414-
Create new B<URI::VersionRange> instance using provided VERS components
415-
(scheme, constraints).
417+
=head3 B<scheme>
416418
417-
=item $vers->scheme
419+
$vers->scheme
418420
419421
By convention the versioning scheme should be the same as the L<URI::PackageURL>
420422
package C<type> for a given package ecosystem.
421423
422-
=item $vers->constraints
424+
=head3 B<constraints>
425+
426+
$vers->constraints
423427
424428
C<constraints> is ARRAY of L<URI::VersionRange::Constraint> object.
425429
426-
=item $vers->contains($version)
430+
=head3 B<contains>
431+
432+
$vers->contains($version)
427433
428434
Check if a version is contained within a range
429435
@@ -435,33 +441,58 @@ Check if a version is contained within a range
435441
436442
See L<URI::VersionRange::Version>.
437443
438-
=item $vers->constraint_contains
444+
=head3 B<constraint_contains>
445+
446+
$vers->constraint_contains
439447
440448
Check if a version is contained within a specific constraint.
441449
442450
See L<URI::VersionRange::Version>.
443451
444-
=item $vers->to_hash
452+
=head3 B<to_hash>
453+
454+
$vers->to_hash
445455
446456
Turn VERS components into a hash reference.
447457
448-
=item $vers->to_string
458+
=head3 B<to_string>
459+
460+
$vers->to_string
449461
450462
Stringify VERS components.
451463
452-
=item $vers->TO_JSON
464+
=head3 B<TO_JSON>
465+
466+
$vers->TO_JSON
453467
454468
Helper method for JSON modules (L<JSON>, L<JSON::PP>, L<JSON::XS>, L<Mojo::JSON>, etc).
455469
456470
use Mojo::JSON qw(encode_json);
457471
458-
say encode_json($vers); # {"constraints":[{"comparator":">","version":"2.00"},{"comparator":"<","version":"2.23"}],"scheme":"cpan"}
472+
say encode_json($vers);
459473
460-
=item $vers = URI::VersionRange->from_string($vers_string);
474+
# {
475+
# "constraints": [
476+
# {
477+
# "comparator": ">",
478+
# "version": "2.00"
479+
# },
480+
# {
481+
# "comparator": "<",
482+
# "version": "2.23"
483+
# }
484+
# ],
485+
# "scheme": "cpan"
486+
# }
461487
462-
Converts the given "vers" string to L<URI::VersionRange> object. Croaks on error.
463488
464-
=back
489+
=head3 B<from_string>
490+
491+
$vers = URI::VersionRange->from_string($vers_string);
492+
$vers = VERS->from_string($vers_string);
493+
494+
Converts the given "vers" string to VERS components and return L<URI::VersionRange>
495+
instance. Croaks on error.
465496
466497
467498
=head1 SUPPORT
@@ -484,7 +515,7 @@ L<https://github.com/giterlizzi/perl-URI-PackageURL>
484515
485516
=head1 AUTHOR
486517
487-
=over 4
518+
=over
488519
489520
=item * Giuseppe Di Terlizzi <gdt@cpan.org>
490521

0 commit comments

Comments
 (0)