i see. i will read that Tom Christiansen doc... i like the prototyping, and i don't expect anyone to be maintaining my code...i literally am a one man band here. besides, i'm 100% certain anyone who comes along to maintain my code...would start totally anew. eg?

this code just verifies user's email input is valid (of course, doesn't check if email address exists or not) - just confirms conformity
#!/usr/bin/perl # /var/www/html/verifyemail.pl # must have's! use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use URI::Escape; use lib "/var/www/html/Pm"; use Bc_misc qw(get_param); use Bc_sql qw(sql_connect sql_execute sql_disconnect); my $e = uri_unescape(get_param("e")); $e =~ s/(\!|\#|\$|\%|\&|\'|\*|\+|\-|\/|\=|\?|\^|\_|\`|\{|\||\}|\~)/\\$ +1/g; my $usable = 1; # start off assuming the email address is valid, even +if it isn't my $DEBUG = 0; print "cache-control: no-cache, no-store\ncontent-type: text/plain\n\n +"; if ($e) { my $db = sql_connect("ns.db"); my $sql = sql_execute($db, "select email from users", "verifyemail.p +l"); # the last param appends to an error msg, if error (so i know wh +at causes the error) if ($sql) { my @users = @$sql; foreach my $userRef (@users) { my %user = %$userRef; if (uri_unescape($user{email}) =~ /^$e$/i) { $usable = 0; } } } sql_disconnect($db); } else { $usable = -1; } # now, check to make sure the email is actually valid if ($usable) { # email addresses already in DB don't need verification...duh # we're just gonna make sure there's only ONE @ symbol, and at least + one dot # first, let's split the address up at the @ my @addy = split(/\@/, $e); # it should only be two pieces if (@addy != 2) { $usable = -2; } else { # okay, so it's got two bits. # now check for double . and leading/trailing dots in both parts o +f addy if ($addy[0] =~ /\.(\.)+/ or $addy[1] =~ /\.(\.)+/ or $addy[0] =~ /^\./ or $addy[1] =~ /^\./ or $addy[0] =~ /\.$/ or $addy[1] =~ /\.$/ or $addy[1] !~ /\./) { $usable = -3; } else { # now, we gotta make sure only valid characters # are in both parts # first, we'll start with the stuff before @ # and then work on the stuff after # remove all valid characters from the email address. # whatever's left over is invalid, unless it's blank! # blank is GOOD my $addy1 = $addy[0]; my $addy2 = $addy[1]; $addy1 =~ s/[a-z]//ig; $addy1 =~ s/[0-9]//ig; # remove `~!#$%^&*-_=+/?{}' $addy1 =~ s/\\\!|\\\#|\\\$|\\\%|\\\&|\\\*|\\\+|\\\-|\\\/|\\\=|\\ +\?|\\\^|\\\_|\\\`|\\\{|\\\||\\\}|\\\~|\\'//g; # ' <-- here to termin +ate the first quote! $addy1 =~ s/\.//g; # and now the stuff after @ $addy2 =~ s/[a-z]//ig; $addy2 =~ s/[0-9]//ig; $addy2 =~ s/\.//g; $addy2 =~ s/-//g; if ($addy1) { $usable = -4; } if ($addy2) { $usable = -5; } } } } if ($DEBUG) { print $usable; print "\n$e"; } else { print $usable; } exit 1;
and....what's meant by will they be surprised at how their code gets parsed? - parsed? I know what parsing is....but why would my code get parsed??

In reply to Re^5: perl and apache2 on ubuntu 17.04 by jamroll
in thread perl and apache2 on ubuntu 17.04 by jamroll

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.