Hello All,

This is sort of a funky question, so I'll try to explain the best I can.

I have a fairly complex web-based program, I'd like to allow people who use the program to 'roll their own' parts of the program. See? no makey sense, let me explain with an example:

Say I have the common form handler; a user submits a form, the form info gets mailed to whomever; the user gets a thank you message from the scrpt.

Now, say, instead of having the script generate a thank you page, I want it to redirect to a different page.. BUT! I don't want to implicitly add this feature into the script, I just want the script to have hooks to a uniquely specified function or something. That way, anyone with enough know-how can easily make a new chunk oh code that the main part of the program can call, but I don't want this new chunk to live inside the main program, it should be on it's own.

Am I making sense? I'm not sure. An idea on the top of my head is to have a variable that controls if the program should use its built in way of doing things. Something like:

if($roll_your_own == 1){ system('a_different_script.pl'); }else{ go_at_it_yourself(); }

In this example, I'm calling an outside script to handle the job. Right away, this doesn't seem to be the best thing to do; since I'm not sure exactly the outside script will retreive all the arguments, and there's always security concerns with system();

Would a better way be to have a module specifically designed to all you to put your own code in? something like:

if($roll_your_own == 1){ require RollYourOwn RollYourOwn::rollit($do_this) }else{ go_at_it_yourself(); }

I know this must be something that other people have come across in big scripts; they want to have the ability to add the functionalitly, but not have that functionality in the distribution, since the functionality could be so local it wouldn't make sense in other uses of the program.

-justin simoni
!skazat!


In reply to Allowing the over riding of a program's design by skazat

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.