File Coverage

blib/lib/WebFetch/Output/Dump.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
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     2   1356 use strict;
  2         4  
  2         114  
12 2     2   12 use warnings;
  2         9  
  2         59  
13 2     2   10 use utf8;
  2         5  
  2         9  
14             ## use critic (Modules::RequireExplicitPackage)
15              
16             package WebFetch::Output::Dump;
17             $WebFetch::Output::Dump::VERSION = '0.15.9';
18 2     2   123 use base "WebFetch";
  2         4  
  2         183  
19              
20 2     2   1442 use Data::Dumper;
  2         13221  
  2         187  
21              
22             # define exceptions/errors
23 2     2   16 use Exception::Class ();
  2         4  
  2         195  
24              
25             # no user-servicable parts beyond this point
26              
27             # register capabilities with WebFetch
28             __PACKAGE__->module_register("output:dump");
29              
30             # Perl structure dump format handler
31             sub fmt_handler_dump
32             {
33 1     1 1 5 my ( $self, $filename ) = @_;
34              
35 1         5 $self->raw_savable( $filename, Dumper( $self->{data} ) );
36 1         5 return 1;
37             }
38              
39             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.9
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