| 1 | #!/usr/local/bin/perl -w | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | configure-link-control - setup configuration files for LinkController | ||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | The aim of this program is to get the default settings for | ||||||||||||||||||||||||||||||||
| 10 | LinkContoller set up in the file C<.link-control> in the users home | ||||||||||||||||||||||||||||||||
| 11 | directory. It does this by asking various questions and then putting | ||||||||||||||||||||||||||||||||
| 12 | the results into that file. | ||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | =head1 BUGS | ||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | Interaction with the $::base_dir directory is not handled here. | ||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | L<verify-link-control(1)>; L<extract-links(1)>; L<build-schedule> | ||||||||||||||||||||||||||||||||
| 21 | L<link-report(1)>; L<fix-link(1)>; L<link-report.cgi(1)>; L<fix-link.cgi> | ||||||||||||||||||||||||||||||||
| 22 | L<suggest(1)>; L<link-report.cgi(1)>; L<configure-link-control> | ||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | The LinkController manual in the distribution in HTML, info, or | ||||||||||||||||||||||||||||||||
| 25 | postscript formats, included in the distribution. | ||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||
| 27 | http://scotclimb.org.uk/software/linkcont/ - the | ||||||||||||||||||||||||||||||||
| 28 | LinkController homepage. | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | =cut | ||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | 2 | ▶ | use WWW::Link_Controller::ReadConf::utils; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | 2 | ▶ | use Getopt::Function; #don't need yet qw(maketrue makevalue); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | 2 | $::opthandler = new Getopt::Function | |||||||||||||||||||||||||||||||
| 37 | [ "version V>version", | ||||||||||||||||||||||||||||||||
| 38 | "usage h>usage help>usage", | ||||||||||||||||||||||||||||||||
| 39 | "help-opt=s", | ||||||||||||||||||||||||||||||||
| 40 | "verbose:i v>verbose", | ||||||||||||||||||||||||||||||||
| 41 | ], {}; | ||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | 2 | $::opthandler->std_opts; | |||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | 2 | $::opthandler->check_opts; | |||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | 1 | ▶ | sub usage() { | ||||||||||||||||||||||||||||||
|
Subroutine
usage: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 48 | 1 | print <<EOF; | |||||||||||||||||||||||||||||||
| 49 | configure-link-control [options] | ||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | EOF | ||||||||||||||||||||||||||||||||
| 52 | 1 | $::opthandler->list_opts; | |||||||||||||||||||||||||||||||
| 53 | 1 | print <<EOF; | |||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | Attempt to setup LinkController for basic usage. | ||||||||||||||||||||||||||||||||
| 56 | EOF | ||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | 1 | ▶ | sub version() { | ||||||||||||||||||||||||||||||
|
Subroutine
version: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 60 | 1 | print <<'EOF'; | |||||||||||||||||||||||||||||||
| 61 | configure-link-control version | ||||||||||||||||||||||||||||||||
| 62 | $Id: configure-link-control.pl,v 1.14 2002/01/18 20:32:35 mikedlr Exp $ | ||||||||||||||||||||||||||||||||
| 63 | EOF | ||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | 0 | print <<EOINTRO; | |||||||||||||||||||||||||||||||
| 67 | LinkController Configuration | ||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | Welcome to LinkController Configuration. This program is designed to | ||||||||||||||||||||||||||||||||
| 70 | set you up ready to use LinkController by setting up the configuration | ||||||||||||||||||||||||||||||||
| 71 | file .infostruc.pl in your home directory. The file will just be a | ||||||||||||||||||||||||||||||||
| 72 | simple perl program so you can either edit it by hand or use this | ||||||||||||||||||||||||||||||||
| 73 | program again to change it. | ||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||
| 75 | EOINTRO | ||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||
| 77 | 0 | eval { require "/etc/link-control.pl"; }; #FIXME local setup | |||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | warn "System config failed: $@" | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$@ and not $@ =~ /Can't locate/
MC/DC0%0/2
$@ and not $@ =~ /Can't locate/
$@
not $@ =~ /Can't locate/
Truth table0%0/3
A and not(B)
A= $@B= not $@ =~ /Can't locate/
| |||||||||||||||||||||||||||||||||
| 79 | if $@ and not $@ =~ m/Can't locate/; | ||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | 0 | my %sysconfig=(); | |||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | $sysconfig{"user_address"}=$::user_address if defined $::user_address; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 84 | 0 | undef $::user_address; | |||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | $sysconfig{"links"}=$::links if defined $::links; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 86 | 0 | undef $::links; | |||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | $sysconfig{"schedule"}=$::schedule if defined $::schedule; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 88 | 0 | undef $::schedule; | |||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $sysconfig{"page_index"}=$::page_index if defined $::page_index; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 90 | 0 | undef $::page_index; | |||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $sysconfig{"link_index"}=$::link_index if defined $::link_index; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 92 | 0 | undef $::link_index; | |||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||
| 94 | 0 | my $homeconfig_file=$ENV{"HOME"} . "/.link-control.pl"; | |||||||||||||||||||||||||||||||
| 95 | 0 | my %homeconfig=(); | |||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if (-e $homeconfig_file) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | yesno (<<'EOQ') and eval "require '$homeconfig_file'"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 99 | Do you want to try to load in the configuration in your home directory | ||||||||||||||||||||||||||||||||
| 100 | to use for defaults? | ||||||||||||||||||||||||||||||||
| 101 | EOQ | ||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | warn "load failed: $@ - ignoring file.. abort if that's wrong" if $@; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $homeconfig{"user_address"}=$::user_address if defined $::user_address; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 106 | 0 | undef $::user_address; | |||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | $homeconfig{"links"}=$::links if defined $::links; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 108 | 0 | undef $::links; | |||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | $homeconfig{"schedule"}=$::schedule if defined $::schedule; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 110 | 0 | undef $::schedule; | |||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | $homeconfig{"page_index"}=$::page_index if defined $::page_index; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 112 | 0 | undef $::page_index; | |||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | $homeconfig{"link_index"}=$::link_index if defined $::link_index; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 114 | 0 | undef $::link_index; | |||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||
| 116 | 0 | my %config=(); | |||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | if ($homeconfig{"user_address"}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 119 | 0 | $config{"user_address"} = getstring( <<EOQ, $homeconfig{"user_address"}); | |||||||||||||||||||||||||||||||
| 120 | What is your email address? Press return to use the same as before. | ||||||||||||||||||||||||||||||||
| 121 | EOQ | ||||||||||||||||||||||||||||||||
| 122 | } else { | ||||||||||||||||||||||||||||||||
| 123 | $config{"user_address"} = | ||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | getstring( <<EOQ ) while not defined $config{"user_address"}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 125 | What is your email address? You must give this if you want to do link | ||||||||||||||||||||||||||||||||
| 126 | testing because test-link will not work without it. | ||||||||||||||||||||||||||||||||
| 127 | EOQ | ||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||
| 131 | 0 | print "\n"; | |||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||
| 133 | CASE: { | ||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | $homeconfig{"links"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 135 | 0 | $config{"links"} = getstring( <<EOQ, $homeconfig{"links"}); | |||||||||||||||||||||||||||||||
| 136 | Where do you store your links database? Please give the full path to | ||||||||||||||||||||||||||||||||
| 137 | the file. You can use '~/' to indicate your home directory. | ||||||||||||||||||||||||||||||||
| 138 | Press return to use the same as before: | ||||||||||||||||||||||||||||||||
| 139 | $homeconfig{"links"} | ||||||||||||||||||||||||||||||||
| 140 | Type a single r and this will be reset to use the system configuration. | ||||||||||||||||||||||||||||||||
| 141 | EOQ | ||||||||||||||||||||||||||||||||
| 142 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 143 | }; | ||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | $sysconfig{"links"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 145 | 0 | $config{"links"} = getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 146 | Where do you store your links database? The system defines | ||||||||||||||||||||||||||||||||
| 147 | $sysconfig{"links"} | ||||||||||||||||||||||||||||||||
| 148 | press return and we will just use the system configuration. | ||||||||||||||||||||||||||||||||
| 149 | EOQ | ||||||||||||||||||||||||||||||||
| 150 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 151 | }; | ||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | $config{"links"} = getstring( <<EOQ ) while not defined $config{"links"}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 153 | Where do you store your links database? You must give a file location | ||||||||||||||||||||||||||||||||
| 154 | as there isn't any information on this. | ||||||||||||||||||||||||||||||||
| 155 | EOQ | ||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||
| 158 | 0 | print "\n"; | |||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||
| 160 | CASE: { | ||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | $homeconfig{"page_index"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 162 | 0 | $config{"page_index"} = getstring( <<EOQ, $homeconfig{"page_index"}); | |||||||||||||||||||||||||||||||
| 163 | Where do you store your page_index database? Please give the full path to | ||||||||||||||||||||||||||||||||
| 164 | the file. You can use '~/' to indicate your home directory. | ||||||||||||||||||||||||||||||||
| 165 | Press return to use the same as before: | ||||||||||||||||||||||||||||||||
| 166 | $homeconfig{"page_index"} | ||||||||||||||||||||||||||||||||
| 167 | Type a single r and this will be reset to use the system configuration. | ||||||||||||||||||||||||||||||||
| 168 | EOQ | ||||||||||||||||||||||||||||||||
| 169 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 170 | }; | ||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | $sysconfig{"page_index"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 172 | 0 | $config{"page_index"} = getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 173 | Where do you store your page_index database? The system defines | ||||||||||||||||||||||||||||||||
| 174 | $sysconfig{"page_index"} | ||||||||||||||||||||||||||||||||
| 175 | press return and we will just use the system configuration. | ||||||||||||||||||||||||||||||||
| 176 | EOQ | ||||||||||||||||||||||||||||||||
| 177 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 178 | }; | ||||||||||||||||||||||||||||||||
| 179 | 0 | $config{"page_index"} = getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 180 | Where do you store your page_index database? If you don't give this | ||||||||||||||||||||||||||||||||
| 181 | then you won't be able to report which pages contain a given link. | ||||||||||||||||||||||||||||||||
| 182 | EOQ | ||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||
| 185 | 0 | print "\n"; | |||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||
| 187 | CASE: { | ||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | $homeconfig{"link_index"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 189 | 0 | $config{"link_index"} = getstring( <<EOQ, $homeconfig{"link_index"}); | |||||||||||||||||||||||||||||||
| 190 | Where do you store your link_index database? Please give the full path to | ||||||||||||||||||||||||||||||||
| 191 | the file. You can use '~/' to indicate your home directory. | ||||||||||||||||||||||||||||||||
| 192 | Press return to use the same as before: | ||||||||||||||||||||||||||||||||
| 193 | $homeconfig{"link_index"} | ||||||||||||||||||||||||||||||||
| 194 | Type a single r and this will be reset to use the system configuration. | ||||||||||||||||||||||||||||||||
| 195 | EOQ | ||||||||||||||||||||||||||||||||
| 196 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 197 | }; | ||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $sysconfig{"link_index"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 199 | 0 | $config{"link_index"} = getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 200 | Where do you store your link_index database? The system defines | ||||||||||||||||||||||||||||||||
| 201 | $sysconfig{"link_index"} | ||||||||||||||||||||||||||||||||
| 202 | press return and we will just use the system configuration. If your | ||||||||||||||||||||||||||||||||
| 203 | system administrator runs link checking for you then don't change | ||||||||||||||||||||||||||||||||
| 204 | this. | ||||||||||||||||||||||||||||||||
| 205 | EOQ | ||||||||||||||||||||||||||||||||
| 206 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 207 | }; | ||||||||||||||||||||||||||||||||
| 208 | 0 | $config{"link_index"} = getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 209 | Where do you store your link_index database? If you don't give this | ||||||||||||||||||||||||||||||||
| 210 | then you won't be able to report which links are on a given page. | ||||||||||||||||||||||||||||||||
| 211 | EOQ | ||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||
| 214 | 0 | print "\n"; | |||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||
| 216 | CASE: { | ||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | $homeconfig{"schedule"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 218 | 0 | $config{"schedule"} = getstring( <<EOQ, $homeconfig{"schedule"}); | |||||||||||||||||||||||||||||||
| 219 | Where do you store your link checking schedule? Please give the | ||||||||||||||||||||||||||||||||
| 220 | full path to the file. You can use '~/' to indicate your home directory. | ||||||||||||||||||||||||||||||||
| 221 | Press return to use the same as before: | ||||||||||||||||||||||||||||||||
| 222 | $homeconfig{"schedule"} | ||||||||||||||||||||||||||||||||
| 223 | Type a single r and this will be reset to use the system configuration. | ||||||||||||||||||||||||||||||||
| 224 | EOQ | ||||||||||||||||||||||||||||||||
| 225 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 226 | }; | ||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | $sysconfig{"schedule"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 228 | 0 | $config{"schedule"} = getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 229 | Where do you store your link checking schedule? The system defines | ||||||||||||||||||||||||||||||||
| 230 | $sysconfig{"schedule"} | ||||||||||||||||||||||||||||||||
| 231 | press return and we will just use the system configuration. You need | ||||||||||||||||||||||||||||||||
| 232 | to set this if you want to run your own link checking separately from | ||||||||||||||||||||||||||||||||
| 233 | the system administrator. Otherwise it's better to stick with the | ||||||||||||||||||||||||||||||||
| 234 | administrator doing this and there's no need to worry. | ||||||||||||||||||||||||||||||||
| 235 | EOQ | ||||||||||||||||||||||||||||||||
| 236 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 237 | }; | ||||||||||||||||||||||||||||||||
| 238 | 0 | $config{"schedule"} = getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 239 | Where do you store your link checking schedule? You need this in order to | ||||||||||||||||||||||||||||||||
| 240 | be able to run link checking yourself. | ||||||||||||||||||||||||||||||||
| 241 | EOQ | ||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||
| 244 | CASE: { | ||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | $homeconfig{"infostrucs"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 246 | 0 | $config{"infostrucs"} = getstring( <<EOQ, $homeconfig{"infostrucs"}); | |||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||
| 248 | Where do you keep your infostrucs file. This defines where your web | ||||||||||||||||||||||||||||||||
| 249 | pages to be checked are and which files create them. Give the | ||||||||||||||||||||||||||||||||
| 250 | full path to the file. You can use '~/' to indicate your home directory. | ||||||||||||||||||||||||||||||||
| 251 | Press return to use the same as before: | ||||||||||||||||||||||||||||||||
| 252 | $homeconfig{"infostrucs"} | ||||||||||||||||||||||||||||||||
| 253 | Type a single r and this will be reset to use the system configuration. | ||||||||||||||||||||||||||||||||
| 254 | EOQ | ||||||||||||||||||||||||||||||||
| 255 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 256 | }; | ||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | $sysconfig{"infostrucs"} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 258 | 0 | $config{"infostrucs"} = getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 259 | Where do you keep your infostrucs file. This defines where your web | ||||||||||||||||||||||||||||||||
| 260 | pages to be checked are and which files create them. Give the | ||||||||||||||||||||||||||||||||
| 261 | full path to the file. You can use '~/' to indicate your home directory. | ||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||
| 263 | The system defines | ||||||||||||||||||||||||||||||||
| 264 | $sysconfig{"infostrucs"} | ||||||||||||||||||||||||||||||||
| 265 | press return and we will just use the system configuration. You need | ||||||||||||||||||||||||||||||||
| 266 | to set this to a file which points to your web pages. | ||||||||||||||||||||||||||||||||
| 267 | EOQ | ||||||||||||||||||||||||||||||||
| 268 | 0 | last CASE; | |||||||||||||||||||||||||||||||
| 269 | }; | ||||||||||||||||||||||||||||||||
| 270 | 0 | $config{"infostrucs"} = getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 271 | Where do you keep your infostrucs file. This defines where your web | ||||||||||||||||||||||||||||||||
| 272 | pages to be checked are and which files create them. Give the | ||||||||||||||||||||||||||||||||
| 273 | full path to the file. You can use '~/' to indicate your home directory. | ||||||||||||||||||||||||||||||||
| 274 | EOQ | ||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||
| 278 | 0 | foreach my $var ( qw(link_index page_index links infostrucs) ) { | |||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | defined $config{$var} or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | $config{"$var"} =~ m,^r$, and delete $config{"$var"}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | defined $config{$var} or next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 282 | 0 | $config{"$var"} =~ s,^~/,$ENV{"HOME"}/,; | |||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | rename $homeconfig_file . '.bak', $homeconfig_file . '.bak.bak' | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-e $homeconfig_file . '.bak' and -e $homeconfig_file
MC/DC0%0/2
-e $homeconfig_file . '.bak' and -e $homeconfig_file
-e $homeconfig_file . '.bak'
-e $homeconfig_file
Truth table0%0/3
A and B
A= -e $homeconfig_file . '.bak'B= -e $homeconfig_file
| |||||||||||||||||||||||||||||||||
| 287 | if -e $homeconfig_file . ".bak" and -e $homeconfig_file; | ||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | rename $homeconfig_file, $homeconfig_file . '.bak' | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
-e $homeconfig_file && (rename($homeconfig_file, $homeconfig_file . '.bak') || die(q[couldn't make backup of old configuration file,]))
rename $homeconfig_file, $homeconfig_file . '.bak' or die "couldn't make backup of old configuration file,"
MC/DC0%0/2
-e $homeconfig_file && (rename($homeconfig_file, $homeconfig_file . '.bak') || die(q[couldn't make backup of old configuration file,]))
-e $homeconfig_file
rename $homeconfig_file, $homeconfig_file . '.bak'
Truth table0%0/3
A && B
A= -e $homeconfig_fileB= rename $homeconfig_file, $homeconfig_file . '.bak'
| |||||||||||||||||||||||||||||||||
| 289 | or die "couldn't make backup of old configuration file," | ||||||||||||||||||||||||||||||||
| 290 | if -e $homeconfig_file; | ||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | open CONFIG, ">$homeconfig_file" | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 292 | or die "unable to write to " . $homeconfig_file . ": ". $!; | ||||||||||||||||||||||||||||||||
| 293 | 0 | print CONFIG <<'EOF'; | |||||||||||||||||||||||||||||||
| 294 | #Automatically generated config file for LinkController. Maybe you | ||||||||||||||||||||||||||||||||
| 295 | #want to use the configuration utility configure-link-control? | ||||||||||||||||||||||||||||||||
| 296 | use vars qw($schedule $links $page_index $link_index $fixlink_cgi | ||||||||||||||||||||||||||||||||
| 297 | $user_address $infostrucs); | ||||||||||||||||||||||||||||||||
| 298 | EOF | ||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||
| 300 | 0 | print CONFIG <<"EOF"; | |||||||||||||||||||||||||||||||
| 301 | \$::user_address = '$config{"user_address"}'; | ||||||||||||||||||||||||||||||||
| 302 | EOF | ||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||
| 304 | 0 | %comments= | |||||||||||||||||||||||||||||||
| 305 | ( '$::links' => '$::links - filename of database of link information', | ||||||||||||||||||||||||||||||||
| 306 | '$::page_index' => '$::page_index - filename of links on page index', | ||||||||||||||||||||||||||||||||
| 307 | '$::link_index' => '$::link_index - filename of page with links index', | ||||||||||||||||||||||||||||||||
| 308 | '$::schedule' => '$::schedule - link testing schedule filename', | ||||||||||||||||||||||||||||||||
| 309 | '$::fixlink_cgi' => '$::fixlink_cgi - URL of linkfixing CGI', | ||||||||||||||||||||||||||||||||
| 310 | '$::infostrucs' => '$::infostrucs - File defining where we keep our web pages', | ||||||||||||||||||||||||||||||||
| 311 | ); | ||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||
| 313 | 0 | foreach my $varname ( qw($::links $::page_index $::link_index $::schedule | |||||||||||||||||||||||||||||||
| 314 | $::fixlink_cgi $::infostrucs) ) { | ||||||||||||||||||||||||||||||||
| 315 | 0 | my $configname = $varname; | |||||||||||||||||||||||||||||||
| 316 | 0 | $configname =~ s/^\$:://; | |||||||||||||||||||||||||||||||
| 317 | 0 | print CONFIG '#' . $comments{$varname} . "\n"; | |||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | if ( $config{$configname} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||
| 320 | 0 | print CONFIG <<"EOF" ; | |||||||||||||||||||||||||||||||
| 321 | $varname="$config{$configname}" ; | ||||||||||||||||||||||||||||||||
| 322 | EOF | ||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||
| 324 | } else { | ||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||
| 326 | 0 | print CONFIG <<"EOF" ; | |||||||||||||||||||||||||||||||
| 327 | #$varname="xxxx" ; | ||||||||||||||||||||||||||||||||
| 328 | 1; #allows file to be required | ||||||||||||||||||||||||||||||||
| 329 | EOF | ||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | close CONFIG or die "closing config file failed" . $!; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||
| 335 | 0 | print << "EOF"; | |||||||||||||||||||||||||||||||
| 336 | Your configuration has been written. You can edit it in $homeconfig_file. | ||||||||||||||||||||||||||||||||
| 337 | EOF | ||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | if ( $config{infostrucs} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | -e $config{infostrucs} && do { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 341 | 0 | print <<EOF; | |||||||||||||||||||||||||||||||
| 342 | The infostrucs file already exists. We will stop configuration here. | ||||||||||||||||||||||||||||||||
| 343 | Delete it if you would like to recreate it. | ||||||||||||||||||||||||||||||||
| 344 | EOF | ||||||||||||||||||||||||||||||||
| 345 | 0 | exit; | |||||||||||||||||||||||||||||||
| 346 | }; | ||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||
| 348 | 0 | my $directory=getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 349 | In which directory do you keep your web pages? Leave empty if there | ||||||||||||||||||||||||||||||||
| 350 | is no directory | ||||||||||||||||||||||||||||||||
| 351 | EOQ | ||||||||||||||||||||||||||||||||
| 352 | 0 | my $baseurl=getstring( <<EOQ ); | |||||||||||||||||||||||||||||||
| 353 | What is the baseurl of your web pages (e.g. http://www.example.com/)? | ||||||||||||||||||||||||||||||||
| 354 | EOQ | ||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | if ($baseurl) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 357 | open INFOS, ">" . $config{infostrucs} | ||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | or die "couldn't open infostrucs file " . $config{infostrucs}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | if ( $directory ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 360 | 0 | print INFOS "directory $baseurl $directory\n"; | |||||||||||||||||||||||||||||||
| 361 | } else { | ||||||||||||||||||||||||||||||||
| 362 | 0 | print INFOS "www $baseurl\n"; | |||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||
| 365 | } else { | ||||||||||||||||||||||||||||||||
| 366 | 0 | warn <<EOF; | |||||||||||||||||||||||||||||||
| 367 | We can not generate an infostruc file without a baseurl. Please look | ||||||||||||||||||||||||||||||||
| 368 | in the LinkController manual for details about how this file should be | ||||||||||||||||||||||||||||||||
| 369 | built. | ||||||||||||||||||||||||||||||||
| 370 | EOF | ||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||
| 373 | 1; | ||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||