| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# bookmarks - Export bookmarks from browsers and files |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Documentation at bottom of script. |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# Implementation Notes : |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# - For Safari, this tool relies on dirty plist parsing using Apple's 'plutil' |
|
10
|
|
|
|
|
|
|
# command. It should use Mac::PropertyList instead. For performance reasons |
|
11
|
|
|
|
|
|
|
# when used interactively, I've decided to keep it like that (see README.md). |
|
12
|
|
|
|
|
|
|
# - Since Firefox sets an EXCLUSIVE SQLite lock, a tmp DB file copy is used. |
|
13
|
|
|
|
|
|
|
# - sources are read as UTF-8. |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
# 2025.01.01 v0.35 jul : use 5.014 |
|
16
|
|
|
|
|
|
|
# fixed exit status |
|
17
|
|
|
|
|
|
|
# added CSV and HTML output format |
|
18
|
|
|
|
|
|
|
# 2024.03.09 v0.34 jul : added support for netscape |
|
19
|
|
|
|
|
|
|
# 2022.12.22 v0.33 jul : fixed utf8 in stdout and firefox |
|
20
|
|
|
|
|
|
|
# fixed bug in POD (wrong repo URL) |
|
21
|
|
|
|
|
|
|
# doc arg "-" stdin as txt |
|
22
|
|
|
|
|
|
|
# 2022.01.10 v0.32 jul : fixed bug in txt files regex (space) |
|
23
|
|
|
|
|
|
|
# fixed bug with option -a (files not existing silently dropped) |
|
24
|
|
|
|
|
|
|
# added support for arg '-' (read from STDIN as plain text file) |
|
25
|
|
|
|
|
|
|
# 2021.03.30 v0.31 jul : skip gemini.t if URI::Find not installed |
|
26
|
|
|
|
|
|
|
# 2021.03.29 v0.30 jul : added great markdown regex by Michaël Perrin |
|
27
|
|
|
|
|
|
|
# process files without extension as plain text |
|
28
|
|
|
|
|
|
|
# fixed extra spaces printed after empty fields |
|
29
|
|
|
|
|
|
|
# added gemini support |
|
30
|
|
|
|
|
|
|
# 2021.02.17 v0.28 jul : fixed missing require DBD::SQLite (firefox) |
|
31
|
|
|
|
|
|
|
# 2021.02.16 v0.27 jul : added win32 Edge support, fixed Chrome bug (localappdata), fixed win32 bug (find), more tests (firefox) |
|
32
|
|
|
|
|
|
|
# 2021.01.31 v0.26 jul : improved handling of optional dependencies |
|
33
|
|
|
|
|
|
|
# 2021.01.31 v0.25 jul : skip bookmarks.t if URI::Find not installed |
|
34
|
|
|
|
|
|
|
# 2021.01.31 v0.24 jul : fixed missing prereq URI::Find in Makefile.PL |
|
35
|
|
|
|
|
|
|
# 2021.01.23 v0.23 jul : added tests and fixed firefox default location |
|
36
|
|
|
|
|
|
|
# 2021.01.20 v0.22 jul : fixed firefox query again |
|
37
|
|
|
|
|
|
|
# 2020.06.29 v0.21 jul : added markdown and text files support |
|
38
|
|
|
|
|
|
|
# 2020.03.10 v0.20 jul : fixed EXCLUSIVE SQLite lock set by Firefox |
|
39
|
|
|
|
|
|
|
# 2019.12.22 v0.19 jul : added chrome support, require, bugfixes |
|
40
|
|
|
|
|
|
|
# 2019.10.22 v0.17 jul : created module |
|
41
|
|
|
|
|
|
|
# 2019.10.17 v0.16 jul : fixed firefox tags |
|
42
|
|
|
|
|
|
|
# 2019.09.27 v0.15 jul : added internet explorer support, fixed firefox tags |
|
43
|
|
|
|
|
|
|
# 2019.08.13 v0.14 jul : added firefox support, output format |
|
44
|
|
|
|
|
|
|
# 2019.07.11 v0.13 jul : use 5.010, better doc |
|
45
|
|
|
|
|
|
|
# 2019.01.14 v0.12 jul : fixed case sensitive regex |
|
46
|
|
|
|
|
|
|
# 2018.09.21 v0.11 jul : added arg and -a |
|
47
|
|
|
|
|
|
|
# 2018.09.01 v0.10 jul : created |
|
48
|
|
|
|
|
|
|
|
|
49
|
1
|
|
|
1
|
|
5933
|
use 5.014; |
|
|
1
|
|
|
|
|
4
|
|
|
50
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
44
|
|
|
51
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
60
|
|
|
52
|
1
|
|
|
1
|
|
690
|
use utf8; |
|
|
1
|
|
|
|
|
359
|
|
|
|
1
|
|
|
|
|
7
|
|
|
53
|
1
|
|
|
1
|
|
710
|
use Getopt::Std; |
|
|
1
|
|
|
|
|
3350
|
|
|
|
1
|
|
|
|
|
88
|
|
|
54
|
1
|
|
|
1
|
|
9
|
use File::Basename; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
119
|
|
|
55
|
1
|
|
|
1
|
|
1149
|
use File::Temp qw(tempdir); |
|
|
1
|
|
|
|
|
27722
|
|
|
|
1
|
|
|
|
|
63
|
|
|
56
|
1
|
|
|
1
|
|
423
|
use File::Copy qw(copy); |
|
|
1
|
|
|
|
|
4813
|
|
|
|
1
|
|
|
|
|
63
|
|
|
57
|
1
|
|
|
1
|
|
747
|
use open qw(:std :encoding(UTF-8)); |
|
|
1
|
|
|
|
|
1000
|
|
|
|
1
|
|
|
|
|
7
|
|
|
58
|
1
|
|
|
1
|
|
19795
|
use Encode qw(decode_utf8); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
78050
|
|
|
59
|
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
60891
|
our $VERSION = '0.35'; |
|
61
|
1
|
|
|
|
|
51
|
my $program = basename($0); |
|
62
|
1
|
|
|
|
|
3
|
my $usage = <
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Usage: $program [-hVdas] [-f format] [file ...] |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
-h, --help help |
|
67
|
|
|
|
|
|
|
-V, --version version |
|
68
|
|
|
|
|
|
|
-d debug (sent to STDERR) |
|
69
|
|
|
|
|
|
|
-a all : process arguments and default locations |
|
70
|
|
|
|
|
|
|
-f format export format : csv, csv-noheader, html, html-raw, |
|
71
|
|
|
|
|
|
|
or any combination of characters t,u,d as |
|
72
|
|
|
|
|
|
|
(default : tud) |
|
73
|
|
|
|
|
|
|
-s find schemeless URLs in text files (default : no) |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
See `perldoc $program` for full documentation. |
|
76
|
|
|
|
|
|
|
EOF |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# options |
|
79
|
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
2
|
my %options = (); |
|
81
|
1
|
50
|
|
|
|
5
|
getopts("hVdaf:s", \%options) or die $usage; |
|
82
|
|
|
|
|
|
|
|
|
83
|
1
|
|
50
|
|
|
27
|
my $help = $options{h} // 0; |
|
84
|
1
|
|
50
|
|
|
3
|
my $version = $options{V} // 0; |
|
85
|
1
|
|
50
|
|
|
4
|
my $debug = $options{d} // 0; |
|
86
|
1
|
|
50
|
|
|
3
|
my $all = $options{a} // 0; |
|
87
|
1
|
|
50
|
|
|
4
|
my $format = $options{f} // "tud"; |
|
88
|
1
|
|
50
|
|
|
3
|
my $schemeless = $options{s} // 0; |
|
89
|
|
|
|
|
|
|
|
|
90
|
1
|
50
|
|
|
|
2
|
die $usage if $help; |
|
91
|
1
|
50
|
|
|
|
8
|
die $VERSION . "\n" if $version; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# option -a |
|
94
|
1
|
50
|
33
|
|
|
5
|
if (!@ARGV or $all) |
|
95
|
|
|
|
|
|
|
{ |
|
96
|
0
|
|
|
|
|
0
|
my @default = (); |
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
0
|
if ($^O eq "darwin") |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
{ |
|
100
|
0
|
|
|
|
|
0
|
push @default, glob('~/Library/Safari/Bookmarks.plist'); |
|
101
|
0
|
|
|
|
|
0
|
push @default, glob('~/Library/Application\ Support/Firefox/Profiles/*.default*/places.sqlite'); |
|
102
|
0
|
|
|
|
|
0
|
push @default, glob('~/Library/Application\ Support/Google/Chrome/Default/Bookmarks'); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
elsif ($^O eq "linux") |
|
105
|
|
|
|
|
|
|
{ |
|
106
|
0
|
|
|
|
|
0
|
push @default, glob('~/.mozilla/firefox/*.default/places.sqlite'); |
|
107
|
0
|
|
|
|
|
0
|
push @default, glob('~/.config/google-chrome/Default/Bookmarks'); |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
elsif ($^O eq "MSWin32") |
|
110
|
|
|
|
|
|
|
{ |
|
111
|
0
|
|
|
|
|
0
|
push @default, $ENV{APPDATA} . '\Mozilla\Firefox\Profiles\*.default\places.sqlite'; |
|
112
|
0
|
|
|
|
|
0
|
push @default, $ENV{LOCALAPPDATA} . '\Google\Chrome\User Data\Default\Bookmarks'; |
|
113
|
0
|
|
|
|
|
0
|
push @default, $ENV{USERPROFILE} . '\Favorites'; |
|
114
|
0
|
|
|
|
|
0
|
push @default, $ENV{LOCALAPPDATA} . '\Microsoft\Edge\User Data\Default\Bookmarks'; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
else |
|
117
|
|
|
|
|
|
|
{ |
|
118
|
0
|
|
|
|
|
0
|
die "unknown os, unable to set default files"; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# do they indeed exist? |
|
122
|
0
|
|
|
|
|
0
|
@default = grep { -e $_ } @default; |
|
|
0
|
|
|
|
|
0
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
0
|
push @ARGV, @default; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
# option -f |
|
128
|
|
|
|
|
|
|
my %dispatch = ( |
|
129
|
0
|
0
|
|
0
|
|
0
|
't' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($t); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
130
|
0
|
0
|
|
0
|
|
0
|
'tu' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($t,$u); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
131
|
1
|
50
|
|
1
|
|
2
|
'tud' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($t,$u,$d); }, |
|
|
1
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
60
|
|
|
132
|
0
|
0
|
|
0
|
|
0
|
'tdu' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($t,$d,$u); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
133
|
0
|
0
|
|
0
|
|
0
|
'td' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($t,$d); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
134
|
0
|
0
|
|
0
|
|
0
|
'u' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($u); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
135
|
0
|
0
|
|
0
|
|
0
|
'ud' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($u,$d); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
136
|
0
|
0
|
|
0
|
|
0
|
'udt' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($u,$d,$t); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
137
|
0
|
0
|
|
0
|
|
0
|
'utd' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($u,$t,$d); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
138
|
0
|
0
|
|
0
|
|
0
|
'ut' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($u,$t); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
139
|
0
|
0
|
|
0
|
|
0
|
'd' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($d); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
140
|
0
|
0
|
|
0
|
|
0
|
'du' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($d,$u); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
141
|
0
|
0
|
|
0
|
|
0
|
'dut' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($d,$u,$t); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
142
|
0
|
0
|
|
0
|
|
0
|
'dtu' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($d,$t,$u); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
143
|
0
|
0
|
|
0
|
|
0
|
'dt' => sub { my ($t,$u,$d) = @_; say join ' ', grep {defined $_ and length $_} ($d,$t); }, |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
144
|
0
|
0
|
|
0
|
|
0
|
'csv' => sub { my ($t,$u,$d) = @_; say '"' . join ('","', map { defined $_ and length $_ ? s/"/""/gr : "" } @_) . '"' . "\r"; }, |
|
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
145
|
0
|
0
|
|
0
|
|
0
|
'csv-noheader' => sub { my ($t,$u,$d) = @_; say '"' . join ('","', map { defined $_ and length $_ ? s/"/""/gr : "" } @_) . '"' . "\r"; }, |
|
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
146
|
0
|
|
|
0
|
|
0
|
'html' => sub { my ($t,$u,$d) = @_; say ' ' . $t . ''; }, |
|
|
0
|
|
|
|
|
0
|
|
|
147
|
0
|
|
|
0
|
|
0
|
'html-raw' => sub { my ($t,$u,$d) = @_; say '' . $t . ''; }, |
|
|
0
|
|
|
|
|
0
|
|
|
148
|
1
|
|
|
|
|
82
|
); |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# printer function |
|
151
|
1
|
|
|
|
|
2
|
my $print_bookmark; |
|
152
|
|
|
|
|
|
|
|
|
153
|
1
|
50
|
|
|
|
4
|
if ($dispatch{$format}) |
|
154
|
|
|
|
|
|
|
{ |
|
155
|
1
|
|
|
|
|
2
|
$print_bookmark = $dispatch{$format}; |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
else |
|
158
|
|
|
|
|
|
|
{ |
|
159
|
0
|
|
|
|
|
0
|
die "unknown format"; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
############### |
|
164
|
|
|
|
|
|
|
# SUBROUTINES # |
|
165
|
|
|
|
|
|
|
############### |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub _safari { |
|
168
|
|
|
|
|
|
|
|
|
169
|
0
|
|
0
|
0
|
|
0
|
my $plist = shift // ""; |
|
170
|
0
|
0
|
|
|
|
0
|
warn "\$plist: $plist\n" if $debug; |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
# validate plutil and plist |
|
173
|
0
|
|
|
|
|
0
|
my $res = `plutil $plist`; |
|
174
|
0
|
0
|
|
|
|
0
|
die "plutil failed : $res" if $res !~ /OK$/; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# read plist as text |
|
177
|
0
|
|
|
|
|
0
|
my $text = `plutil -p $plist`; |
|
178
|
0
|
0
|
|
|
|
0
|
die "plutil failed on file $plist" if not $text; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
# split on ddd => {} |
|
181
|
0
|
|
|
|
|
0
|
my @pieces = split /\d+ => \{(.*?)\}\s+\d+ => \{/s, $text; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
# find bookmarks among pieces |
|
184
|
0
|
|
|
|
|
0
|
my @bookmarks = grep /URLString/, @pieces; |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
# print |
|
187
|
0
|
|
|
|
|
0
|
foreach my $bm (@bookmarks) |
|
188
|
|
|
|
|
|
|
{ |
|
189
|
0
|
0
|
|
|
|
0
|
my $title = $1 if $bm =~ /"title" => "(.+)"/i; |
|
190
|
0
|
0
|
|
|
|
0
|
my $url = $1 if $bm =~ /"URLString" => "(.+)"/i; |
|
191
|
0
|
0
|
|
|
|
0
|
my $description = $1 if $bm =~ /"PreviewText" => "(.+)"/i; |
|
192
|
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
0
|
$print_bookmark->($title, $url, $description); |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub _firefox { |
|
198
|
|
|
|
|
|
|
|
|
199
|
0
|
|
|
0
|
|
0
|
eval { |
|
200
|
0
|
|
|
|
|
0
|
require DBI; |
|
201
|
0
|
|
|
|
|
0
|
require DBD::SQLite; |
|
202
|
|
|
|
|
|
|
}; |
|
203
|
0
|
0
|
|
|
|
0
|
if ($@) |
|
204
|
|
|
|
|
|
|
{ |
|
205
|
0
|
|
|
|
|
0
|
die "to process Firefox bookmarks, you need to install modules DBI DBD::SQLite\n"; |
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
|
|
208
|
0
|
|
0
|
|
|
0
|
my $dbfile = shift // ""; |
|
209
|
0
|
0
|
|
|
|
0
|
warn "\$dbfile: $dbfile\n" if $debug; |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
# fix EXCLUSIVE SQLite lock set by Firefox |
|
212
|
0
|
|
|
|
|
0
|
my $dir = tempdir( CLEANUP => 1 ); |
|
213
|
0
|
0
|
|
|
|
0
|
copy $dbfile, $dir or die "unable to copy file : $dbfile"; |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
# from now on, we use a tmp db copy |
|
216
|
0
|
|
|
|
|
0
|
$dbfile = "$dir/" . basename($dbfile); |
|
217
|
|
|
|
|
|
|
|
|
218
|
0
|
0
|
|
|
|
0
|
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", # DSN: dbi, driver, database file |
|
219
|
|
|
|
|
|
|
"", # no user |
|
220
|
|
|
|
|
|
|
"", # no password |
|
221
|
|
|
|
|
|
|
{ RaiseError => 1, PrintError => 0, AutoCommit => 0 }, # RaiseError=die() PrintError=warn() |
|
222
|
|
|
|
|
|
|
) or die DBI->errstr; |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
# build sql statement |
|
225
|
0
|
|
|
|
|
0
|
my $sql = " |
|
226
|
|
|
|
|
|
|
select b.title, p.url, t.tags as description |
|
227
|
|
|
|
|
|
|
from moz_bookmarks b |
|
228
|
|
|
|
|
|
|
left join |
|
229
|
|
|
|
|
|
|
( |
|
230
|
|
|
|
|
|
|
select fk, group_concat(tag, ' ') as tags |
|
231
|
|
|
|
|
|
|
from |
|
232
|
|
|
|
|
|
|
( |
|
233
|
|
|
|
|
|
|
select distinct |
|
234
|
|
|
|
|
|
|
b1.fk as fk, |
|
235
|
|
|
|
|
|
|
b3.title as tag |
|
236
|
|
|
|
|
|
|
from moz_bookmarks b1 |
|
237
|
|
|
|
|
|
|
left join moz_bookmarks b2 on b2.fk = b1.fk and b2.type = 1 and b2.title is null |
|
238
|
|
|
|
|
|
|
left join moz_bookmarks b3 on b3.id = b2.parent |
|
239
|
|
|
|
|
|
|
where b1.type = 1 and b1.title is not null |
|
240
|
|
|
|
|
|
|
) |
|
241
|
|
|
|
|
|
|
group by fk |
|
242
|
|
|
|
|
|
|
) t on t.fk = b.fk |
|
243
|
|
|
|
|
|
|
left join moz_places p on p.id = b.fk |
|
244
|
|
|
|
|
|
|
left join moz_origins o on o.id = p.origin_id |
|
245
|
|
|
|
|
|
|
where b.title is not null |
|
246
|
|
|
|
|
|
|
and o.prefix != 'place:' |
|
247
|
|
|
|
|
|
|
"; |
|
248
|
0
|
0
|
|
|
|
0
|
warn "\$sql: $sql\n" if $debug; |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
# prepare and execute transaction |
|
251
|
|
|
|
|
|
|
eval |
|
252
|
0
|
|
|
|
|
0
|
{ |
|
253
|
0
|
|
|
|
|
0
|
my $sth = $dbh->prepare($sql); |
|
254
|
0
|
|
|
|
|
0
|
$sth->execute(); |
|
255
|
|
|
|
|
|
|
|
|
256
|
0
|
0
|
|
|
|
0
|
if ($sth) |
|
257
|
|
|
|
|
|
|
{ |
|
258
|
0
|
|
0
|
|
|
0
|
while ($sth and my $hashref = $sth->fetchrow_hashref) |
|
259
|
|
|
|
|
|
|
{ |
|
260
|
0
|
|
|
|
|
0
|
$print_bookmark->( decode_utf8($hashref->{'title'}), decode_utf8($hashref->{'url'}), decode_utf8($hashref->{'description'}) ); |
|
261
|
|
|
|
|
|
|
} |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
}; |
|
264
|
|
|
|
|
|
|
|
|
265
|
0
|
0
|
|
|
|
0
|
if ($@) |
|
266
|
|
|
|
|
|
|
{ |
|
267
|
0
|
|
|
|
|
0
|
warn "transaction failed : $@"; |
|
268
|
0
|
|
|
|
|
0
|
die "unable to process file : $dbfile"; |
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
|
|
271
|
0
|
|
|
|
|
0
|
$dbh->disconnect; |
|
272
|
|
|
|
|
|
|
} |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub _chrome { |
|
275
|
|
|
|
|
|
|
|
|
276
|
0
|
|
|
0
|
|
0
|
eval { |
|
277
|
0
|
|
|
|
|
0
|
require File::Slurper; |
|
278
|
0
|
|
|
|
|
0
|
require JSON; |
|
279
|
|
|
|
|
|
|
}; |
|
280
|
0
|
0
|
|
|
|
0
|
if ($@) |
|
281
|
|
|
|
|
|
|
{ |
|
282
|
0
|
|
|
|
|
0
|
die "to process Chrome bookmarks, you need to install modules File::Slurper JSON\n"; |
|
283
|
|
|
|
|
|
|
} |
|
284
|
|
|
|
|
|
|
|
|
285
|
0
|
|
0
|
|
|
0
|
my $file = shift // ""; |
|
286
|
0
|
0
|
|
|
|
0
|
warn "\$file: $file\n" if $debug; |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
# read plist as text |
|
289
|
0
|
|
|
|
|
0
|
my $text = File::Slurper::read_binary($file); |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
# decode utf8 json |
|
292
|
0
|
|
|
|
|
0
|
my $hashref = JSON::decode_json($text); |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
# print |
|
295
|
0
|
|
|
|
|
0
|
foreach my $place ( ('bookmark_bar','other') ) |
|
296
|
|
|
|
|
|
|
{ |
|
297
|
0
|
|
|
|
|
0
|
my $arrayref = $hashref->{'roots'}->{$place}->{'children'}; |
|
298
|
|
|
|
|
|
|
|
|
299
|
0
|
|
|
|
|
0
|
foreach my $i (@$arrayref) |
|
300
|
|
|
|
|
|
|
{ |
|
301
|
0
|
|
|
|
|
0
|
$print_bookmark->($i->{'name'}, $i->{'url'}); |
|
302
|
|
|
|
|
|
|
} |
|
303
|
|
|
|
|
|
|
} |
|
304
|
|
|
|
|
|
|
} |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
sub _iexplorer { |
|
307
|
|
|
|
|
|
|
|
|
308
|
0
|
|
|
0
|
|
0
|
eval { |
|
309
|
0
|
|
|
|
|
0
|
require Config::Any; |
|
310
|
0
|
|
|
|
|
0
|
require Config::Tiny; # for Config::Any::INI |
|
311
|
0
|
|
|
|
|
0
|
require Win32; # for windows rubbish |
|
312
|
0
|
|
|
|
|
0
|
require File::Find; |
|
313
|
|
|
|
|
|
|
}; |
|
314
|
0
|
0
|
|
|
|
0
|
if ($@) |
|
315
|
|
|
|
|
|
|
{ |
|
316
|
0
|
|
|
|
|
0
|
die "to process Internet Explorer favorites, you need to install modules Config::Any Config::Tiny Win32 File::Find\n"; |
|
317
|
|
|
|
|
|
|
} |
|
318
|
|
|
|
|
|
|
|
|
319
|
0
|
|
0
|
|
|
0
|
my $favorites = shift // ""; |
|
320
|
0
|
0
|
|
|
|
0
|
warn "\$favorites: $favorites\n" if $debug; |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
# search in favorites and subfolders |
|
323
|
0
|
|
|
|
|
0
|
my @files; |
|
324
|
0
|
|
|
0
|
|
0
|
File::Find::find( { wanted => sub { push @files, $_ }, no_chdir => 1 }, $favorites ); |
|
|
0
|
|
|
|
|
0
|
|
|
325
|
|
|
|
|
|
|
|
|
326
|
0
|
|
|
|
|
0
|
foreach my $file (@files) |
|
327
|
|
|
|
|
|
|
{ |
|
328
|
0
|
|
|
|
|
0
|
my @filepaths = ($file); |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
# force load internet shortcuts .url as INI files |
|
331
|
0
|
|
|
|
|
0
|
my @plugins = ('Config::Any::INI'); |
|
332
|
0
|
|
|
|
|
0
|
my $cfg = Config::Any->load_files( {files => \@filepaths, force_plugins => \@plugins} ); |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
# workaround because system encoding != console encoding |
|
335
|
0
|
|
|
|
|
0
|
my $win32_old_cp = Win32::GetConsoleOutputCP(); |
|
336
|
0
|
|
|
|
|
0
|
my $win32_new_cp = Win32::GetACP(); |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
# change console codepage |
|
339
|
0
|
|
|
|
|
0
|
Win32::SetConsoleOutputCP($win32_new_cp); |
|
340
|
|
|
|
|
|
|
|
|
341
|
0
|
|
|
|
|
0
|
for (@$cfg) |
|
342
|
|
|
|
|
|
|
{ |
|
343
|
0
|
|
|
|
|
0
|
my ($filename, $config) = %$_; |
|
344
|
|
|
|
|
|
|
|
|
345
|
0
|
|
|
|
|
0
|
my $title = substr(basename($filename), 0, -4); # chop ".url" |
|
346
|
0
|
|
0
|
|
|
0
|
my $url = $config->{'InternetShortcut'}->{'URL'} // ""; |
|
347
|
|
|
|
|
|
|
|
|
348
|
0
|
|
|
|
|
0
|
$print_bookmark->($title, $url); |
|
349
|
|
|
|
|
|
|
} |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
# restore console codepage |
|
352
|
0
|
|
|
|
|
0
|
Win32::SetConsoleOutputCP($win32_old_cp); |
|
353
|
|
|
|
|
|
|
} |
|
354
|
|
|
|
|
|
|
} |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
sub _txt { |
|
357
|
|
|
|
|
|
|
|
|
358
|
0
|
|
|
0
|
|
0
|
eval { |
|
359
|
0
|
|
|
|
|
0
|
require URI::Find; |
|
360
|
0
|
|
|
|
|
0
|
require URI::Find::Schemeless; |
|
361
|
|
|
|
|
|
|
}; |
|
362
|
0
|
0
|
|
|
|
0
|
if ($@) |
|
363
|
|
|
|
|
|
|
{ |
|
364
|
0
|
|
|
|
|
0
|
die "to process text files, you need to install module URI::Find\n"; |
|
365
|
|
|
|
|
|
|
} |
|
366
|
|
|
|
|
|
|
|
|
367
|
0
|
|
0
|
|
|
0
|
my $file = shift // ""; |
|
368
|
0
|
0
|
|
|
|
0
|
warn "\$file: $file\n" if $debug; |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
# get uri regex |
|
371
|
0
|
0
|
|
|
|
0
|
my $class = $schemeless ? "URI::Find::Schemeless" : "URI::Find"; # copy-paste from urifind |
|
372
|
|
|
|
|
|
|
my $finder = $class->new( sub { |
|
373
|
0
|
|
|
0
|
|
0
|
my ($uri, $orig_uri) = @_; |
|
374
|
0
|
|
|
|
|
0
|
return $orig_uri; |
|
375
|
0
|
|
|
|
|
0
|
}); |
|
376
|
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
0
|
my $regex = $finder->uri_re; |
|
378
|
0
|
0
|
|
|
|
0
|
$regex = $regex . '|' . $finder->schemeless_uri_re if $schemeless; |
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
# read file as text |
|
381
|
0
|
|
|
|
|
0
|
my $fh; |
|
382
|
0
|
0
|
|
|
|
0
|
if ($file eq '-') |
|
383
|
|
|
|
|
|
|
{ |
|
384
|
0
|
|
|
|
|
0
|
$fh = *STDIN; |
|
385
|
|
|
|
|
|
|
} |
|
386
|
|
|
|
|
|
|
else |
|
387
|
|
|
|
|
|
|
{ |
|
388
|
0
|
0
|
|
|
|
0
|
open($fh, '<:encoding(UTF-8)', $file) or die "unable to read file : $file"; |
|
389
|
|
|
|
|
|
|
} |
|
390
|
|
|
|
|
|
|
|
|
391
|
0
|
|
|
|
|
0
|
while (my $line = <$fh>) |
|
392
|
|
|
|
|
|
|
{ |
|
393
|
0
|
0
|
|
|
|
0
|
if ( $line =~ /(?:(.*)\s)?($regex)(?:\s+(.*))?/ ) # match |
|
394
|
|
|
|
|
|
|
{ |
|
395
|
0
|
|
|
|
|
0
|
my $title = $1; |
|
396
|
0
|
|
|
|
|
0
|
my $url = $2; |
|
397
|
0
|
|
|
|
|
0
|
my $description = $3; |
|
398
|
|
|
|
|
|
|
|
|
399
|
0
|
|
|
|
|
0
|
$print_bookmark->($title, $url, $description); |
|
400
|
|
|
|
|
|
|
} |
|
401
|
|
|
|
|
|
|
} |
|
402
|
|
|
|
|
|
|
} |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
sub _gemini { |
|
405
|
|
|
|
|
|
|
|
|
406
|
0
|
|
|
0
|
|
0
|
eval { |
|
407
|
0
|
|
|
|
|
0
|
require URI::Find; |
|
408
|
0
|
|
|
|
|
0
|
require URI::Find::Schemeless; |
|
409
|
|
|
|
|
|
|
}; |
|
410
|
0
|
0
|
|
|
|
0
|
if ($@) |
|
411
|
|
|
|
|
|
|
{ |
|
412
|
0
|
|
|
|
|
0
|
die "to process Gemini files, you need to install module URI::Find\n"; |
|
413
|
|
|
|
|
|
|
} |
|
414
|
|
|
|
|
|
|
|
|
415
|
0
|
|
0
|
|
|
0
|
my $file = shift // ""; |
|
416
|
0
|
0
|
|
|
|
0
|
warn "\$file: $file\n" if $debug; |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
# get uri regex |
|
419
|
0
|
0
|
|
|
|
0
|
my $class = $schemeless ? "URI::Find::Schemeless" : "URI::Find"; # copy-paste from urifind |
|
420
|
|
|
|
|
|
|
my $finder = $class->new( sub { |
|
421
|
0
|
|
|
0
|
|
0
|
my ($uri, $orig_uri) = @_; |
|
422
|
0
|
|
|
|
|
0
|
return $orig_uri; |
|
423
|
0
|
|
|
|
|
0
|
}); |
|
424
|
|
|
|
|
|
|
|
|
425
|
0
|
|
|
|
|
0
|
my $regex = $finder->uri_re; |
|
426
|
0
|
0
|
|
|
|
0
|
$regex = $regex . '|' . $finder->schemeless_uri_re if $schemeless; |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
# read file as text |
|
429
|
0
|
0
|
|
|
|
0
|
open(my $fh, '<:encoding(UTF-8)', $file) or die "unable to read file : $file"; |
|
430
|
|
|
|
|
|
|
|
|
431
|
0
|
|
|
|
|
0
|
while (my $line = <$fh>) |
|
432
|
|
|
|
|
|
|
{ |
|
433
|
0
|
0
|
|
|
|
0
|
if ( $line =~ /^=>\s+($regex)\s+(.*)/ ) # match => |
|
434
|
|
|
|
|
|
|
{ |
|
435
|
0
|
|
|
|
|
0
|
my $title = $2; |
|
436
|
0
|
|
|
|
|
0
|
my $url = $1; |
|
437
|
0
|
|
|
|
|
0
|
my $description = undef; |
|
438
|
|
|
|
|
|
|
|
|
439
|
0
|
|
|
|
|
0
|
$print_bookmark->($title, $url, $description); |
|
440
|
|
|
|
|
|
|
} |
|
441
|
|
|
|
|
|
|
} |
|
442
|
|
|
|
|
|
|
} |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
sub _md { |
|
445
|
|
|
|
|
|
|
|
|
446
|
1
|
|
50
|
1
|
|
3
|
my $file = shift // ""; |
|
447
|
1
|
50
|
|
|
|
2
|
warn "\$file: $file\n" if $debug; |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
# read file as text |
|
450
|
1
|
50
|
|
|
|
42
|
open(my $fh, '<:encoding(UTF-8)', $file) or die "unable to read file : $file"; |
|
451
|
|
|
|
|
|
|
|
|
452
|
1
|
|
|
|
|
102
|
while (my $line = <$fh>) |
|
453
|
|
|
|
|
|
|
{ |
|
454
|
|
|
|
|
|
|
# regex by Michaël Perrin : |
|
455
|
|
|
|
|
|
|
# http://blog.michaelperrin.fr/2019/02/04/advanced-regular-expressions/ |
|
456
|
2
|
100
|
|
|
|
36
|
if ( $line =~ |
|
457
|
|
|
|
|
|
|
/ |
|
458
|
|
|
|
|
|
|
(? # Text group, including square brackets |
|
459
|
|
|
|
|
|
|
\[ |
|
460
|
|
|
|
|
|
|
(?> # (?> defines an atomic group, this is a performance improvement when using recursion |
|
461
|
|
|
|
|
|
|
[^\[\]]+ # Look for any char except closing square bracket |
|
462
|
|
|
|
|
|
|
|(?&text_group) # OR: find recursively an other pattern with opening and closing square brackets |
|
463
|
|
|
|
|
|
|
)* |
|
464
|
|
|
|
|
|
|
\] |
|
465
|
|
|
|
|
|
|
) |
|
466
|
|
|
|
|
|
|
(?: |
|
467
|
|
|
|
|
|
|
\( |
|
468
|
|
|
|
|
|
|
(?\S*?) # URL: non-greedy non-whitespace characters |
|
469
|
|
|
|
|
|
|
(?: |
|
470
|
|
|
|
|
|
|
[ ] |
|
471
|
|
|
|
|
|
|
" |
|
472
|
|
|
|
|
|
|
(? |
|
473
|
|
|
|
|
|
|
(?:[^"]|(?<=\\)")*? # Title without double quotes around |
|
474
|
|
|
|
|
|
|
) |
|
475
|
|
|
|
|
|
|
" |
|
476
|
|
|
|
|
|
|
)? |
|
477
|
|
|
|
|
|
|
\) |
|
478
|
|
|
|
|
|
|
) |
|
479
|
|
|
|
|
|
|
/x |
|
480
|
|
|
|
|
|
|
) # match []( "") OLD was []() |
|
481
|
|
|
|
|
|
|
{ |
|
482
|
1
|
|
|
|
|
3
|
my $title = $1; |
|
483
|
1
|
|
|
|
|
2
|
my $url = $2; |
|
484
|
1
|
|
|
|
|
2
|
my $description = $3; |
|
485
|
|
|
|
|
|
|
|
|
486
|
1
|
|
|
|
|
7
|
$title =~ s/^\[|\]$//g; # strip [...] |
|
487
|
|
|
|
|
|
|
|
|
488
|
1
|
|
|
|
|
3
|
$print_bookmark->($title, $url, $description); |
|
489
|
|
|
|
|
|
|
} |
|
490
|
|
|
|
|
|
|
} |
|
491
|
|
|
|
|
|
|
} |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
sub _netscape { |
|
494
|
|
|
|
|
|
|
|
|
495
|
0
|
|
|
0
|
|
|
eval { |
|
496
|
0
|
|
|
|
|
|
require Netscape::Bookmarks; |
|
497
|
|
|
|
|
|
|
}; |
|
498
|
0
|
0
|
|
|
|
|
if ($@) |
|
499
|
|
|
|
|
|
|
{ |
|
500
|
0
|
|
|
|
|
|
die "to process Netscape files, you need to install module Netscape::Bookmarks\n"; |
|
501
|
|
|
|
|
|
|
} |
|
502
|
|
|
|
|
|
|
|
|
503
|
0
|
|
0
|
|
|
|
my $file = shift // ""; |
|
504
|
0
|
0
|
|
|
|
|
warn "\$file: $file\n" if $debug; |
|
505
|
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
# parse file |
|
507
|
0
|
|
|
|
|
|
my $netscape = Netscape::Bookmarks->new($file); |
|
508
|
0
|
0
|
|
|
|
|
die "unable to parse file : $file" if not $netscape->isa('Netscape::Bookmarks::Category'); |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
my $callback = sub { |
|
511
|
0
|
|
|
0
|
|
|
my ($object, $level) = @_; |
|
512
|
0
|
0
|
|
|
|
|
if ($object->isa('Netscape::Bookmarks::Link')) |
|
513
|
|
|
|
|
|
|
{ |
|
514
|
0
|
|
|
|
|
|
my $title = $object->title; |
|
515
|
0
|
|
|
|
|
|
my $url = $object->href; |
|
516
|
0
|
|
|
|
|
|
my $description = undef; |
|
517
|
|
|
|
|
|
|
|
|
518
|
0
|
|
|
|
|
|
$print_bookmark->($title, $url, $description); |
|
519
|
|
|
|
|
|
|
} |
|
520
|
0
|
|
|
|
|
|
}; |
|
521
|
|
|
|
|
|
|
|
|
522
|
0
|
|
|
|
|
|
$netscape->recurse($callback); |
|
523
|
|
|
|
|
|
|
} |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
######## |
|
527
|
|
|
|
|
|
|
# MAIN # |
|
528
|
|
|
|
|
|
|
######## |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
# header |
|
531
|
1
|
50
|
|
|
|
5
|
if ($format eq 'csv') |
|
|
|
50
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
{ |
|
533
|
0
|
|
|
|
|
0
|
say '"Title","URL","Description"' . "\r"; |
|
534
|
|
|
|
|
|
|
} |
|
535
|
|
|
|
|
|
|
elsif ($format eq 'html') |
|
536
|
|
|
|
|
|
|
{ |
|
537
|
0
|
|
|
|
|
0
|
say " |
|
538
|
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
Bookmarks |
|
542
|
|
|
|
|
|
|
Bookmarks |
|
543
|
|
|
|
|
|
|
"; |
|
544
|
|
|
|
|
|
|
} |
|
545
|
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
# body |
|
547
|
1
|
|
|
|
|
1
|
foreach my $file (@ARGV) |
|
548
|
|
|
|
|
|
|
{ |
|
549
|
1
|
|
|
|
|
34
|
my $name = basename($file); |
|
550
|
|
|
|
|
|
|
|
|
551
|
1
|
50
|
33
|
|
|
65
|
if (-f $file and $name =~ /\.plist$/) { _safari($file); } |
|
|
0
|
50
|
33
|
|
|
0
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
552
|
0
|
|
|
|
|
0
|
elsif (-f $file and $name =~ /\.sqlite$/) { _firefox($file); } |
|
553
|
0
|
|
|
|
|
0
|
elsif (-f $file and $name =~ /Bookmarks$/) { _chrome($file); } |
|
554
|
0
|
|
|
|
|
0
|
elsif (-d $file and $name =~ /Favorites$/) { _iexplorer($file); } |
|
555
|
1
|
|
|
|
|
3
|
elsif (-f $file and $name =~ /\.md$/) { _md($file); } |
|
556
|
0
|
|
|
|
|
0
|
elsif (-f $file and $name =~ /\.gmi$/) { _gemini($file); } |
|
557
|
0
|
|
|
|
|
0
|
elsif (-f $file and $name =~ /\.html$/) { _netscape($file); } |
|
558
|
0
|
|
|
|
|
0
|
elsif (-f $file ) { _txt($file); } |
|
559
|
0
|
|
|
|
|
0
|
elsif ( $file eq '-' ) { _txt($file); } |
|
560
|
0
|
|
|
|
|
0
|
else { die "unable to process file : $file"; } |
|
561
|
|
|
|
|
|
|
} |
|
562
|
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
# footer |
|
564
|
1
|
50
|
|
|
|
11
|
if ($format eq 'html') |
|
565
|
|
|
|
|
|
|
{ |
|
566
|
0
|
|
|
|
|
0
|
print " "; |
|
567
|
|
|
|
|
|
|
} |
|
568
|
|
|
|
|
|
|
|
|
569
|
1
|
|
|
|
|
109
|
exit 0; |
|
570
|
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
__END__ |