line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# WebFetch::Output::Dump - save data in Perl structure dump |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Copyright (c) 1998-2009 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 http://www.webfetch.org/GPLv3.txt |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package WebFetch::Output::Dump; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1232
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
11
|
1
|
|
|
1
|
|
6
|
use base "WebFetch"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
75
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Carp; |
14
|
|
|
|
|
|
|
use Scalar::Util qw( blessed ); |
15
|
|
|
|
|
|
|
use Date::Calc qw(Today Delta_Days Month_to_Text); |
16
|
|
|
|
|
|
|
use LWP::UserAgent; |
17
|
|
|
|
|
|
|
use Data::Dumper; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# define exceptions/errors |
20
|
|
|
|
|
|
|
use Exception::Class ( |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
WebFetch::Output::Dump - save data in a Perl structure dump |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# set defaults |
30
|
|
|
|
|
|
|
our ( @url, $cat_priorities, $now, $nowstamp ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our @Options = (); |
33
|
|
|
|
|
|
|
our $Usage = ""; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# configuration parameters |
36
|
|
|
|
|
|
|
our $num_links = 5; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# no user-servicable parts beyond this point |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# register capabilities with WebFetch |
41
|
|
|
|
|
|
|
__PACKAGE__->module_register( "output:dump" ); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
In perl scripts: |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
C |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
From the command line: |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
C
|
52
|
|
|
|
|
|
|
--format dump --save save-path [...WebFetch output options...]> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This is an output module for WebFetch which simply outputs a Perl |
57
|
|
|
|
|
|
|
structure dump from C. It can be read again by a Perl |
58
|
|
|
|
|
|
|
script using C. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item $obj->fmt_handler_dump( $filename ) |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This function dumps the data into a string for saving by the WebFetch::save() |
63
|
|
|
|
|
|
|
function. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Perl structure dump format handler |
68
|
|
|
|
|
|
|
sub fmt_handler_dump |
69
|
|
|
|
|
|
|
{ |
70
|
|
|
|
|
|
|
my ( $self, $filename ) = @_; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
$self->raw_savable( $filename, Dumper( $self->{data})); |
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
__END__ |