-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_gut_mod.pl
executable file
·71 lines (61 loc) · 1.76 KB
/
get_gut_mod.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env perl
#======================================================================
#
# FILE: get_gut.pl
#
# USAGE: ./get_gut.pl [Nr-of-Book] [Nr-of-Book] ...
#
# Nr-of-Book can be one of the numbers given in the
# @reading_list below; the program will then only grab the
# books assigned.
#
# DESCRIPTION: Grab Data from Spiegel/Gutenberg
# (modular version depending on GutenbergDE)
#
# BUGS: <NaN>
# AUTHOR: Teoric <[email protected]>
# VERSION: 0.2
# CREATED: 2011-08-23 15:35:01 (CEST)
# Last Change: 2017-06-02, 19:24:55 CEST
#======================================================================
BEGIN {
push @INC, ".";
}
use strict;
use warnings;
use utf8;
# binmode(STDIN,":utf8");
# binmode(STDERR,":utf8");
# binmode(STDOUT,":utf8");
use open qw( :encoding(UTF-8) :std );
# only if DATA is used:
# binmode(DATA, ":encoding(UTF-8)");
# use charnames qw( :full :short );
use feature qw(say state switch unicode_strings);
use autodie;
use open qw( :encoding(UTF-8) :std );
use IO::Handle;
use GutenbergDE qw(do_book);
use Getopt::Long::Descriptive;
my ($opt, $usage) = describe_options(
"$0 %o [<file>]",
[ 'help|h', "print usage message and exit" ],
[ 'nr|number|n=i', "number of book in URL",
{ required => 1 , },
],
[ 'title|t=s', "title of the book",
{ required => 1 , },
],
[ 'chapters|c=i', "number of chapters (default: 1)",
{ default => 1 , },
],
[ 'xml', "output XML (default: HTML)",
],
[ 'directory|dir|d=s', "output directory (default: DATA)",
{ default => "DATA" , },
],
);
say STDERR "Text: ", $$opt{title};
GutenbergDE::init_dir($$opt{directory});
do_book($opt);
__END__