Wiki‎ > ‎Useful links‎ > ‎Charslnword‎ > ‎

Character in words warning

This code, taken from a specially hacked version of philoload, reads in the textload.cfg file and will throw up a warning if a non-standard $CHARSINWORD variable is set. The last three lines in this code snippet are part of philoload normally, so you know where to put it.

# Let's be obnoxious and throw up a warning for us boneheads if we are loading
# something with non-standard CHARSINWORD -- we've forgotten to check this
# numerous times in the past resulting in messed-up loads.

open TLC, "/Volumes/data/var/lib/philologic/textload.cfg";
while ($tlcline = <TLC>) {

if ($tlcline =~ /^\$CHARSINWORD/) {
$charsline = $tlcline;
close TLC;

if ($charsline ne q($CHARSINWORD = "[\&A-Za-z0-9\177-\377][\&A-Za-z0-9\177-\377\_\';]*";)) {
print STDOUT "\n\nWARNING: You are using a non-standard CHARSINWORD setting:\n\n\t" . $charsline;
print STDOUT "\n\nPlease check ";
print STDOUT "/Volumes/data/var/lib/philologic/textload.cfg and make sure this is the setting ";
print STDOUT "that you want.\n\n";
$_ = <STDIN>;