Permalink
Browse files

Email is a common-enough theme in Perl, so I split it off of the How …

…Do I...? page

and gave it its own.

I moved the question from How Do I...? to be the first (and currently only) topic 
in email.pod, and added a category for Email to crank.
  • Loading branch information...
1 parent e82f428 commit c0eba0376676b05c941b03d612ab59491cc6e3ea Jason Crome committed May 3, 2007
Showing with 41 additions and 13 deletions.
  1. +1 −0 crank
  2. +40 −0 s/email.pod
  3. +0 −13 s/how-do-i.pod
View
1 crank
@@ -152,6 +152,7 @@ Command-line Switches
Advanced Functions
Style
Traps
+Email
How do I...?
Developer Tools
Publications
View
@@ -0,0 +1,40 @@
+=head1 Email Addressing, Processing, and Handling
+
+=head2 How do I see if an email address is valid?
+
+In general, you can't. There are several methods available to see
+if it looks reasonable, but there is no way to determine if an
+address is actually deliverable without actually attempting
+delivery.
+
+Using regular expressions:
+
+ # Match basically blah@blah.blah
+ if ( $addr =~ /^\S+\@\S+\.\S+$/ ) {
+ print "Looks OK";
+ }
+
+If you're doing any real work, you may wish to look to one of
+the modules available on L<http://search.cpan.org>, such as:
+
+=over 4
+
+=item C<Email::Address>
+
+=item C<Email::Valid>
+
+C<Email::Valid> makes it easy to determine if an email address is
+well-formed:
+
+ use Email::Valid;
+
+ print ( Email::Valid->address( 'someone@gmail.com' ) ? 'Yes' : 'No' ); # prints Yes
+ print ( Email::Valid->address( 'someone#gmail.com' ) ? 'Yes' : 'No' ); # prints No
+
+C<Email::Valid> can also tell you why an address is invalid:
+
+ print "Invalid address: $Email::Valid::Details \n"
+ unless Email::Valid->address( 'you#foo.bar' );
+
+=back
+
View
@@ -34,16 +34,3 @@ L<http://search.cpan.org>.
If you're parsing HTML so that you can extract links or images from
a web page, use C<WWW::Mechanize> which handles it for you.
-=head2 How do I see if an email address is valid?
-
-In general, you can't. You can write a regular expression to see
-if it looks reasonable.
-
- # Match basically blah@blah.blah
- if ( $addr =~ /^\S+\@\S+\.\S+$/ ) {
- print "Looks OK";
- }
-
-If you're doing any real work, look at Email::Address.
-
-In no case will it tell you if an email address is actually valid.

0 comments on commit c0eba03

Please sign in to comment.