Yuck!

Sorry, had to get that out of the way first. :P Here is what i would do: use a database! All you need to store is a unique identifier for the user and the contents of the page itself. Then, your CGI script accepts the user id as a parameter, fetches the page for that uid, and then displays it in a text area that uses HTMLArea to turn the text area box into a ... yes it really works ... WYSIWYG HTML editor. Now your client doesn't even have to know how to "code" HTML. :)

I suppose you could achieve the same effects by opening the index file, reading the contents into the text area and re-writing the index file upon submit ... and if you really only need to do this for one user then the only two hard parts you have will be:

  1. setting the permissions so you can overwrite the file
  2. getting HTMLArea up and running and configuring it
You shouldn't even have to worry about flocking the index file if only one person is going to be editting it. (And this is another reason why i use databases - i don't have to worry about file locking race conditions.)

Oh, and by the way, your system usage looks wrong. Try passing a list instead:

system ( 'perl', '-pi.bak', '-e', 's/Old Spotlight/Product Spotlight/', '/var/www/html/acs/new/index.html', );
But remember that if you don't have the proper permissions set for the index file, you can't write to it. And please, please do consider using HTMLArea instead of search and replace substitution. Your client will love you for it. :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to 3Re: Converting FILEHANDLE to string by jeffa
in thread Converting FILEHANDLE to string by joev

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.