Skip to content

Commit

Permalink
Add POD documentation and code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
giterlizzi committed Feb 27, 2024
1 parent 79f6dd0 commit fd83bdb
Show file tree
Hide file tree
Showing 55 changed files with 3,639 additions and 106 deletions.
2 changes: 1 addition & 1 deletion lib/CSAF.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use CSAF::Document;

use overload '""' => 'to_string';

our $VERSION = '0.10';
our $VERSION = '0.11';

our $CACHE = {};

Expand Down
6 changes: 3 additions & 3 deletions lib/CSAF/Builder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ sub build {

my ($self, $skip_validation) = @_;

my $document = $self->csaf->document->TO_BUILD;
my $vulnerabilities = $self->csaf->vulnerabilities->TO_BUILD;
my $product_tree = $self->csaf->product_tree->TO_BUILD;
my $document = $self->csaf->document->TO_CSAF;
my $vulnerabilities = $self->csaf->vulnerabilities->TO_CSAF;
my $product_tree = $self->csaf->product_tree->TO_CSAF;

my $csaf = {document => $document};

Expand Down
71 changes: 70 additions & 1 deletion lib/CSAF/Type/Acknowledgment.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sub _check_isa_array {
Carp::croak 'must be an array' if (ref $_[0] ne 'ARRAY');
}

sub TO_BUILD {
sub TO_CSAF {

my $self = shift;

Expand All @@ -33,3 +33,72 @@ sub TO_BUILD {
}

1;

__END__
=head1 NAME
CSAF::Type::Acknowledgment
=head1 SYNOPSIS
use CSAF::Type::Acknowledgment;
my $type = CSAF::Type::Acknowledgment->new( );
=head1 DESCRIPTION
=head2 METHODS
L<CSAF::Type::Acknowledgment> inherits all methods from L<CSAF::Type::Base> and implements the following new ones.
=over
=item $type->names
=item $type->organization
=item $type->summary
=item $type->urls
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at L<https://github.com/giterlizzi/perl-CSAF/issues>.
You will be notified automatically of any progress on your issue.
=head2 Source Code
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
L<https://github.com/giterlizzi/perl-CSAF>
git clone https://github.com/giterlizzi/perl-CSAF.git
=head1 AUTHOR
=over 4
=item * Giuseppe Di Terlizzi <gdt@cpan.org>
=back
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2023-2024 by Giuseppe Di Terlizzi.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
60 changes: 59 additions & 1 deletion lib/CSAF/Type/Acknowledgments.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,64 @@ use warnings;
use Moo;
extends 'CSAF::Type::List';

has item_class_name => (is => 'ro', default => 'CSAF::Type::Acknowledgment');
has item_class => (is => 'ro', default => 'CSAF::Type::Acknowledgment');

1;

__END__
=head1 NAME
CSAF::Type::Acknowledgments
=head1 SYNOPSIS
use CSAF::Type::Acknowledgments;
my $type = CSAF::Type::Acknowledgments->new( );
=head1 DESCRIPTION
L<CSAF::Type::Acknowledgments> is a collection of L<CSAF::Type::Acknowledgment> elements.
=head2 METHODS
L<CSAF::Type::Acknowledgments> inherits all methods from L<CSAF::Type::List>.
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at L<https://github.com/giterlizzi/perl-CSAF/issues>.
You will be notified automatically of any progress on your issue.
=head2 Source Code
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
L<https://github.com/giterlizzi/perl-CSAF>
git clone https://github.com/giterlizzi/perl-CSAF.git
=head1 AUTHOR
=over 4
=item * Giuseppe Di Terlizzi <gdt@cpan.org>
=back
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2023-2024 by Giuseppe Di Terlizzi.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
67 changes: 66 additions & 1 deletion lib/CSAF/Type/AggregateSeverity.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extends 'CSAF::Type::Base';
has text => (is => 'rw');
has namespace => (is => 'rw');

sub TO_BUILD {
sub TO_CSAF {

my $self = shift;

Expand All @@ -26,3 +26,68 @@ sub TO_BUILD {
}

1;

__END__
=head1 NAME
CSAF::Type::AggregateSeverity
=head1 SYNOPSIS
use CSAF::Type::AggregateSeverity;
my $type = CSAF::Type::AggregateSeverity->new( );
=head1 DESCRIPTION
=head2 METHODS
L<CSAF::Type::AggregateSeverity> inherits all methods from L<CSAF::Type::Base> and implements the following new ones.
=over
=item $type->namespace
=item $type->text
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at L<https://github.com/giterlizzi/perl-CSAF/issues>.
You will be notified automatically of any progress on your issue.
=head2 Source Code
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
L<https://github.com/giterlizzi/perl-CSAF>
git clone https://github.com/giterlizzi/perl-CSAF.git
=head1 AUTHOR
=over 4
=item * Giuseppe Di Terlizzi <gdt@cpan.org>
=back
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2023-2024 by Giuseppe Di Terlizzi.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
69 changes: 67 additions & 2 deletions lib/CSAF/Type/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,72 @@ use warnings;
use Moo;
use Carp;

sub TO_BUILD { Carp::croak 'Method "TO_BUILD" not implemented by subclass' }
sub TO_JSON { shift->TO_BUILD }
sub TO_CSAF { Carp::croak 'Method "TO_CSAF" not implemented by subclass' }
sub TO_JSON { shift->TO_CSAF }

1;

__END__
=head1 NAME
CSAF::Type::Base
=head1 SYNOPSIS
use CSAF::Type::Base;
my $type = CSAF::Type::Base->new( );
=head1 DESCRIPTION
=head2 METHODS
L<CSAF::Type::Base> inherits all methods from L<CSAF::Type::Base> and implements the following new ones.
=over
=item $type->TO_JSON
=item $type->TO_CSAF
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
at L<https://github.com/giterlizzi/perl-CSAF/issues>.
You will be notified automatically of any progress on your issue.
=head2 Source Code
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
L<https://github.com/giterlizzi/perl-CSAF>
git clone https://github.com/giterlizzi/perl-CSAF.git
=head1 AUTHOR
=over 4
=item * Giuseppe Di Terlizzi <gdt@cpan.org>
=back
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2023-2024 by Giuseppe Di Terlizzi.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
Loading

0 comments on commit fd83bdb

Please sign in to comment.