Noss/Lynx.pm

filter: Statementstmt 60.0% 15 / 25 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 52.6% 20 / 38 CC 4 SCAR 23.5
CC
4
Cov
48%
lynx_dump
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 10.5
« Noss/FeedConfig.pm ↑ Summary Noss/OPML.pm »
1 package WWW::Noss::Lynx;
2 2 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 our $VERSION = '2.05';
6  
7 2 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 our @EXPORT_OK = qw(lynx_dump);
9  
10 2 my @DUMP_OPTS = qw(
11 -dump
12 -force_html
13 -nolist
14 -display_charset=utf8
15 );
16  
17 0 ▶sub lynx_dump {
Subroutine lynx_dump: not called CC=4 SCAR=30.0
Pod documented
18  
19 0 my ($file, %param) = @_;
20 0 ▶ my $width = $param{ width } // 80;
Condition0%0/2
$param{"width"} // 80
l!l
00
MC/DC0%0/1
$param{"width"} // 80
$param{"width"}
Truth table0%0/2
A
A= $param{"width"}
Aresult
11
00
21  
22 0 ▶ open my $fh, '-|', 'lynx', @DUMP_OPTS, '-width', $width, $file
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "-|", "lynx", @DUMP_OPTS, "-width", $width, $file or die "Error executing lynx: $!\n" 0 0 0
23 or die "Error executing lynx: $!\n";
24 0 my $dump = do { local $/; <$fh> };
25 0 close $fh;
26  
27 0 ▶ if ($? >> 8 != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($? >> 8 != 0) 0 0 0
28 0 die "Failed to dump $file with lynx\n";
29 }
30  
31 0 return $dump;
32  
33 }
34  
35 =head1 NAME
36  
37 WWW::Noss::Lynx - lynx interface
38  
39 =head1 USAGE
40  
41 use WWW::Noss::Lynx qw(lynx_dump);
42  
43 my $dump = lynx_dump($html_file);
44  
45 =head1 DESCRIPTION
46  
47 B<WWW::Noss::Lynx> is a module that provides an interface to the L<lynx(1)>
48 command for formatting HTML. This is a private module, please consult the
49 L<noss> manual for user documentation.
50  
51 =head1 SUBROUTINES
52  
53 Subroutines are not exported automatically.
54  
55 =over 4
56  
57 =item $dump = lynx_dump($html, [ %param ])
58  
59 Dumps the HTML file C<$html> using L<lynx(1)>'s C<-dump> option. Returns the
60 formatted text. Dies on failure.
61  
62 C<%param> is an optional hash argument for providing additional parameters to
63 C<lynx_dump()>. The follow are a list of valid fields:
64  
65 =over 4
66  
67 =item width
68  
69 Line width to use for formatted text dump. Defaults to C<80>.
70  
71 =back
72  
73 =back
74  
75 =head1 AUTHOR
76  
77 Written by Samuel Young, E<lt>samyoung@posteo.comE<gt>.
78  
79 This project's source can be found on its
80 L<Codeberg page|https://codeberg.org/1-1sam/noss.git>. Comments and pull
81 requests are welcome!
82  
83 =head1 COPYRIGHT
84  
85 Copyright (C) 2025-2026 Samuel Young
86  
87 This program is free software: you can redistribute it and/or modify
88 it under the terms of the GNU General Public License as published by
89 the Free Software Foundation, either version 3 of the License, or
90 (at your option) any later version.
91  
92 =head1 SEE ALSO
93  
94 L<lynx(1)>, L<noss>
95  
96 =cut
97  
98 2 1;
99  
100 # vim: expandtab shiftwidth=4
« Noss/FeedConfig.pm ↑ Summary Noss/OPML.pm »