# # Test the address/name extraction # require Mail::Address; $/ = ""; chomp(@line = ); print "1..",scalar(@line),"\n"; $i = 1; foreach $ln (@line) { next unless($ln =~ /\S/); ($test,$format,$name) = (split(/\n+/,$ln)); $q = (Mail::Address->parse($test))[0]; $ename = $q->name || ""; $eformat = $q->format || ""; $name = $ename unless defined $name; if($ename eq $name && $eformat eq $format) { print "ok ",$i,"\n"; } else { print "not ok ",$i,"\n"; print print "# name '$name' != '$ename'\n" unless $ename eq $name; print "# format '$format' != '$eformat'\n" unless $eformat eq $format; } $i++; } __DATA__ "Joe & J. Harvey" , JJV @ BBN "Joe & J. Harvey" Joe & J. Harvey "Joe & J. Harvey" "Joe & J. Harvey" Joe & J. Harvey JJV @ BBN JJV@BBN "spickett@tiac.net" "spickett@tiac.net" Spickett@Tiac.Net rls@intgp8.ih.att.com (-Schieve,R.L.) rls@intgp8.ih.att.com (-Schieve,R.L.) R.L. -Schieve bodg fred@tiuk.ti.com bodg m-sterni@mars.dsv.su.se m-sterni@mars.dsv.su.se jrh%cup.portal.com@portal.unix.portal.com jrh%cup.portal.com@portal.unix.portal.com Cup Portal Com astrachan@austlcm.sps.mot.com ('paul astrachan/xvt3') astrachan@austlcm.sps.mot.com ('paul astrachan/xvt3') Paul Astrachan/Xvt3 TWINE57%SDELVB.decnet@SNYBUFVA.CS.SNYBUF.EDU (JAMES R. TWINE - THE NERD) TWINE57%SDELVB.decnet@SNYBUFVA.CS.SNYBUF.EDU (JAMES R. TWINE - THE NERD) James R. Twine - The Nerd David Apfelbaum David Apfelbaum David Apfelbaum "JAMES R. TWINE - THE NERD" "JAMES R. TWINE - THE NERD" James R. Twine - The Nerd bilsby@signal.dra (Fred C. M. Bilsby) bilsby@signal.dra (Fred C. M. Bilsby) Fred C. M. Bilsby /G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk /G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk Owen Smith apardon@rc1.vub.ac.be (Antoon Pardon) apardon@rc1.vub.ac.be (Antoon Pardon) Antoon Pardon "Stephen Burke, Liverpool" "Stephen Burke, Liverpool" Stephen Burke Andy Duplain Andy Duplain Andy Duplain Gunnar Zoetl Gunnar Zoetl Gunnar Zoetl The Newcastle Info-Server The Newcastle Info-Server The Newcastle Info-Server wsinda@nl.tue.win.info (Dick Alstein) wsinda@nl.tue.win.info (Dick Alstein) Dick Alstein mserv@rusmv1.rus.uni-stuttgart.de (RUS Mail Server) mserv@rusmv1.rus.uni-stuttgart.de (RUS Mail Server) RUS Mail Server Suba.Peddada@eng.sun.com (Suba Peddada [CONTRACTOR]) Suba.Peddada@eng.sun.com (Suba Peddada [CONTRACTOR]) Suba Peddada ftpmail-adm@info2.rus.uni-stuttgart.de ftpmail-adm@info2.rus.uni-stuttgart.de Paul Manser (0032 memo) Paul Manser (0032 memo) Paul Manser "gregg (g.) woodcock" "gregg (g.) woodcock" Gregg Woodcock Clive Bittlestone Clive Bittlestone Clive Bittlestone Graham.Barr@tiuk.ti.com Graham.Barr@tiuk.ti.com Graham Barr "Graham Bisset, UK Net Support, +44 224 728109" "Graham Bisset, UK Net Support, +44 224 728109" Graham Bisset a909937 (Graham Barr (0004 bodg)) a909937 (Graham Barr (0004 bodg)) Graham Barr a909062@node_cb83.node_cb83 (Colin x Maytum (0013 bro5)) a909062@node_cb83.node_cb83 (Colin x Maytum (0013 bro5)) Colin x Maytum a909062@node_cb83.node_cb83 (Colin Maytum (0013 bro5)) a909062@node_cb83.node_cb83 (Colin Maytum (0013 bro5)) Colin Maytum Derek.Roskell%dero@msg.ti.com Derek.Roskell%dero@msg.ti.com Derek Roskell ":sysmail"@ Some-Group. Some-Org, Muhammed.(I am the greatest) Ali @(the)Vegas.WBA ":sysmail"@Some-Group.Some-Org david d `zoo' zuhn david d `zoo' zuhn David D `Zoo' Zuhn "Christopher S. Arthur" "Christopher S. Arthur" Christopher S. Arthur Jeffrey A Law Jeffrey A Law Jeffrey A Law lidl@uunet.uu.net (Kurt J. Lidl) lidl@uunet.uu.net (Kurt J. Lidl) Kurt J. Lidl Kresten_Thorup@NeXT.COM (Kresten Krab Thorup) Kresten_Thorup@NeXT.COM (Kresten Krab Thorup) Kresten Krab Thorup hjl@nynexst.com (H.J. Lu) hjl@nynexst.com (H.J. Lu) H.J. Lu @oleane.net:hugues@afp.com a!b@c.d foo!bar!foobar!root @oleane.net:hugues@afp.com Oleane Net:Hugues (foo@bar.com (foobar), ned@foo.com (nedfoo) ) kevin@goess.org (foo@bar.com (foobar), ned@foo.com (nedfoo) ) eBay's Half eBay's Half eBay's Half