Khonsu.pm

filter: Statementstmt 94.7% 18 / 19 Branchbran n/a Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 2 totaltotal 75.7% 25 / 33 CC 3 SCAR 6.7
CC
3
Cov
87%
new
3.2
open
2.0
BEGIN
1.0
CRAP 2.0
« Khonsu/Text/Title.pm ↑ Summary Khonsu/Font.pm »
1 package Khonsu;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 our $VERSION = '0.01';
5 2 ▶use PDF::API2;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use Khonsu::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub new {
10 1 ▶ my ($pkg, $name, %args) = @_;
Subroutine new: called CC=3 SCAR=11.7
Pod undocumented
11 my $file = Khonsu::File->new(
12 file_name => $name,
13 pages => [],
14 page_size => $args{page_size} || 'A4',
15 page_args => $args{page_args} || {},
16 1 ▶ pdf => PDF::API2->new( -file => sprintf("%s.pdf", $name) )
Condition50%2/4
$args{'page_size'} || 'A4'
l!l
10
$args{'page_args'} || {}
l!l
10
MC/DC0%0/1
$args{'page_size'} || 'A4'
$args{'page_size'}
MC/DC0%0/1
$args{'page_args'} || {}
$args{'page_args'}
Truth table50%1/2
A
A= $args{'page_size'}
Aresult
11
00
Truth table50%1/2
A
A= $args{'page_args'}
Aresult
11
00
17 );
18 1 return $file;
19 }
20  
21 0 ▶sub open { ... }
Subroutine open: not called CC=1 SCAR=6.9
Pod undocumented
22  
23 2 1;
24  
25 =head1 NAME
26  
27 Khonsu - The great new Khonsu!
28  
29 =head1 VERSION
30  
31 Version 0.01
32  
33 =cut
34  
35 =head1 SYNOPSIS
36  
37 Quick summary of what the module does.
38  
39 Perhaps a little code snippet.
40  
41 my @words = ('Aker', 'Anubis', 'Hapi', 'Khepri', 'Maahes', 'Thoth', 'Bastet', 'Hatmehit', 'Tefnut', 'Menhit', 'Imentet');
42  
43 my $generate_text = sub {
44 my $length = shift;
45 return join " ", map { $words[int(rand(scalar @words))] } 1 .. $length;
46 };
47  
48 use Khonsu;
49  
50 my $khonsu = Khonsu->new(
51 'Ra',
52 page_size => 'A4',
53 page_args => {
54 background => '#36b636'
55 }
56 )->add_page;
57  
58 my $padding = 20;
59 my $page_padding = $padding * 2;
60 $khonsu->add_h1(
61 text => $generate_text->(3),
62 x => 20,
63 y => $padding,
64 w => $khonsu->page->w - $page_padding,
65 font => {
66 colour => '#fff'
67 }
68 )->add_text(
69 text => $generate_text->(2000),
70 x => 20,
71 y => ($padding * 2) + $khonsu->h1->line_height,
72 w => $khonsu->page->w - 40,
73 h => $khonsu->page->h - ($khonsu->h1->line_height + $page_padding + $padding),
74 indent => 4,
75 font => {
76 colour => '#fff'
77 },
78 overflow => 1,
79 );
80  
81 $khonsu->save();
82  
83  
84 =head1 AUTHOR
85  
86 LNATION, C<< <email at lnation.org> >>
87  
88 =head1 BUGS
89  
90 Please report any bugs or feature requests to C<bug-khonsu at rt.cpan.org>, or through
91 the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Khonsu>. I will be notified, and then you'll
92 automatically be notified of progress on your bug as I make changes.
93  
94 =head1 SUPPORT
95  
96 You can find documentation for this module with the perldoc command.
97  
98 perldoc Khonsu
99  
100 You can also look for information at:
101  
102 =over 4
103  
104 =item * RT: CPAN's request tracker (report bugs here)
105  
106 L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Khonsu>
107  
108 =item * CPAN Ratings
109  
110 L<https://cpanratings.perl.org/d/Khonsu>
111  
112 =item * Search CPAN
113  
114 L<https://metacpan.org/release/Khonsu>
115  
116 =back
117  
118  
119 =head1 ACKNOWLEDGEMENTS
120  
121  
122 =head1 LICENSE AND COPYRIGHT
123  
124 This software is Copyright (c) 2023 by LNATION.
125  
126 This is free software, licensed under:
127  
128 The Artistic License 2.0 (GPL Compatible)
129  
130  
131 =cut
132  
133 2 1; # End of Khonsu
« Khonsu/Text/Title.pm ↑ Summary Khonsu/Font.pm »