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

I want to have only one copy of Formmail(my example) program sit in one place and user can access it indirectly(fill in form and send mail thr it). this way, if formmail has new update come out, i can make a change very quickly.
something like this

i have formmail.pm which is one big
sub run { everything else here }

then each user cgi-bin dir has mailer.cgi :
use libs '/where/formmail.pm/is'; run;

but i am stuck. i tried the above approace, it loads up the form, and once the form submitted, it try to locate formmail.cgi in the same dir where mailer is. i don't know how exactly i should make it works as i expect. i need idea/concept..

There are probably other ways(better) to do it, i would love to hear it too.

TIA,
James.

Replies are listed 'Best First'.
Re: wrapper for single cgi program
by Jaap (Curate) on Feb 03, 2003 at 12:30 UTC
    You could install formmail once as a webmaster and have your users use it directly in the webmaster's cgi space.
    Let's say install it in /home/webmaster/cgi-bin and everyone can access it through
    http://yourdomain.com/cgi-bin/formail.pl

    This is the easiest (and commonly used) solution i guess.
      thanks. i thought about hidden field.

      I don't want user manually creat the form. so i will write another script (config.pl) that let user input domain/email and save it into a config file. it will be read into the formmail form and will be the content of the hidden field.
      in the config.pl,i have to depend on the $ENV{DOCUMENT_ROOT} to parse the user name, then the config file will store in users dir.

      is it safe to use $ENV{DOCUMENT_ROOT} ?

      btw, i am using nms' improved Matt scripts. so it's more secure.

Re: wrapper for single cgi program
by jacques (Priest) on Feb 03, 2003 at 14:08 UTC
    What are you trying to accomplish exactly? If you want to have one script that handles each and every web form, then there is no need to place anything in multiple cgi-bins. Just place the script in the main cgi-bin and use hidden form fields in the html. With the hidden fields, you can submit specific parameters for each form. (With such a system, you should also take the appropriate security precautions.)

    By the way, I hope you are not using Matt Wright's infamous Formmail script, which should be treated as a virus.