From: Dan M. <oma...@lc...> - 2003-01-05 01:48:15
|
>Of course, we'll need a release time script to build a standalone >version of FormMail.pl with all those modules inlined into it before >we can consider making releases It would be great to have a modularized package publicly available as well. Many of the users of FormMail.pl are in fact ISPs setting up the scripts for use by their customers. Upgrades would be more likely if the process was updating a library instead of 100s of cgi-bin directories... For what it is worth, I am happily looking forward to seeing V2 in anonymous CVS ----- Original Message ----- From: "Nick Cleaton" <ni...@cl...> To: <nms...@li...> Sent: Saturday, January 04, 2003 3:36 AM Subject: [Nms-cgi-devel] Reworked FormMail > > While I was on holiday, I couldn't resist pulling FormMail.pl apart and > trying to make it better. > > > Highlights: > > * All the code is in modules > > * All OO - bits shared with other scripts are in a superclass > > * User customisation mechanism via inheritance - no more support > posts like "change X to Y on line 804", now we can just say > "add this code to the user customisation section of your FormMail.pl" > instead. > > * Trace information is in a Received header, which may or may not > be an improvement. > > * The values of the configuration form fields can be fixed in the > script config, if desired. > > > So FormMail.pl can now be trimmed down to: > > > : #!/usr/bin/perl -wT > : use strict; > : use vars qw( > : $DEBUGGING $emulate_matts_code $secure > : $allow_empty_ref $max_recipients $mailprog @referers > : @allow_mail_to @recipients %recipient_alias > : @valid_ENV $date_fmt $style $send_confirmation_mail > : $confirmation_text $locale $charset $no_content > : $double_spacing $wrap_text $wrap_style $postmaster > : ); > : > : # PROGRAM INFORMATION > : # ------------------- > : # FormMail.pl $Revision: 2.20 $ > : # > : # This program is licensed in the same way as Perl > : # itself. You are free to choose between the GNU Public > : # License <http://www.gnu.org/licenses/gpl.html> or > : # the Artistic License > : # <http://www.perl.com/pub/a/language/misc/Artistic.html> > : # > : # For help on configuration or installation see the > : # README file or the POD documentation at the end of > : # this file. > : > : # USER CONFIGURATION SECTION > : # -------------------------- > : # Modify these to your own settings. You might have to > : # contact your system administrator if you do not run > : # your own web server. If the purpose of these > : # parameters seems unclear, please see the README file. > : # > : BEGIN > : { > : $DEBUGGING = 1; > : $emulate_matts_code= 0; > : $secure = 1; > : $allow_empty_ref = 1; > : $max_recipients = 5; > : $mailprog = '/usr/lib/sendmail -oi -t'; > : $postmaster = ''; > : @referers = qw(dave.org.uk 209.207.222.64 localhost); > : @allow_mail_to = qw(yo...@yo...main som...@yo...main localhost); > : @recipients = (); > : %recipient_alias = (); > : @valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT); > : $locale = ''; > : $charset = 'iso-8859-1'; > : $date_fmt = '%A, %B %d, %Y at %H:%M:%S'; > : $style = '/css/nms.css'; > : $no_content = 0; > : $double_spacing = 1; > : $wrap_text = 0; > : $wrap_style = 1; > : $send_confirmation_mail = 0; > : $confirmation_text = <<'END_OF_CONFIRMATION'; > : From: yo...@yo... > : Subject: form submission > : > : Thank you for your form submission. > : > : END_OF_CONFIRMATION > : # > : # USER CONFIGURATION << END >> > : # ---------------------------- > : } > : # USER CUSTOMISATION SECTION > : # -------------------------- > : # Place custom code below. This should be considered an expert > : # feature. > : > : > : > : # USER CUSTOMISATION << END >> > : # ---------------------------- > : # (no user serviceable parts beyond here) > : > : use CGI::NMS::Script::FormMail; > : use base qw(CGI::NMS::Script::FormMail); > : > : use vars qw($script); > : BEGIN { > : $script = __PACKAGE__->new( > : DEBUGGING => $DEBUGGING, > : emulate_matts_code => $emulate_matts_code, > : secure => $secure, > : allow_empty_ref => $allow_empty_ref, > : max_recipients => $max_recipients, > : mailprog => $mailprog, > : postmaster => $postmaster, > : referers => [@referers], > : allow_mail_to => [@allow_mail_to], > : recipients => [@recipients], > : recipient_alias => {%recipient_alias}, > : valid_ENV => [@valid_ENV], > : charset => $charset, > : date_fmt => $date_fmt, > : style => $style, > : no_content => $no_content, > : double_spacing => $double_spacing, > : wrap_text => $wrap_text, > : wrap_style => $wrap_style, > : send_confirmation_mail => $send_confirmation_mail, > : confirmation_text => $confirmation_text, > : ); > : } > : > : $script->request; > : > > ... and I have working implementations of the modules behind that: > > http://cleaton.net/tmp/CGI/NMS/Script/FormMail.pm > http://cleaton.net/tmp/CGI/NMS/Script.pm > http://cleaton.net/tmp/CGI/NMS/Validator.pm > http://cleaton.net/tmp/CGI/NMS/Charset.pm > http://cleaton.net/tmp/CGI/NMS/Mailer.pm > http://cleaton.net/tmp/CGI/NMS/Mailer/Sendmail.pm > http://cleaton.net/tmp/CGI/NMS/Mailer/SMTP.pm > > ... those pass all current FormMail tests, although some test scripts > needed some munging before they'd work and it errs more on the side > of security than it used to in the case where $secure is 0. > > I haven't put those in CVS yet, because I'm not sure where they should > go. This is a big change, how about starting a new source namespace > for it ? The old one is a bit chaotic (mostly my fault) so I suggest > adding a /v2 directory for a version 2 of NMS, and checking in those > .pm files under a /v2/lib/ directory. > > Of course, we'll need a release time script to build a standalone > version of FormMail.pl with all those modules inlined into it before > we can consider making releases from these sources. > > -- > Nick > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Nms-cgi-devel mailing list > Nms...@li... > https://lists.sourceforge.net/lists/listinfo/nms-cgi-devel > |