Tricky has asked for the wisdom of the Perl Monks concerning the following question:

Hello,
I'm working on reformatting HTML pages via a Perl-based proxy server. Part of my requirements is to change intercharacter spacing, so as to allow low-vision users read the page (with or without screen magnification). I've tried google serach and come up with zip thats useful. Any suggestions, folks?

Regards

Richard

update (broquaint): added formatting

Replies are listed 'Best First'.
Re: Intercharacter spacing
by Aristotle (Chancellor) on Jul 23, 2003 at 11:40 UTC
    This only vaguely qualifies Perl question, at best. Anyway, I'd inject CSS into the documents. The letter-spacing, word-spacing and line-spacing attributes should do nicely.

    Makeshifts last the longest.

      When I run my file opening perl script to open a Notepad text file, the interpreter's throwing the exception below, and I'm stumped as to how I can remedy this. Here's my source first:
      #!/usr/bin/perl # nlexample.plx # The script opens a text file, reads it, prints a number and # then each line within the file. use warnings; use strict; use diagnostics; open FILE, 'C:\Perl\Perl practice\test.txt' or die $!; my $lineno = 1; while(<FILE>) { print $lineno++; print ": $_"; }
      Here's the text file:
      One day you're going to have to face
         A deep dark truthfull terror,
      And it's gonna tell you things that I still
         Love you too much to say.
      ####### Elvis Costello, Spike, 1988 #######
      
      And the expected response:
      1:One day you're going to have to face
      2:   A deep dark truthfull terror,
      3:And it's gonna tell you things that I still
      4:   Love you too much to say.
      5:####### Elvis Costello, Spike, 1988 #######
      

      Problem:

      1. Why is this exception occurring? Perl seems to be looking for the text file at the same location every time: how do I change this? Why is Perl looking for the test.txt file at this location? Must be a default setting.

      I using DzSoft Perl Editor to write my dode, and running from by the DOS promted provided by the IDE.

      Uncaught exception from user code: No such file or directory at C:\DOCUMENTS AND SETTINGS\RICHARD LAMB \L +OCAL SETTINGS\Temp\dir11.tmp\nlexample.plx line 8
      Very odd place for Windows to look for the files, as there”¦s no such file as ”„dir11.tmp”¦ when I look through the directory structure in Windows Explorer. Grrr. ƒ¼

      Windows seems to be looking for a temp file containing the perl source: what the hell is going on?!

      Solution: Locating the test.txt file in local settings?

      edited: Thu Jul 24 00:37:03 2003 by jeffa - code tags formatting

        I'm just guessing (never heard of "DzSoft Perl Editor"), but if this happens to be "line 8" of your test script:
        open FILE, 'C:\Perl\Perl practice\test.txt' or die $!;
        then the error report would have something to do with the "open" statement and the file name string that you're giving it.

        If the perl interpreter (perl.exe) is in a directory that's covered by your PATH environment variable in a DOS shell, try stepping away from the DzSoft IDE for a bit, and use the shell. Go to the directory where your test perl script is kept, and do:

        perl name_of_test_script
        If it gives a similar error report, try using forward slashes "/" instead of backslashes "\" in the file name that you pass to "open()". (I did say I was guessing...) Then make sure that the "test.txt" file really does exist in that exact path.

        Just out of curiosity, what do you get when you run this command in a DOS shell:

        perl -V
        For that matter, if you went to a directory that contains some longer file names (and names with spaces in them, etc), what would you get if you try this command:
        perl -e 'opendir(D,"."); print join($/,readdir(D)),$/'
        Do all the complete file names show up (long, with spaces,etc)? How about when you run that one-liner from within the IDE?

        One other point: don't even think about trying to do regex substitutions on HTML text data for the sake of "expanding" visible white-space. It'll give you a headache. Doing it without HTML::TokeParser would be utterly wrong. Doing it with HTML::TokeParser (and, say, adding &nbsp; in strategic spots) would just be misguided and unsatisfying (you'd see some results, but you'd rarely see results that look good).

      My apologies, I'm new to this, and should have had a more detailed question. Time to scratch up on CSS... Cheers Richard