I have a large CGI system that my company uses that I developed for generating dynamic webpages. This system is large and has been developed by me over a few years. The website that it runs on will soon be webmastered by a perl novice who does not want to mess with my system.

Here is my question: the script I wrote is run everytime a request is sent for this particular domain. To allow this new webmaster to add functionality to the system without having to edit the main file, I wanted to allow him to write special files (with a certain extension or some identifier) that are just perl files that the system would search for upon every execution, and if it found them, execute. I was thinking about just slurping the whole 'plugin' file and then eval-ing it.

Now, as long as he knows what he is doing and writes conservative and clean code, and as long as I come up with some way of making sure that the file is written by him and not by someone else (some kind of passcode or something - that is not important), is it safe to do what I am planning, ie: using eval to execute whole files like this?

It seems like it should work as long as I make sure to watch @! and what have you, but I just wanted to ask the best perlites I know what they thought. Thanks a bunch for your help!!

R.Joseph

In reply to Using eval to create 'plugins' by r.joseph

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.