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

Hello, I'm using the formmail on NT from Matt's Script Archive http://worldwidemart.com/scripts/formmail.shtml A variable seems to to add itself onto itself between invocations? the only fix is to reboot the machine! Am I just crazy or is something weird happening? The $Config{'recipient'} field is added to itself, i.e. The 3'rd time that I submit a form to formmail.pl, the previous 2 $Config{'recipient'} values are pre-pended to the new "To:" value, resulting in: "To: first.email@hotmail.com,second.email@hotmail.com,latest-email@hotmail.com" It seems to cache the previous values & add them on???? I'm using the standard Perl installation that comes the Apache server used in Oracle Application Server.

Replies are listed 'Best First'.
Re: Mutating variable between instances?
by Molt (Chaplain) on Apr 19, 2002 at 13:14 UTC

    Eep!

    Since it looks like davorg hasn't seen this yet, I guess I'll be the one to point this out.. don't use Matt's scripts, they're insecure and badly written. There's a good reason he and some other respected Perlmonks have been working hard on NMS, which is a nicely coded drop-in replacement which adheres to proper coding practices.

    Have a look here is you don't just want to take my word for this, or SuperSearch for 'Matt's Script Archive'.

    Don't try and debug Matt, use NMS. It's quicker, safer, and the right thing to do. Go on, you know you want to.

Re: Mutating variable between instances?
by Juerd (Abbot) on Apr 19, 2002 at 09:51 UTC

    Are you running mod_perl? If so, use Apache::PerlRun for the crappy scripts from Matt's Archive. Are you running some other speedycgi-like implementation that runs a longer term interpreter? Quit using it.

    You might appreciate http://nms-cgi.sf.net/, which aims at rewriting the scripts with added sanity. The NMS versions are more likely to work and less likely to contain huge gaping security holes.

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

Re: Mutating variable between instances?
by davorg (Chancellor) on Apr 20, 2002 at 11:41 UTC

    As Molt has pointed out, you really shouldn't be using Matt's scripts if you value the security of your site at all.

    In particular, FormMail has recently been responsible for a large number of spam email attacks. Even Matt's latest version (1.9) doesn't completely fix this problem. See this document for full details.

    I'd recommend that you use the nms version instead, particularly as we've recently been putting effort into ensuring that it runs under mod_perl.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg