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

n00b here. I need to edit 1 line in my perl file each time I run it). How could I use an html form to edit it? I intentionally want to stay away from text editors. TIA

Replies are listed 'Best First'.
Re: html form to edit perl file
by ww (Archbishop) on Nov 06, 2010 at 05:19 UTC

    I do hope your title is merely "phrased badly" because, while you can edit an html file with perl... you can't edit perl with html.

    OTOH, f you mean to modify your script each time it parses data from a form with an inbuilt routine that recognizes the form data as its cue to re-write itself... well, as AM said, self-modifying executables are rarely a "really good idea."

    And, re "I intentionally want to stay away from text editors" -- how, then, do you propose to (or "did you") write the script in the first place?

Re: html form to edit perl file
by kcott (Archbishop) on Nov 05, 2010 at 22:22 UTC

    Depending on the change required, you may be able to do it within the program itself, by passing in some argument or via some other method.

    Please provide more information such as the code to be changed and the types of changes to be made.

    -- Ken

Re: html form to edit perl file
by Anonymous Monk on Nov 05, 2010 at 20:53 UTC
    bad idea, and with tht said, [id://Inline::Files]
Re: html form to edit perl file
by MidLifeXis (Monsignor) on Nov 08, 2010 at 15:03 UTC

    Heed the anonymous monks recommendation. Try to split your code from the data that will be modified. Your script can read the data file, protect itself from malicious changes outside of your script 1, and do other types of bullet-proofing.

    Footnotes

    1:
    For example, your script, A.cgi, is "secure" 2, but B.cgi is not. $baddie uses B.cgi to change A.cgi to something that A.cgi would normally filter out. A.cgi is no longer "secure".
    2:
    Since A.cgi is writable by the web server, I would argue that A.cgi is not secure.

    --MidLifeXis