blib/lib/WebFetch/Output/Dump.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 100% 32 / 32 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/WebFetch/Data/Config.pm ↑ Summary
1 # WebFetch::Output::Dump
2 # ABSTRACT: save WebFetch data in a Perl structure dump
3 #
4 # Copyright (c) 1998-2022 Ian Kluft. This program is free software; you can
5 # redistribute it and/or modify it under the terms of the GNU General Public
6 # License Version 3. See https://www.gnu.org/licenses/gpl-3.0-standalone.html
7  
8 # pragmas to silence some warnings from Perl::Critic
9 ## no critic (Modules::RequireExplicitPackage)
10 # This solves a catch-22 where parts of Perl::Critic want both package and use-strict to be first
11 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 ## use critic (Modules::RequireExplicitPackage)
15  
16 package WebFetch::Output::Dump;
17 2 $WebFetch::Output::Dump::VERSION = '0.15.8';
18 2 ▶use base "WebFetch";
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 # define exceptions/errors
23 2 ▶use Exception::Class ();
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 # no user-servicable parts beyond this point
26  
27 # register capabilities with WebFetch
28 2 __PACKAGE__->module_register("output:dump");
29  
30 # Perl structure dump format handler
31 sub fmt_handler_dump
32 {
33 1 ▶ my ( $self, $filename ) = @_;
Subroutine fmt_handler_dump: called CC=1 SCAR=0.0
Pod documented
34  
35 1 $self->raw_savable( $filename, Dumper( $self->{data} ) );
36 1 return 1;
37 }
38  
39 2 1;
40  
41 =pod
42  
43 =encoding UTF-8
44  
45 =head1 NAME
46  
47 WebFetch::Output::Dump - save WebFetch data in a Perl structure dump
48  
49 =head1 VERSION
50  
51 version 0.15.8
52  
53 =head1 SYNOPSIS
54  
55 In perl scripts:
56  
57 C<use WebFetch::Output::Dump;>
58  
59 From the command line:
60  
61 C<perl -w -MWebFetch::Output::Dump -e "&fetch_main" -- --dir directory
62 --format dump --save save-path [...WebFetch output options...]>
63  
64 =head1 DESCRIPTION
65  
66 This is an output module for WebFetch which simply outputs a Perl
67 structure dump from C<Data::Dumper>. It can be read again by a Perl
68 script using C<eval>.
69  
70 =over 4
71  
72 =item $obj->fmt_handler_dump( $filename )
73  
74 This function dumps the data into a string for saving by the WebFetch::save()
75 function.
76  
77 =back
78  
79 =head1 SEE ALSO
80  
81 L<WebFetch>
82 L<https://github.com/ikluft/WebFetch>
83  
84 =head1 BUGS AND LIMITATIONS
85  
86 Please report bugs via GitHub at L<https://github.com/ikluft/WebFetch/issues>
87  
88 Patches and enhancements may be submitted via a pull request at L<https://github.com/ikluft/WebFetch/pulls>
89  
90 =head1 AUTHOR
91  
92 Ian Kluft <https://github.com/ikluft>
93  
94 =head1 COPYRIGHT AND LICENSE
95  
96 This software is Copyright (c) 1998-2023 by Ian Kluft.
97  
98 This is free software, licensed under:
99  
100 The GNU General Public License, Version 3, June 2007
101  
102 =cut
103  
104 __END__
105 # POD docs follow
106  
« blib/lib/WebFetch/Data/Config.pm ↑ Summary