or would this be much better?
#!/usr/bin/perl -T
use strict;
use warnings;
use CGI();
use Mail::Mailer;
my $q = CGI->new();
# Email address where form submits are sent.
my $email = '[EMAIL PROTECTED]';
# Your subject for the form submits.
my $subject = '[INFO] Site Comment';
print $q->header
"Jason Gray" <[EMAIL PROTECTED]> wrote in message news:...
> Could I do this?
>
> sub check_fields {
> my $q = shift;
> my $match;
> my @fields = ('name', 'email', 'city', 'state', 'message');
> foreach my $field (@fields) {
> next if ($q->param($field));
> $match = 0;
> print "Please fi
So would this solve the problem?
check_fields($q);
sub check_fields {
my $q = shift;
my @fields = qw(name email city state message);
foreach my $field (@fields) {
next if ($q->param($field));
print 'Please fill in the blank fields.';
exit;
}
unless (Email::Valid->address($q->param('ema
> Is this how you were talking about getting rid of globals, and does this
> seem correct?
>
> #!/usr/bin/perl -T
>
> use strict;
> use warnings;
>
> use lib '/home/perl-lib/modules';
>
> use CGI;
> use Email::Valid;
> use Mail::Mailer;
>
> my $q = CGI->new();
>
> print $q->header();
>
> che
Is this how you were talking about getting rid of globals, and does this
seem correct?
#!/usr/bin/perl -T
use strict;
use warnings;
use lib '/home/perl-lib/modules';
use CGI;
use Email::Valid;
use Mail::Mailer;
my $q = CGI->new();
print $q->header();
check_fields($q);
sub check_fields {
my
s d Anconia" <[EMAIL PROTECTED]>
To: "Jason Gray" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, June 15, 2004 10:18 AM
Subject: Re: a way to make this more secured and better written?
#!/usr/bin/perl -w
use strict;
use warnings;
You probably don't want
>
> > my @fields = qw(name email city state message);
> > foreach my $field (@fields) {
> > $blanks++ if !$q->param($field);
> > }
> for(@fields) { $blanks ++ if $q->param($_) eq ''; }
>
IMO, I disagree that removing whitespace and switching a named variable
such as $field to $_ is an
> #!/usr/bin/perl -w
>
> use strict;
> use warnings;
You probably don't want both -w and 'use warnings'. Personally I would
stick with the 'use warnings' unless you have to deal with older
versions of Perl which is not terribly likely. The -w turns on warnings
for the whole script, which will in
Jason Gray wrote:
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI();
use Mail::Mailer;
my $q = CGI->new();
print $q->header();
#-
# * startup methods -> global variables.
check_fields();
#-
sub check_fields {
my
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI();
use Mail::Mailer;
my $q = CGI->new();
print $q->header();
#-
# * startup methods -> global variables.
check_fields();
#-
sub check_fields {
my $blanks;
m
10 matches
Mail list logo