diff options
-rw-r--r-- | Artistic | 131 | ||||
-rw-r--r-- | Changes | 64 | ||||
-rw-r--r-- | Copying | 251 | ||||
-rw-r--r-- | LICENCE | 23 | ||||
-rw-r--r-- | MANIFEST | 3 | ||||
-rw-r--r-- | Makefile.PL | 26 | ||||
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | lib/Net/Cmd.pm | 48 | ||||
-rw-r--r-- | lib/Net/Config.pm | 26 | ||||
-rw-r--r-- | lib/Net/Domain.pm | 12 | ||||
-rw-r--r-- | lib/Net/FTP.pm | 79 | ||||
-rw-r--r-- | lib/Net/FTP/A.pm | 2 | ||||
-rw-r--r-- | lib/Net/FTP/E.pm | 2 | ||||
-rw-r--r-- | lib/Net/FTP/I.pm | 2 | ||||
-rw-r--r-- | lib/Net/FTP/L.pm | 2 | ||||
-rw-r--r-- | lib/Net/FTP/dataconn.pm | 2 | ||||
-rw-r--r-- | lib/Net/NNTP.pm | 55 | ||||
-rw-r--r-- | lib/Net/Netrc.pm | 12 | ||||
-rw-r--r-- | lib/Net/POP3.pm | 47 | ||||
-rw-r--r-- | lib/Net/SMTP.pm | 79 | ||||
-rw-r--r-- | lib/Net/Time.pm | 12 | ||||
-rw-r--r-- | t/changes.t | 6 | ||||
-rw-r--r-- | t/config.t | 4 | ||||
-rw-r--r-- | t/critic.t | 6 | ||||
-rw-r--r-- | t/datasend.t | 13 | ||||
-rw-r--r-- | t/external/ftp-ssl.t | 2 | ||||
-rw-r--r-- | t/ftp.t | 4 | ||||
-rw-r--r-- | t/hostname.t | 4 | ||||
-rw-r--r-- | t/netrc.t | 4 | ||||
-rw-r--r-- | t/nntp.t | 4 | ||||
-rw-r--r-- | t/nntp_ipv6.t | 6 | ||||
-rw-r--r-- | t/nntp_ssl.t | 8 | ||||
-rw-r--r-- | t/pod.t | 6 | ||||
-rw-r--r-- | t/pod_coverage.t | 10 | ||||
-rw-r--r-- | t/pop3_ipv6.t | 8 | ||||
-rw-r--r-- | t/pop3_ssl.t | 12 | ||||
-rw-r--r-- | t/require.t | 4 | ||||
-rw-r--r-- | t/smtp.t | 4 | ||||
-rw-r--r-- | t/smtp_ipv6.t | 8 | ||||
-rw-r--r-- | t/smtp_ssl.t | 12 | ||||
-rw-r--r-- | t/time.t | 4 |
41 files changed, 807 insertions, 206 deletions
diff --git a/Artistic b/Artistic new file mode 100644 index 0000000..d1b6e5a --- /dev/null +++ b/Artistic @@ -0,0 +1,131 @@ + + + + + The "Artistic License" + + Preamble + +The intent of this document is to state the conditions under which a +Package may be copied, such that the Copyright Holder maintains some +semblance of artistic control over the development of the package, +while giving the users of the package the right to use and distribute +the Package in a more-or-less customary fashion, plus the right to make +reasonable modifications. + +Definitions: + + "Package" refers to the collection of files distributed by the + Copyright Holder, and derivatives of that collection of files + created through textual modification. + + "Standard Version" refers to such a Package if it has not been + modified, or has been modified in accordance with the wishes + of the Copyright Holder as specified below. + + "Copyright Holder" is whoever is named in the copyright or + copyrights for the package. + + "You" is you, if you're thinking about copying or distributing + this Package. + + "Reasonable copying fee" is whatever you can justify on the + basis of media cost, duplication charges, time of people involved, + and so on. (You will not be required to justify it to the + Copyright Holder, but only to the computing community at large + as a market that must bear the fee.) + + "Freely Available" means that no fee is charged for the item + itself, though there may be fees involved in handling the item. + It also means that recipients of the item may redistribute it + under the same conditions they received it. + +1. You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that you +duplicate all of the original copyright notices and associated disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications +derived from the Public Domain or from the Copyright Holder. A Package +modified in such a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided +that you insert a prominent notice in each changed file stating how and +when you changed that file, and provided that you do at least ONE of the +following: + + a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or + an equivalent medium, or placing the modifications on a major archive + site such as uunet.uu.net, or by allowing the Copyright Holder to include + your modifications in the Standard Version of the Package. + + b) use the modified Package only within your corporation or organization. + + c) rename any non-standard executables so the names do not conflict + with standard executables, which must also be provided, and provide + a separate manual page for each non-standard executable that clearly + documents how it differs from the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or +executable form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where + to get the Standard Version. + + b) accompany the distribution with the machine-readable source of + the Package with your modifications. + + c) give non-standard executables non-standard names, and clearly + document the differences in manual pages (or equivalent), together + with instructions on where to get the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this +Package. You may charge any fee you choose for support of this +Package. You may not charge a fee for this Package itself. However, +you may distribute this Package in aggregate with other (possibly +commercial) programs as part of a larger (possibly commercial) software +distribution provided that you do not advertise this Package as a +product of your own. You may embed this Package's interpreter within +an executable of yours (by linking); this shall be construed as a mere +form of aggregation, provided that the complete Standard Version of the +interpreter is so embedded. + +6. The scripts and library files supplied as input to or produced as +output from the programs of this Package do not automatically fall +under the copyright of this Package, but belong to whoever generated +them, and may be sold commercially, and may be aggregated with this +Package. If such scripts or library files are aggregated with this +Package via the so-called "undump" or "unexec" methods of producing a +binary executable image, then distribution of such an image shall +neither be construed as a distribution of this Package nor shall it +fall under the restrictions of Paragraphs 3 and 4, provided that you do +not represent such an executable image as a Standard Version of this +Package. + +7. C subroutines (or comparably compiled subroutines in other +languages) supplied by you and linked into this Package in order to +emulate subroutines and variables of the language defined by this +Package shall not be considered part of this Package, but are the +equivalent of input as in Paragraph 6, provided these subroutines do +not change the language in any way that would cause it to fail the +regression tests for the language. + +8. Aggregation of this Package with a commercial distribution is always +permitted provided that the use of this Package is embedded; that is, +when no overt attempt is made to make this Package's interfaces visible +to the end user of the commercial distribution. Such use shall not be +construed as a distribution of this Package. + +9. The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. + +10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + The End @@ -1,5 +1,69 @@ Revision history for Perl distribution libnet +3.07 Development + + - Net::FTP, Net::NNTP, Net::POP3 and Net::SMTP can now restrict domain to + IPv4 even if IPv6 is available by using the new Domain or Family argument. + + Net::NNTP now supports the LocalPort argument in addition to LocalAddr. + + Net::POP3 now supports the LocalAddr and LocalPort arguments in addition + to ResvPort (which is retained for backwards compatibility). + + [Steffen Ullrich, PR#18] + + - Fixed a bug in Net::Cmd::datasend() which caused octets in [\x80-\xFF] + stored in a "binary string" to be replaced with their UTF-8 encodings if + the string happened to be stored internally in an "upgraded" state (i.e. + with the UTF-8 flag on). (As noted below, strings passed to datasend() + should always be encoded first, and therefore not stored in such a state + anyway, but it is all too easy for perl to change this internal state + unless the encodeing is done at the very last minute before calling + datasend(), so it helps if datasend() plays more nicely in this case. In + particular, it was wrong of datasend() to treat upgraded and downgraded + strings differently when their contents were identical at the Perl level.) + + This bugfix results in a breaking change to the case of a "text string" + with characters in U+0080..U+00FF stored internally in an upgraded state + since those characters are likewise no longer encoded to UTF-8 by + datasend(), but callers of datasend() should not have been relying on this + behaviour anyway: In general, datasend() has no idea what encoding is + required for output so callers should always encode the data to be output + to whatever encoding is required first. This has now been clarified in + the documentation. + + Finally, a text string with characters >= U+0100 will now cause a "Wide + character in print" warning from datasend() since such characters cannot + be output as bytes and datasend() no longer encodes to UTF-8. In this + case, UTF-8 bytes will still be output as before since that happens to be + the internal representation of such characters, but the warning is new. + Callers should heed this warning and encode such strings to whatever + encoding is required before calling datasend(), as noted above. + + [Ricardo Signes, CPAN RT#104433] + +3.06 2015-04-01 + + - Fixed INSTALLDIRS to account for the @INC reordering change in Perl 5.12. + See Perl RT#116479 for details. (libnet entered the perl core in Perl + 5.7.3 so that's what the lower bound of the check should strictly be, but + since we only support Perl 5.8.1 and higher anyway it suffices to check + for Perl 5.8. The upper bound is correctly Perl 5.11.0 since the @INC + reordering change in question (Perl core commit #b9ba2fadb1) first + appeared in Perl 5.11.0.) [CPAN RT#103238] + + - Fixed Net::FTP authorize() method, which incorrectly interpreted the + return value of the _RESP() method and falsely reported a failure. [Troy + Loveday, CPAN RT#48532] + + - Added optional SendHello argument to Net::SMTP->new() to allow preventing + the EHLO/HELO command from being automatically sent by the constructor. + [Danil Onishchenko, PR#13] + +3.05 2015-01-12 + + - Fixed infinite loop in Net::SMTP::auth(). [CPAN RT#100235] + 3.04 2014-11-29 - SNI is now only used for SSL connections if it is supported by @@ -0,0 +1,251 @@ + + GNU GENERAL PUBLIC LICENSE + Version 1, February 1989 + + Copyright (C) 1989 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The license agreements of most software companies try to keep users +at the mercy of those companies. By contrast, our General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. The +General Public License applies to the Free Software Foundation's +software and to any other program whose authors commit to using it. +You can use it for your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Specifically, the General Public License is designed to make +sure that you have the freedom to give away or sell copies of free +software, that you receive source code or can get it if you want it, +that you can change the software or use pieces of it in new free +programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of a such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must tell them their rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any program or other work which +contains a notice placed by the copyright holder saying it may be +distributed under the terms of this General Public License. The +"Program", below, refers to any such program or work, and a "work based +on the Program" means either the Program or any work containing the +Program or a portion of it, either verbatim or with modifications. Each +licensee is addressed as "you". + + 1. You may copy and distribute verbatim copies of the Program's source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this +General Public License and to the absence of any warranty; and give any +other recipients of the Program a copy of this General Public License +along with the Program. You may charge a fee for the physical act of +transferring a copy. + + 2. You may modify your copy or copies of the Program or any portion of +it, and copy and distribute such modifications under the terms of Paragraph +1 above, provided that you also do the following: + + a) cause the modified files to carry prominent notices stating that + you changed the files and the date of any change; and + + b) cause the whole of any work that you distribute or publish, that + in whole or in part contains the Program or any part thereof, either + with or without modifications, to be licensed at no charge to all + third parties under the terms of this General Public License (except + that you may choose to grant warranty protection to some or all + third parties, at your option). + + c) If the modified program normally reads commands interactively when + run, you must cause it, when started running for such interactive use + in the simplest and most usual way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this General + Public License. + + d) You may charge a fee for the physical act of transferring a + copy, and you may at your option offer warranty protection in + exchange for a fee. + +Mere aggregation of another independent work with the Program (or its +derivative) on a volume of a storage or distribution medium does not bring +the other work under the scope of these terms. + + 3. You may copy and distribute the Program (or a portion or derivative of +it, under Paragraph 2) in object code or executable form under the terms of +Paragraphs 1 and 2 above provided that you also do one of the following: + + a) accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of + Paragraphs 1 and 2 above; or, + + b) accompany it with a written offer, valid for at least three + years, to give any third party free (except for a nominal charge + for the cost of distribution) a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of + Paragraphs 1 and 2 above; or, + + c) accompany it with the information you received as to where the + corresponding source code may be obtained. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form alone.) + +Source code for a work means the preferred form of the work for making +modifications to it. For an executable file, complete source code means +all the source code for all modules it contains; but, as a special +exception, it need not include source code for modules which are standard +libraries that accompany the operating system on which the executable +file runs, or for standard header files or definitions files that +accompany that operating system. + + 4. You may not copy, modify, sublicense, distribute or transfer the +Program except as expressly provided under this General Public License. +Any attempt otherwise to copy, modify, sublicense, distribute or transfer +the Program is void, and will automatically terminate your rights to use +the Program under this License. However, parties who have received +copies, or rights to use copies, from you under this General Public +License will not have their licenses terminated so long as such parties +remain in full compliance. + + 5. By copying, distributing or modifying the Program (or any work based +on the Program) you indicate your acceptance of this license to do so, +and all its terms and conditions. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the original +licensor to copy, distribute or modify the Program subject to these +terms and conditions. You may not impose any further restrictions on the +recipients' exercise of the rights granted herein. + + 7. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of the license which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +the license, you may choose any version ever published by the Free Software +Foundation. + + 8. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to humanity, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + + To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19xx name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, the +commands you use may be called something other than `show w' and `show +c'; they could even be mouse-clicks or menu items--whatever suits your +program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (a program to direct compilers to make passes + at assemblers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +That's all there is to it! @@ -0,0 +1,23 @@ +This distribution is free software; you can redistribute it and/or modify it +under the terms of either: + +a) the GNU General Public License as published by the Free Software Foundation; + either version 1, or (at your option) any later version; or + +b) the "Artistic License" which comes with this distribution. + +This distribution is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the +Artistic License for more details. + +You should have received a copy of the GNU General Public License along with +this distribution in the file named "Copying". If not, write to the Free +Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA or visit their web page on the internet at +http://www.gnu.org/copyleft/gpl.html or the Perl web page at +http://dev.perl.org/licenses/gpl1.html. + +You should also have received a copy of the Artistic License with this +distribution, in the file named "Artistic". If not, visit the Perl web page on +the internet at http://dev.perl.org/licenses/artistic.html. @@ -1,5 +1,8 @@ +Artistic Changes Configure +Copying +LICENCE MANIFEST MANIFEST.SKIP Makefile.PL diff --git a/Makefile.PL b/Makefile.PL index 59ff9e3..872eac8 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -7,11 +7,13 @@ # Makefile creation script. # # COPYRIGHT -# Copyright (C) 2014 Steve Hay. All rights reserved. +# Copyright (C) 2014, 2015 Steve Hay. All rights reserved. # # LICENCE -# You may distribute under the terms of either the GNU General Public License -# or the Artistic License, as specified in the LICENCE file. +# This script is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU +# General Public License or the Artistic License, as specified in the LICENCE +# file. # #=============================================================================== @@ -64,7 +66,7 @@ MAIN: { ABSTRACT => 'Collection of network protocol modules', AUTHOR => 'Graham Barr <gbarr@pobox.com>, Steve Hay <shay@cpan.org>', LICENSE => 'perl_5', - VERSION => '3.04', + VERSION => '3.07', META_MERGE => { 'meta-spec' => { @@ -125,6 +127,17 @@ MAIN: { } }, + changestest => { + description => 'Changes testing', + prereqs => { + test => { + requires => { + 'Test::CPAN::Changes' => '0' + } + } + } + }, + critictest => { description => 'Perl::Critic testing', prereqs => { @@ -165,7 +178,7 @@ MAIN: { CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => '6.64', 'Getopt::Std' => '0', - 'IO:File' => '0', + 'IO::File' => '0', 'perl' => '5.008001', 'strict' => '0', 'vars' => '0', @@ -193,10 +206,11 @@ MAIN: { 'Time::Local' => '0', 'constant' => '0', 'strict' => '0', + 'utf8' => '0', 'vars' => '0' }, - INSTALLDIRS => 'perl', + INSTALLDIRS => ($] >= 5.008 && $] < 5.011) ? 'perl' : 'site', realclean => { FILES => $CfgFile @@ -108,7 +108,9 @@ COPYRIGHT Changes in Version 1.22_02 onwards Copyright (C) 2013-2014 Steve Hay. All rights reserved. -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. +This distribution is free software; you can redistribute it and/or modify it +under the same terms as Perl itself, i.e. under the terms of either the GNU +General Public License or the Artistic License, as specified in the LICENCE +file. Share and Enjoy! diff --git a/lib/Net/Cmd.pm b/lib/Net/Cmd.pm index 03b27a2..3bf5ec6 100644 --- a/lib/Net/Cmd.pm +++ b/lib/Net/Cmd.pm @@ -2,10 +2,11 @@ # # Versions up to 2.29_1 Copyright (c) 1995-2006 Graham Barr <gbarr@pobox.com>. # All rights reserved. -# Changes in Version 2.29_2 onwards Copyright (C) 2013-2014 Steve Hay. All +# Changes in Version 2.29_2 onwards Copyright (C) 2013-2015 Steve Hay. All # rights reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. package Net::Cmd; @@ -26,22 +27,7 @@ BEGIN { } } -BEGIN { - if (!eval { require utf8 }) { - *is_utf8 = sub { 0 }; - } - elsif (eval { utf8::is_utf8(undef); 1 }) { - *is_utf8 = \&utf8::is_utf8; - } - elsif (eval { require Encode; Encode::is_utf8(undef); 1 }) { - *is_utf8 = \&Encode::is_utf8; - } - else { - *is_utf8 = sub { $_[0] =~ /[^\x00-\xff]/ }; - } -} - -our $VERSION = "3.04"; +our $VERSION = "3.07"; our @ISA = qw(Exporter); our @EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING); @@ -428,9 +414,17 @@ sub datasend { my $arr = @_ == 1 && ref($_[0]) ? $_[0] : \@_; my $line = join("", @$arr); - # encode to individual utf8 bytes if - # $line is a string (in internal UTF-8) - utf8::encode($line) if is_utf8($line); + # Perls < 5.10.1 (with the exception of 5.8.9) have a performance problem with + # the substitutions below when dealing with strings stored internally in + # UTF-8, so downgrade them (if possible). + # Data passed to datasend() should be encoded to octets upstream already so + # shouldn't even have the UTF-8 flag on to start with, but if it so happens + # that the octets are stored in an upgraded string (as can sometimes occur) + # then they would still downgrade without fail anyway. + # Only Unicode codepoints > 0xFF stored in an upgraded string will fail to + # downgrade. We fail silently in that case, and a "Wide character in print" + # warning will be emitted later by syswrite(). + utf8::downgrade($line, 1) if $] < 5.010001 && $] != 5.008009; return 0 if $cmd->_is_closed; @@ -721,6 +715,8 @@ is pending then C<CMD_PENDING> is returned. Send data to the remote server, converting LF to CRLF. Any line starting with a '.' will be prefixed with another '.'. C<DATA> may be an array or a reference to an array. +The C<DATA> passed in must be encoded by the caller to octets of whatever +encoding is required, e.g. by using the Encode module's C<encode()> function. =item dataend () @@ -793,6 +789,9 @@ Unget a line of text from the server. Send data to the remote server without performing any conversions. C<DATA> is a scalar. +As with C<datasend()>, the C<DATA> passed in must be encoded by the caller +to octets of whatever encoding is required, e.g. by using the Encode module's +C<encode()> function. =item read_until_dot () @@ -870,7 +869,8 @@ Versions up to 2.29_1 Copyright (c) 1995-2006 Graham Barr. All rights reserved. Changes in Version 2.29_2 onwards Copyright (C) 2013-2014 Steve Hay. All rights reserved. -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. =cut diff --git a/lib/Net/Config.pm b/lib/Net/Config.pm index e23a448..fe8ce8a 100644 --- a/lib/Net/Config.pm +++ b/lib/Net/Config.pm @@ -4,8 +4,9 @@ # All rights reserved. # Changes in Version 1.11_01 onwards Copyright (C) 2013-2014 Steve Hay. All # rights reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. package Net::Config; @@ -19,7 +20,7 @@ use Socket qw(inet_aton inet_ntoa); our @EXPORT = qw(%NetConfig); our @ISA = qw(Net::LocalCfg Exporter); -our $VERSION = "3.04"; +our $VERSION = "3.07"; our($CONFIGURE, $LIBNET_CFG); @@ -133,7 +134,7 @@ __END__ Net::Config - Local configuration data for libnet -=head1 SYNOPSYS +=head1 SYNOPSIS use Net::Config qw(%NetConfig); @@ -319,4 +320,21 @@ If true then C<Configure> will check each hostname given that it exists =back +=head1 AUTHOR + +Graham Barr E<lt>F<gbarr@pobox.com>E<gt> + +Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version +1.22_02 + +=head1 COPYRIGHT + +Versions up to 1.11 Copyright (c) 1998-2011 Graham Barr. All rights reserved. +Changes in Version 1.11_01 onwards Copyright (C) 2013-2014 Steve Hay. All +rights reserved. + +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. + =cut diff --git a/lib/Net/Domain.pm b/lib/Net/Domain.pm index 41d49c3..3109f43 100644 --- a/lib/Net/Domain.pm +++ b/lib/Net/Domain.pm @@ -4,8 +4,9 @@ # All rights reserved. # Changes in Version 2.22 onwards Copyright (C) 2013-2014 Steve Hay. All rights # reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. package Net::Domain; @@ -20,7 +21,7 @@ use Net::Config; our @ISA = qw(Exporter); our @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname); -our $VERSION = "3.04"; +our $VERSION = "3.07"; my ($host, $domain, $fqdn) = (undef, undef, undef); @@ -356,7 +357,8 @@ Versions up to 2.21 Copyright (c) 1995-1998 Graham Barr. All rights reserved. Changes in Version 2.22 onwards Copyright (C) 2013-2014 Steve Hay. All rights reserved. -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. =cut diff --git a/lib/Net/FTP.pm b/lib/Net/FTP.pm index f34636b..7700bb3 100644 --- a/lib/Net/FTP.pm +++ b/lib/Net/FTP.pm @@ -2,10 +2,11 @@ # # Versions up to 2.77_2 Copyright (c) 1995-2004 Graham Barr <gbarr@pobox.com>. # All rights reserved. -# Changes in Version 2.77_3 onwards Copyright (C) 2013-2014 Steve Hay. All +# Changes in Version 2.77_3 onwards Copyright (C) 2013-2015 Steve Hay. All # rights reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. # # Documentation (at end) improved 1996 by Nathan Torkington <gnat@frii.com>. @@ -24,9 +25,10 @@ use Net::Config; use Socket; use Time::Local; -our $VERSION = '3.04'; +our $VERSION = '3.07'; our $IOCLASS; +my $family_key; BEGIN { # Code for detecting if we can use SSL my $ssl_class = eval { @@ -54,6 +56,10 @@ BEGIN { sub can_inet6 { $inet6_class }; $IOCLASS = $ssl_class || $inet6_class || 'IO::Socket::INET'; + $family_key = + ( $ssl_class ? $ssl_class->can_ipv6 : $inet6_class || '' ) + eq 'IO::Socket::IP' + ? 'Family' : 'Domain'; } our @ISA = ('Exporter','Net::Cmd',$IOCLASS); @@ -119,6 +125,7 @@ sub new { PeerAddr => $peer, PeerPort => $arg{Port} || ($arg{SSL} ? 'ftps(990)' : 'ftp(21)'), LocalAddr => $arg{'LocalAddr'}, + $family_key => $arg{Domain} || $arg{Family}, Proto => 'tcp', Timeout => defined $arg{Timeout} ? $arg{Timeout} : 120, %tlsargs, @@ -130,6 +137,7 @@ sub new { ${*$ftp}{'net_ftp_blksize'} = abs($arg{'BlockSize'} || 10240); ${*$ftp}{'net_ftp_localaddr'} = $arg{'LocalAddr'}; + ${*$ftp}{'net_ftp_domain'} = $arg{Domain} || $arg{Family}; ${*$ftp}{'net_ftp_firewall'} = $fire if (defined $fire); @@ -452,7 +460,7 @@ sub authorize { my $ok = $ftp->_AUTH($auth || ""); - $ok = $ftp->_RESP($resp || "") + return $ftp->_RESP($resp || "") if ($ok == CMD_MORE); $ok == CMD_OK; @@ -892,9 +900,10 @@ sub _eprt { Listen => 1, Timeout => $ftp->timeout, LocalAddr => $ftp->sockhost, + $family_key => $ftp->sockdomain, can_ssl() ? ( - %{ ${*$ftp}{net_ftp_tlsargs} }, - SSL_startHandshake => 0, + %{ ${*$ftp}{net_ftp_tlsargs} }, + SSL_startHandshake => 0, ):(), ); ${*$ftp}{net_ftp_intern_port} = 1; @@ -1038,17 +1047,18 @@ sub _dataconn { PeerAddr => $pasv->[0], PeerPort => $pasv->[1], LocalAddr => ${*$ftp}{net_ftp_localaddr}, + $family_key => ${*$ftp}{net_ftp_domain}, Timeout => $ftp->timeout, can_ssl() ? ( - SSL_startHandshake => 0, - $ftp->is_SSL ? ( - SSL_reuse_ctx => $ftp, - SSL_verifycn_name => ${*$ftp}{net_ftp_tlsargs}{SSL_verifycn_name}, - # This will cause the use of SNI if supported by IO::Socket::SSL. - $ftp->can_client_sni ? ( - SSL_hostname => ${*$ftp}{net_ftp_tlsargs}{SSL_hostname} - ):(), - ) :( %{${*$ftp}{net_ftp_tlsargs}} ), + SSL_startHandshake => 0, + $ftp->is_SSL ? ( + SSL_reuse_ctx => $ftp, + SSL_verifycn_name => ${*$ftp}{net_ftp_tlsargs}{SSL_verifycn_name}, + # This will cause the use of SNI if supported by IO::Socket::SSL. + $ftp->can_client_sni ? ( + SSL_hostname => ${*$ftp}{net_ftp_tlsargs}{SSL_hostname} + ):(), + ) :( %{${*$ftp}{net_ftp_tlsargs}} ), ):(), ) or return; } elsif (my $listen = delete ${*$ftp}{net_ftp_listen}) { @@ -1145,7 +1155,7 @@ sub _data_cmd { my $data = $ftp->_dataconn(); if (CMD_INFO == $ftp->response()) { $data->reading - if $data && $cmd =~ /RETR|LIST|NLST|MLSD/; + if $data && $cmd =~ /RETR|LIST|NLST|MLSD/; return $data; } $data->_close if $data; @@ -1438,10 +1448,15 @@ Net::FTP - FTP Client class =head1 DESCRIPTION C<Net::FTP> is a class implementing a simple FTP client in Perl as -described in RFC959. It provides wrappers for a subset of the RFC959 -commands. +described in RFC959. It provides wrappers for the commonly used subset of the +RFC959 commands. +If L<IO::Socket::IP> or L<IO::Socket::INET6> is installed it also provides +support for IPv6 as defined in RFC2428. +And with L<IO::Socket::SSL> installed it provides support for implicit FTPS +and explicit FTPS as defined in RFC4217. -The Net::FTP class is a subclass of Net::Cmd and IO::Socket::INET. +The Net::FTP class is a subclass of Net::Cmd and (depending on avaibility) of +IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET. =head1 OVERVIEW @@ -1542,8 +1557,15 @@ simply invokes the C<hash()> method for you, so that hash marks are displayed for all transfers. You can, of course, call C<hash()> explicitly whenever you'd like. -B<LocalAddr> - Local address to use for all socket connections, this -argument will be passed to L<IO::Socket::INET> +B<LocalAddr> - Local address to use for all socket connections. This +argument will be passed to the super class, i.e. L<IO::Socket::INET> +or L<IO::Socket::IP>. + +B<Domain> - Domain to use, i.e. AF_INET or AF_INET6. This +argument will be passed to the IO::Socket super class. +This can be used to enforce IPv4 even with L<IO::Socket::IP> +which would default to IPv6. +B<Family> is accepted as alternative name for B<Domain>. If the constructor fails undef will be returned and an error message will be in $@ @@ -1595,8 +1617,8 @@ Only C<LEVEL>s "C" (clear) and "P" (private) are supported. =item host () -Returns the value used by the constructor, and passed to IO::Socket::INET, -to connect to the host. +Returns the value used by the constructor, and passed to the IO::Socket super +class to connect to the host. =item account( ACCT ) @@ -1843,6 +1865,7 @@ C<put_unique> and those that do not require data connections. =over 4 =item port ( [ PORT ] ) + =item eprt ( [ PORT ] ) Send a C<PORT> (IPv4) or C<EPRT> (IPv6) command to the server. If C<PORT> is @@ -1850,6 +1873,7 @@ specified then it is sent to the server. If not, then a listen socket is created and the correct information sent to the server. =item pasv () + =item epsv () Tell the server to go into passive mode (C<pasv> for IPv4, C<epsv> for IPv6). @@ -2015,10 +2039,11 @@ Roderick Schertler <roderick@gate.net> - for various inputs =head1 COPYRIGHT Versions up to 2.77_2 Copyright (c) 1995-2004 Graham Barr. All rights reserved. -Changes in Version 2.77_3 onwards Copyright (C) 2013-2014 Steve Hay. All rights +Changes in Version 2.77_3 onwards Copyright (C) 2013-2015 Steve Hay. All rights reserved. -This program is free software; you can redistribute it and/or modify it -under the same terms as Perl itself. +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. =cut diff --git a/lib/Net/FTP/A.pm b/lib/Net/FTP/A.pm index dd51399..f3375c6 100644 --- a/lib/Net/FTP/A.pm +++ b/lib/Net/FTP/A.pm @@ -13,7 +13,7 @@ use Carp; use Net::FTP::dataconn; our @ISA = qw(Net::FTP::dataconn); -our $VERSION = "3.04"; +our $VERSION = "3.07"; our $buf; diff --git a/lib/Net/FTP/E.pm b/lib/Net/FTP/E.pm index 8db2f5b..56075f6 100644 --- a/lib/Net/FTP/E.pm +++ b/lib/Net/FTP/E.pm @@ -8,6 +8,6 @@ use warnings; use Net::FTP::I; our @ISA = qw(Net::FTP::I); -our $VERSION = "3.04"; +our $VERSION = "3.07"; 1; diff --git a/lib/Net/FTP/I.pm b/lib/Net/FTP/I.pm index 7dc5f5b..bb18ff8 100644 --- a/lib/Net/FTP/I.pm +++ b/lib/Net/FTP/I.pm @@ -13,7 +13,7 @@ use Carp; use Net::FTP::dataconn; our @ISA = qw(Net::FTP::dataconn); -our $VERSION = "3.04"; +our $VERSION = "3.07"; our $buf; diff --git a/lib/Net/FTP/L.pm b/lib/Net/FTP/L.pm index 2f6d4e7..d96a39b 100644 --- a/lib/Net/FTP/L.pm +++ b/lib/Net/FTP/L.pm @@ -8,6 +8,6 @@ use warnings; use Net::FTP::I; our @ISA = qw(Net::FTP::I); -our $VERSION = "3.04"; +our $VERSION = "3.07"; 1; diff --git a/lib/Net/FTP/dataconn.pm b/lib/Net/FTP/dataconn.pm index a671d64..81e3a61 100644 --- a/lib/Net/FTP/dataconn.pm +++ b/lib/Net/FTP/dataconn.pm @@ -13,7 +13,7 @@ use Carp; use Errno; use Net::Cmd; -our $VERSION = '3.04'; +our $VERSION = '3.07'; $Net::FTP::IOCLASS or die "please load Net::FTP before Net::FTP::dataconn"; our @ISA = $Net::FTP::IOCLASS; diff --git a/lib/Net/NNTP.pm b/lib/Net/NNTP.pm index ef838d2..7499204 100644 --- a/lib/Net/NNTP.pm +++ b/lib/Net/NNTP.pm @@ -2,10 +2,11 @@ # # Versions up to 2.24_1 Copyright (c) 1995-1997 Graham Barr <gbarr@pobox.com>. # All rights reserved. -# Changes in Version 2.25 onwards Copyright (C) 2013-2014 Steve Hay. All rights +# Changes in Version 2.25 onwards Copyright (C) 2013-2015 Steve Hay. All rights # reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. package Net::NNTP; @@ -20,7 +21,7 @@ use Net::Cmd; use Net::Config; use Time::Local; -our $VERSION = "3.04"; +our $VERSION = "3.07"; # Code for detecting if we can use SSL my $ssl_class = eval { @@ -34,16 +35,19 @@ my $nossl_warn = !$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'; # Code for detecting if we can use IPv6 +my $family_key = 'Domain'; my $inet6_class = eval { require IO::Socket::IP; no warnings 'numeric'; - IO::Socket::IP->VERSION(0.20); + IO::Socket::IP->VERSION(0.20) || die; + $family_key = 'Family'; } && 'IO::Socket::IP' || eval { require IO::Socket::INET6; no warnings 'numeric'; IO::Socket::INET6->VERSION(2.62); } && 'IO::Socket::INET6'; + sub can_ssl { $ssl_class }; sub can_inet6 { $inet6_class }; @@ -80,9 +84,10 @@ sub new { $connect{$_} = $arg{$_} for(grep { m{^SSL_} } keys %arg); } - foreach my $o (qw(LocalAddr Timeout)) { + foreach my $o (qw(LocalAddr LocalPort Timeout)) { $connect{$o} = $arg{$o} if exists $arg{$o}; } + $connect{$family_key} = $arg{Domain} || $arg{Family}; $connect{Timeout} = 120 unless defined $connect{Timeout}; $connect{PeerPort} = $arg{Port} || 'nntp(119)'; foreach my $h (@{$hosts}) { @@ -756,9 +761,9 @@ sub DESTROY { my ($class,$nntp,%arg) = @_; delete @arg{ grep { !m{^SSL_} } keys %arg }; ( $arg{SSL_verifycn_name} ||= $nntp->host ) - =~s{(?<!:):[\w()]+$}{}; # strip port + =~s{(?<!:):[\w()]+$}{}; # strip port $arg{SSL_hostname} = $arg{SSL_verifycn_name} - if ! defined $arg{SSL_hostname} && $class->can_client_sni; + if ! defined $arg{SSL_hostname} && $class->can_client_sni; my $ok = $class->SUPER::start_SSL($nntp, SSL_verifycn_scheme => 'nntp', %arg @@ -798,8 +803,11 @@ Net::NNTP - NNTP Client class C<Net::NNTP> is a class implementing a simple NNTP client in Perl as described in RFC977 and RFC4642. +With L<IO::Socket::SSL> installed it also provides support for implicit and +explicit TLS encryption, i.e. NNTPS or NNTP+STARTTLS. -The Net::NNTP class is a subclass of Net::Cmd and IO::Socket::INET. +The Net::NNTP class is a subclass of Net::Cmd and (depending on avaibility) of +IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET. =head1 CONSTRUCTOR @@ -842,10 +850,12 @@ so that the remote server becomes innd. If the C<Reader> option is given with a value of zero, then this command will not be sent and the connection will be left talking to nnrpd. -B<LocalAddr> - If multiple IP addresses are present on the client host -with a valid route to the destination, you can specify the address your -C<Net::NNTP> connects from and this way override the operating system's -pick. +B<LocalAddr> and B<LocalPort> - These parameters are passed directly +to IO::Socket to allow binding the socket to a specific local address and port. + +B<Domain> - This parameter is passed directly to IO::Socket and makes it +possible to enforce IPv4 connections even if L<IO::Socket::IP> is used as super +class. Alternatively B<Family> can be used. =back @@ -946,15 +956,17 @@ implementation) from the server. Returns the text or undef upon failure. The C<ihave> command informs the server that the client has an article whose id is C<MSGID>. If the server desires a copy of that -article, and C<MESSAGE> has been given the it will be sent. +article and C<MESSAGE> has been given then it will be sent. Returns I<true> if the server desires the article and C<MESSAGE> was -successfully sent,if specified. +successfully sent, if specified. If C<MESSAGE> is not specified then the message must be sent using the C<datasend> and C<dataend> methods from L<Net::Cmd> -C<MESSAGE> can be either an array of lines or a reference to an array. +C<MESSAGE> can be either an array of lines or a reference to an array +and must be encoded by the caller to octets of whatever encoding is required, +e.g. by using the Encode module's C<encode()> function. =item last () @@ -1027,7 +1039,9 @@ is allowed then the message will be sent. If C<MESSAGE> is not specified then the message must be sent using the C<datasend> and C<dataend> methods from L<Net::Cmd> -C<MESSAGE> can be either an array of lines or a reference to an array. +C<MESSAGE> can be either an array of lines or a reference to an array +and must be encoded by the caller to octets of whatever encoding is required, +e.g. by using the Encode module's C<encode()> function. The message, either sent via C<datasend> or as the C<MESSAGE> parameter, must be in the format as described by RFC822 and must @@ -1278,10 +1292,11 @@ Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version =head1 COPYRIGHT Versions up to 2.24_1 Copyright (c) 1995-1997 Graham Barr. All rights reserved. -Changes in Version 2.25 onwards Copyright (C) 2013-2014 Steve Hay. All rights +Changes in Version 2.25 onwards Copyright (C) 2013-2015 Steve Hay. All rights reserved. -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. =cut diff --git a/lib/Net/Netrc.pm b/lib/Net/Netrc.pm index 1143cd7..4b721be 100644 --- a/lib/Net/Netrc.pm +++ b/lib/Net/Netrc.pm @@ -4,8 +4,9 @@ # All rights reserved. # Changes in Version 2.13_01 onwards Copyright (C) 2013-2014 Steve Hay. All # rights reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. package Net::Netrc; @@ -17,7 +18,7 @@ use warnings; use Carp; use FileHandle; -our $VERSION = "3.04"; +our $VERSION = "3.07"; our $TESTING; @@ -339,7 +340,8 @@ Versions up to 2.13 Copyright (c) 1995-1998 Graham Barr. All rights reserved. Changes in Version 2.13_01 onwards Copyright (C) 2013-2014 Steve Hay. All rights reserved. -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. =cut diff --git a/lib/Net/POP3.pm b/lib/Net/POP3.pm index 0c71e71..791b1d2 100644 --- a/lib/Net/POP3.pm +++ b/lib/Net/POP3.pm @@ -2,10 +2,11 @@ # # Versions up to 2.29 Copyright (c) 1995-2004 Graham Barr <gbarr@pobox.com>. # All rights reserved. -# Changes in Version 2.29_01 onwards Copyright (C) 2013-2014 Steve Hay. All +# Changes in Version 2.29_01 onwards Copyright (C) 2013-2015 Steve Hay. All # rights reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. package Net::POP3; @@ -19,7 +20,7 @@ use IO::Socket; use Net::Cmd; use Net::Config; -our $VERSION = "3.04"; +our $VERSION = "3.07"; # Code for detecting if we can use SSL my $ssl_class = eval { @@ -33,16 +34,19 @@ my $nossl_warn = !$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'; # Code for detecting if we can use IPv6 +my $family_key = 'Domain'; my $inet6_class = eval { require IO::Socket::IP; no warnings 'numeric'; - IO::Socket::IP->VERSION(0.20); + IO::Socket::IP->VERSION(0.20) || die; + $family_key = 'Family'; } && 'IO::Socket::IP' || eval { require IO::Socket::INET6; no warnings 'numeric'; IO::Socket::INET6->VERSION(2.62); } && 'IO::Socket::INET6'; + sub can_ssl { $ssl_class }; sub can_inet6 { $inet6_class }; @@ -62,7 +66,6 @@ sub new { } my $hosts = defined $host ? [$host] : $NetConfig{pop3_hosts}; my $obj; - my @localport = exists $arg{ResvPort} ? (LocalPort => $arg{ResvPort}) : (); if ($arg{SSL}) { # SSL from start @@ -77,7 +80,9 @@ sub new { PeerAddr => ($host = $h), PeerPort => $arg{Port} || 'pop3(110)', Proto => 'tcp', - @localport, + $family_key => $arg{Domain} || $arg{Family}, + LocalAddr => $arg{LocalAddr}, + LocalPort => exists($arg{ResvPort}) ? $arg{ResvPort} : $arg{LocalPort}, Timeout => $arg{Timeout}, ) and last; @@ -577,9 +582,9 @@ sub banner { my ($class,$pop3,%arg) = @_; delete @arg{ grep { !m{^SSL_} } keys %arg }; ( $arg{SSL_verifycn_name} ||= $pop3->host ) - =~s{(?<!:):[\w()]+$}{}; # strip port + =~s{(?<!:):[\w()]+$}{}; # strip port $arg{SSL_hostname} = $arg{SSL_verifycn_name} - if ! defined $arg{SSL_hostname} && $class->can_client_sni; + if ! defined $arg{SSL_hostname} && $class->can_client_sni; $arg{SSL_verifycn_scheme} ||= 'pop3'; my $ok = $class->SUPER::start_SSL($pop3,%arg); $@ = $ssl_class->errstr if !$ok; @@ -622,12 +627,16 @@ Net::POP3 - Post Office Protocol 3 Client class (RFC1939) This module implements a client interface to the POP3 protocol, enabling a perl5 application to talk to POP3 servers. This documentation assumes that you are familiar with the POP3 protocol described in RFC1939. +With L<IO::Socket::SSL> installed it also provides support for implicit and +explicit TLS encryption, i.e. POP3S or POP3+STARTTLS. A new Net::POP3 object must be created with the I<new> method. Once this has been done, all POP3 commands are accessed via method calls on the object. -The Net::POP3 class is a subclass of Net::Cmd and IO::Socket::INET. +The Net::POP3 class is a subclass of Net::Cmd and (depending on avaibility) of +IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET. + =head1 CONSTRUCTOR @@ -658,9 +667,14 @@ upgrade with C<starttls>. You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will usually use the right arguments already. -B<ResvPort> - If given then the socket for the C<Net::POP3> object -will be bound to the local port given using C<bind> when the socket is -created. +B<LocalAddr> and B<LocalPort> - These parameters are passed directly +to IO::Socket to allow binding the socket to a specific local address and port. +For compatibility with older versions B<ResvPort> can be used instead of +B<LocalPort>. + +B<Domain> - This parameter is passed directly to IO::Socket and makes it +possible to enforce IPv4 connections even if L<IO::Socket::IP> is used as super +class. Alternatively B<Family> can be used. B<Timeout> - Maximum time, in seconds, to wait for a response from the POP3 server (default: 120) @@ -839,10 +853,11 @@ Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version =head1 COPYRIGHT Versions up to 2.29 Copyright (c) 1995-2004 Graham Barr. All rights reserved. -Changes in Version 2.29_01 onwards Copyright (C) 2013-2014 Steve Hay. All +Changes in Version 2.29_01 onwards Copyright (C) 2013-2015 Steve Hay. All rights reserved. -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. =cut diff --git a/lib/Net/SMTP.pm b/lib/Net/SMTP.pm index 3036b2a..7a703d9 100644 --- a/lib/Net/SMTP.pm +++ b/lib/Net/SMTP.pm @@ -2,10 +2,11 @@ # # Versions up to 2.31_1 Copyright (c) 1995-2004 Graham Barr <gbarr@pobox.com>. # All rights reserved. -# Changes in Version 2.31_2 onwards Copyright (C) 2013-2014 Steve Hay. All +# Changes in Version 2.31_2 onwards Copyright (C) 2013-2015 Steve Hay. All # rights reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. package Net::SMTP; @@ -20,7 +21,7 @@ use Net::Cmd; use Net::Config; use Socket; -our $VERSION = "3.04"; +our $VERSION = "3.07"; # Code for detecting if we can use SSL my $ssl_class = eval { @@ -34,10 +35,12 @@ my $nossl_warn = !$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'; # Code for detecting if we can use IPv6 +my $family_key = 'Domain'; my $inet6_class = eval { require IO::Socket::IP; no warnings 'numeric'; - IO::Socket::IP->VERSION(0.20); + IO::Socket::IP->VERSION(0.20) || die; + $family_key = 'Family'; } && 'IO::Socket::IP' || eval { require IO::Socket::INET6; no warnings 'numeric'; @@ -79,6 +82,7 @@ sub new { PeerPort => $arg{Port} || 'smtp(25)', LocalAddr => $arg{LocalAddr}, LocalPort => $arg{LocalPort}, + $family_key => $arg{Domain} || $arg{Family}, Proto => 'tcp', Timeout => $arg{Timeout} ) @@ -112,11 +116,13 @@ sub new { (${*$obj}{'net_smtp_banner'}) = $obj->message; (${*$obj}{'net_smtp_domain'}) = $obj->message =~ /\A\s*(\S+)/; - unless ($obj->hello($arg{Hello} || "")) { - my $err = ref($obj) . ": " . $obj->code . " " . $obj->message; - $obj->close(); - $@ = $err; - return; + if (!exists $arg{SendHello} || $arg{SendHello}) { + unless ($obj->hello($arg{Hello} || "")) { + my $err = ref($obj) . ": " . $obj->code . " " . $obj->message; + $obj->close(); + $@ = $err; + return; + } } $obj; @@ -193,10 +199,11 @@ sub auth { if ($client) { # $client mechanism failed, so we need to exclude this mechanism from list my $failed_mechanism = $client->mechanism; + return unless defined $failed_mechanism; $self->debug_text("Auth mechanism failed: $failed_mechanism") if $self->debug; $mechanisms =~ s/\b\Q$failed_mechanism\E\b//; - last unless $mechanisms =~ /\S/; + return unless $mechanisms =~ /\S/; $sasl->mechanism($mechanisms); } @@ -614,9 +621,9 @@ sub _STARTTLS { shift->command("STARTTLS")->response() == CMD_OK } my ($class,$smtp,%arg) = @_; delete @arg{ grep { !m{^SSL_} } keys %arg }; ( $arg{SSL_verifycn_name} ||= $smtp->host ) - =~s{(?<!:):[\w()]+$}{}; # strip port + =~s{(?<!:):[\w()]+$}{}; # strip port $arg{SSL_hostname} = $arg{SSL_verifycn_name} - if ! defined $arg{SSL_hostname} && $class->can_client_sni; + if ! defined $arg{SSL_hostname} && $class->can_client_sni; $arg{SSL_verifycn_scheme} ||= 'smtp'; my $ok = $class->SUPER::start_SSL($smtp,%arg); $@ = $ssl_class->errstr if !$ok; @@ -647,12 +654,12 @@ Net::SMTP - Simple Mail Transfer Protocol Client This module implements a client interface to the SMTP and ESMTP protocol, enabling a perl5 application to talk to SMTP servers. This documentation assumes that you are familiar with the concepts of the -SMTP protocol described in RFC821. - -A new Net::SMTP object must be created with the I<new> method. Once -this has been done, all SMTP commands are accessed through this object. +SMTP protocol described in RFC2821. +With L<IO::Socket::SSL> installed it also provides support for implicit and +explicit TLS encryption, i.e. SMTPS or SMTP+STARTTLS. -The Net::SMTP class is a subclass of Net::Cmd and IO::Socket::INET. +The Net::SMTP class is a subclass of Net::Cmd and (depending on avaibility) of +IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET. =head1 EXAMPLES @@ -711,6 +718,10 @@ B<Hello> - SMTP requires that you identify yourself. This option specifies a string to pass as your mail domain. If not given localhost.localdomain will be used. +B<SendHello> - If false then the EHLO (or HELO) command that is normally sent +when constructing the object will not be sent. In that case the command will +have to be sent manually by calling C<hello()> instead. + B<Host> - SMTP host to connect to. It may be a single scalar (hostname[:port]), as defined for the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to an array with hosts to try in turn. The L</host> method will return the value @@ -726,7 +737,11 @@ You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will usually use the right arguments already. B<LocalAddr> and B<LocalPort> - These parameters are passed directly -to IO::Socket to allow binding the socket to a local port. +to IO::Socket to allow binding the socket to a specific local address and port. + +B<Domain> - This parameter is passed directly to IO::Socket and makes it +possible to enforce IPv4 connections even if L<IO::Socket::IP> is used as super +class. Alternatively B<Family> can be used. B<Timeout> - Maximum time, in seconds, to wait for a response from the SMTP server (default: 120) @@ -757,11 +772,11 @@ Example: # the same with direct SSL $smtp = Net::SMTP->new('mailhost', - Hello => 'my.mail.domain', - Timeout => 30, - Debug => 1, - SSL => 1, - ); + Hello => 'my.mail.domain', + Timeout => 30, + Debug => 1, + SSL => 1, + ); # Connect to the default server from Net::config $smtp = Net::SMTP->new( @@ -934,9 +949,12 @@ Synonyms for C<recipient>. Initiate the sending of the data from the current message. -C<DATA> may be a reference to a list or a list. If specified the contents -of C<DATA> and a termination string C<".\r\n"> is sent to the server. And the -result will be true if the data was accepted. +C<DATA> may be a reference to a list or a list and must be encoded by the +caller to octets of whatever encoding is required, e.g. by using the Encode +module's C<encode()> function. + +If specified the contents of C<DATA> and a termination string C<".\r\n"> is +sent to the server. The result will be true if the data was accepted. If C<DATA> is not specified then the result will indicate that the server wishes the data to be sent. The data must then be sent using the C<datasend> @@ -1010,10 +1028,11 @@ Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version =head1 COPYRIGHT Versions up to 2.31_1 Copyright (c) 1995-2004 Graham Barr. All rights reserved. -Changes in Version 2.31_2 onwards Copyright (C) 2013-2014 Steve Hay. All rights +Changes in Version 2.31_2 onwards Copyright (C) 2013-2015 Steve Hay. All rights reserved. -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. =cut diff --git a/lib/Net/Time.pm b/lib/Net/Time.pm index 49365cf..aaddfac 100644 --- a/lib/Net/Time.pm +++ b/lib/Net/Time.pm @@ -4,8 +4,9 @@ # All rights reserved. # Changes in Version 2.11 onwards Copyright (C) 2014 Steve Hay. All rights # reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. +# This module is free software; you can redistribute it and/or modify it under +# the same terms as Perl itself, i.e. under the terms of either the GNU General +# Public License or the Artistic License, as specified in the F<LICENCE> file. package Net::Time; @@ -23,7 +24,7 @@ use Net::Config; our @ISA = qw(Exporter); our @EXPORT_OK = qw(inet_time inet_daytime); -our $VERSION = "3.04"; +our $VERSION = "3.07"; our $TIMEOUT = 120; @@ -156,7 +157,8 @@ Versions up to 2.11 Copyright (c) 1995-2004 Graham Barr. All rights reserved. Changes in Version 2.11 onwards Copyright (C) 2014 Steve Hay. All rights reserved. -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the F<LICENCE> file. =cut diff --git a/t/changes.t b/t/changes.t index 7cb6378..0ddff50 100644 --- a/t/changes.t +++ b/t/changes.t @@ -10,8 +10,10 @@ # Copyright (C) 2014 Steve Hay. All rights reserved.
#
# LICENCE
-# You may distribute under the terms of either the GNU General Public License
-# or the Artistic License, as specified in the LICENCE file.
+# This script is free software; you can redistribute it and/or modify it under
+# the same terms as Perl itself, i.e. under the terms of either the GNU
+# General Public License or the Artistic License, as specified in the LICENCE
+# file.
#
#===============================================================================
@@ -6,12 +6,12 @@ use strict; use warnings; BEGIN { - if (!eval { require Socket; 1 }) { + if (!eval { require Socket }) { print "1..0 # no Socket\n"; exit 0; } undef *{Socket::inet_aton}; undef *{Socket::inet_ntoa}; - if (ord('A') == 193 && !eval { require Convert::EBCDIC; 1 }) { + if (ord('A') == 193 && !eval { require Convert::EBCDIC }) { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } $INC{'Socket.pm'} = 1; @@ -10,8 +10,10 @@ # Copyright (C) 2014 Steve Hay. All rights reserved.
#
# LICENCE
-# You may distribute under the terms of either the GNU General Public License
-# or the Artistic License, as specified in the LICENCE file.
+# This script is free software; you can redistribute it and/or modify it under
+# the same terms as Perl itself, i.e. under the terms of either the GNU
+# General Public License or the Artistic License, as specified in the LICENCE
+# file.
#
#===============================================================================
diff --git a/t/datasend.t b/t/datasend.t index cdbdc29..0aea9d4 100644 --- a/t/datasend.t +++ b/t/datasend.t @@ -6,10 +6,10 @@ use strict; use warnings; BEGIN { - if (!eval { require Socket; 1 }) { + if (!eval { require Socket }) { print "1..0 # no Socket\n"; exit 0; } - if (ord('A') == 193 && !eval { require Convert::EBCDIC; 1 }) { + if (ord('A') == 193 && !eval { require Convert::EBCDIC }) { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } } @@ -44,7 +44,7 @@ BEGIN { (my $libnet_t = __FILE__) =~ s/datasend.t/libnet_t.pl/; require $libnet_t or die; -print "1..51\n"; +print "1..54\n"; sub check { my $expect = pop; @@ -158,3 +158,10 @@ check( "a\015\012..\015\012.\015\012", ); +# Test that datasend() plays nicely with bytes in an upgraded string, +# even though the input should really be encode()d already. +check( + substr("\x{100}", 0, 0) . "\x{e9}", + + "\x{e9}\015\012.\015\012" +); diff --git a/t/external/ftp-ssl.t b/t/external/ftp-ssl.t index 3036630..28c038a 100644 --- a/t/external/ftp-ssl.t +++ b/t/external/ftp-ssl.t @@ -44,7 +44,7 @@ IO::Socket::SSL->start_SSL($sock, %sslargs, ) or do { plan skip_all => "$server:990 not upgradable to SSL: ". - $IO::Socket::SSL::SSL_ERROR; + $IO::Socket::SSL::SSL_ERROR; }; plan tests => 9; @@ -6,10 +6,10 @@ use strict; use warnings; BEGIN { - if (!eval { require Socket; 1 }) { + if (!eval { require Socket }) { print "1..0 # Skip: no Socket module\n"; exit 0; } - if (ord('A') == 193 && !eval { require Convert::EBCDIC; 1 }) { + if (ord('A') == 193 && !eval { require Convert::EBCDIC }) { print "1..0 # Skip: EBCDIC but no Convert::EBCDIC\n"; exit 0; } } diff --git a/t/hostname.t b/t/hostname.t index 25f1cda..55031bf 100644 --- a/t/hostname.t +++ b/t/hostname.t @@ -6,10 +6,10 @@ use strict; use warnings; BEGIN { - if (!eval { require Socket; 1 }) { + if (!eval { require Socket }) { print "1..0 # no Socket\n"; exit 0; } - if (ord('A') == 193 && !eval { require Convert::EBCDIC; 1 }) { + if (ord('A') == 193 && !eval { require Convert::EBCDIC }) { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } } @@ -6,10 +6,10 @@ use strict; use warnings; BEGIN { - if (!eval { require Socket; 1 }) { + if (!eval { require Socket }) { print "1..0 # no Socket\n"; exit 0; } - if (ord('A') == 193 && !eval { require Convert::EBCDIC; 1 }) { + if (ord('A') == 193 && !eval { require Convert::EBCDIC }) { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } } @@ -6,10 +6,10 @@ use strict; use warnings; BEGIN { - if (!eval { require Socket; 1 }) { + if (!eval { require Socket }) { print "1..0 # no Socket\n"; exit 0; } - if (ord('A') == 193 && !eval { require Convert::EBCDIC; 1 }) { + if (ord('A') == 193 && !eval { require Convert::EBCDIC }) { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } } diff --git a/t/nntp_ipv6.t b/t/nntp_ipv6.t index fbb1458..1992618 100644 --- a/t/nntp_ipv6.t +++ b/t/nntp_ipv6.t @@ -28,7 +28,7 @@ my $srv = $inet6class->new( plan skip_all => "cannot create listener on ::1: $!" if ! $srv; my $host = $srv->sockhost; my $port = $srv->sockport; -diag("server on $host port $port"); +note("server on $host port $port"); plan tests => 1; @@ -36,7 +36,7 @@ defined( my $pid = fork()) or die "fork failed: $!"; exit(nntp_server()) if ! $pid; my $cl = Net::NNTP->new(Host => $host, Port => $port,, Debug => $debug); -diag("created Net::NNTP object"); +note("created Net::NNTP object"); if (!$cl) { fail("IPv6 NNTP connect failed"); } else { @@ -62,5 +62,5 @@ sub nntp_server { print "500 unknown cmd\r\n"; } } - diag("NNTP dialog done"); + note("NNTP dialog done"); } diff --git a/t/nntp_ssl.t b/t/nntp_ssl.t index 66789fb..e6a4fe5 100644 --- a/t/nntp_ssl.t +++ b/t/nntp_ssl.t @@ -73,7 +73,7 @@ sub nntp_client { Debug => $debug, %sslopt, ); - diag("created Net::NNTP object"); + note("created Net::NNTP object"); if (!$cl) { fail( ($ssl ? "SSL ":"" )."NNTP connect failed"); } elsif ($ssl) { @@ -115,8 +115,8 @@ sub nntp_server { } elsif ( ! $ssl and $cmd eq 'STARTTLS' ) { print $cl "382 Continue with TLS negotiation\r\n"; if ( ! IO::Socket::SSL->start_SSL($cl, %sslargs)) { - diag("initial ssl handshake with client failed"); - return; + diag("initial ssl handshake with client failed"); + return; } $ssl = 1; } else { @@ -125,5 +125,5 @@ sub nntp_server { } } - diag("NNTP dialog done"); + note("NNTP dialog done"); } @@ -10,8 +10,10 @@ # Copyright (C) 2014 Steve Hay. All rights reserved.
#
# LICENCE
-# You may distribute under the terms of either the GNU General Public License
-# or the Artistic License, as specified in the LICENCE file.
+# This script is free software; you can redistribute it and/or modify it under
+# the same terms as Perl itself, i.e. under the terms of either the GNU
+# General Public License or the Artistic License, as specified in the LICENCE
+# file.
#
#===============================================================================
diff --git a/t/pod_coverage.t b/t/pod_coverage.t index 56f6401..3d674d4 100644 --- a/t/pod_coverage.t +++ b/t/pod_coverage.t @@ -7,11 +7,13 @@ # Test script to check POD coverage.
#
# COPYRIGHT
-# Copyright (C) 2014 Steve Hay. All rights reserved.
+# Copyright (C) 2014, 2015 Steve Hay. All rights reserved.
#
# LICENCE
-# You may distribute under the terms of either the GNU General Public License
-# or the Artistic License, as specified in the LICENCE file.
+# This script is free software; you can redistribute it and/or modify it under
+# the same terms as Perl itself, i.e. under the terms of either the GNU
+# General Public License or the Artistic License, as specified in the LICENCE
+# file.
#
#===============================================================================
@@ -46,7 +48,7 @@ MAIN: { my $params = { coverage_class => qw(Pod::Coverage::CountParents) };
pod_coverage_ok('Net::Cmd', {
%$params,
- also_private => [qw(is_utf8 toascii toebcdic set_status)]
+ also_private => [qw(toascii toebcdic set_status)]
});
pod_coverage_ok('Net::Config', {
%$params,
diff --git a/t/pop3_ipv6.t b/t/pop3_ipv6.t index 004a642..1c88c1a 100644 --- a/t/pop3_ipv6.t +++ b/t/pop3_ipv6.t @@ -27,7 +27,7 @@ my $srv = $inet6class->new( ); plan skip_all => "cannot create listener on ::1: $!" if ! $srv; my $saddr = "[".$srv->sockhost."]".':'.$srv->sockport; -diag("server on $saddr"); +note("server on $saddr"); plan tests => 1; @@ -35,7 +35,7 @@ defined( my $pid = fork()) or die "fork failed: $!"; exit(pop3_server()) if ! $pid; my $cl = Net::POP3->new($saddr, Debug => $debug); -diag("created Net::POP3 object"); +note("created Net::POP3 object"); if (!$cl) { fail("IPv6 POP3 connect failed"); } else { @@ -55,12 +55,12 @@ sub pop3_server { last; } elsif ( $cmd eq 'CAPA' ) { print $cl "+OK\r\n". - ".\r\n"; + ".\r\n"; } else { diag("received unknown command: $cmd"); print "-ERR unknown cmd\r\n"; } } - diag("POP3 dialog done"); + note("POP3 dialog done"); } diff --git a/t/pop3_ssl.t b/t/pop3_ssl.t index 31b2bbd..356de40 100644 --- a/t/pop3_ssl.t +++ b/t/pop3_ssl.t @@ -67,7 +67,7 @@ sub pop3_client { ); $sslopt{SSL} = 1 if $ssl; my $cl = Net::POP3->new($saddr, %sslopt, Debug => $debug); - diag("created Net::POP3 object"); + note("created Net::POP3 object"); if (!$cl) { fail( ($ssl ? "SSL ":"" )."POP3 connect failed"); } elsif ($ssl) { @@ -106,13 +106,13 @@ sub pop3_server { last; } elsif ( $cmd eq 'CAPA' ) { print $cl "+OK\r\n". - ( $ssl ? "" : "STLS\r\n" ). - ".\r\n"; + ( $ssl ? "" : "STLS\r\n" ). + ".\r\n"; } elsif ( ! $ssl and $cmd eq 'STLS' ) { print $cl "+OK starting ssl\r\n"; if ( ! IO::Socket::SSL->start_SSL($cl, %sslargs)) { - diag("initial ssl handshake with client failed"); - return; + diag("initial ssl handshake with client failed"); + return; } $ssl = 1; } else { @@ -121,5 +121,5 @@ sub pop3_server { } } - diag("POP3 dialog done"); + note("POP3 dialog done"); } diff --git a/t/require.t b/t/require.t index a48951a..70ec1f6 100644 --- a/t/require.t +++ b/t/require.t @@ -6,10 +6,10 @@ use strict; use warnings; BEGIN { - if (!eval { require Socket; 1 }) { + if (!eval { require Socket }) { print "1..0 # no Socket\n"; exit 0; } - if (ord('A') == 193 && !eval { require Convert::EBCDIC; 1 }) { + if (ord('A') == 193 && !eval { require Convert::EBCDIC }) { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } } @@ -6,10 +6,10 @@ use strict; use warnings; BEGIN { - if (!eval { require Socket; 1 }) { + if (!eval { require Socket }) { print "1..0 # no Socket\n"; exit 0; } - if (ord('A') == 193 && eval { require Convert::EBCDIC; 1 }) { + if (ord('A') == 193 && eval { require Convert::EBCDIC }) { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } } diff --git a/t/smtp_ipv6.t b/t/smtp_ipv6.t index 78a14fe..a31b6ff 100644 --- a/t/smtp_ipv6.t +++ b/t/smtp_ipv6.t @@ -27,7 +27,7 @@ my $srv = $inet6class->new( ); plan skip_all => "cannot create listener on ::1: $!" if ! $srv; my $saddr = "[".$srv->sockhost."]".':'.$srv->sockport; -diag("server on $saddr"); +note("server on $saddr"); plan tests => 1; @@ -35,7 +35,7 @@ defined( my $pid = fork()) or die "fork failed: $!"; exit(smtp_server()) if ! $pid; my $cl = Net::SMTP->new($saddr, Debug => $debug); -diag("created Net::SMTP object"); +note("created Net::SMTP object"); if (!$cl) { fail("IPv6 SMTP connect failed"); } else { @@ -57,12 +57,12 @@ sub smtp_server { print $cl "250 localhost\r\n"; } elsif ( $cmd eq 'EHLO' ) { print $cl "250-localhost\r\n". - "250 HELP\r\n"; + "250 HELP\r\n"; } else { diag("received unknown command: $cmd"); print "500 unknown cmd\r\n"; } } - diag("SMTP dialog done"); + note("SMTP dialog done"); } diff --git a/t/smtp_ssl.t b/t/smtp_ssl.t index 108d094..7290176 100644 --- a/t/smtp_ssl.t +++ b/t/smtp_ssl.t @@ -67,7 +67,7 @@ sub smtp_client { ); $sslopt{SSL} = 1 if $ssl; my $cl = Net::SMTP->new($saddr, %sslopt, Debug => $debug); - diag("created Net::SMTP object"); + note("created Net::SMTP object"); if (!$cl) { fail( ($ssl ? "SSL ":"" )."SMTP connect failed"); } elsif ($ssl) { @@ -108,13 +108,13 @@ sub smtp_server { print $cl "250 localhost\r\n"; } elsif ( $cmd eq 'EHLO' ) { print $cl "250-localhost\r\n". - ( $ssl ? "" : "250-STARTTLS\r\n" ). - "250 HELP\r\n"; + ( $ssl ? "" : "250-STARTTLS\r\n" ). + "250 HELP\r\n"; } elsif ( ! $ssl and $cmd eq 'STARTTLS' ) { print $cl "250 starting ssl\r\n"; if ( ! IO::Socket::SSL->start_SSL($cl, %sslargs)) { - diag("initial ssl handshake with client failed"); - return; + diag("initial ssl handshake with client failed"); + return; } $ssl = 1; } else { @@ -123,5 +123,5 @@ sub smtp_server { } } - diag("SMTP dialog done"); + note("SMTP dialog done"); } @@ -6,10 +6,10 @@ use strict; use warnings; BEGIN { - if (!eval { require Socket; 1 }) { + if (!eval { require Socket }) { print "1..0 # no Socket\n"; exit 0; } - if (ord('A') == 193 && !eval { require Convert::EBCDIC; 1 }) { + if (ord('A') == 193 && !eval { require Convert::EBCDIC }) { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } $INC{'IO/Socket.pm'} = 1; |