Making changes mutatis mutandis to Net::SMTP::SSL, I "created" Net::POP3::SSL. Then used the test code given below to connect to a pop3 server (using Net::POP3 and Net::POP3::SSL, one at a time). Both attempts succeeded, as shown by the output.

However, both outputs look alike (except for the leading tag)!

What exactly needs to be done in the user-code so that the output would explicitly show ssl'ish things happening in one case and non-ssl'ish things happening in the other case? For example, how would one print out the messages being exchanged by the local machine and the pop server and show that in one case the messages are in plain text and in the other case the messages are ssl-encrypted?

#!/use/bin/perl BEGIN {(*STDERR = *STDOUT) || die;} use diagnostics; use warnings; use strict; $| = 1; { package Net::POP3::SSL; # $Id: SSL.pm,v 1.1 2004/07/20 03:22:18 cwest Exp $ use strict; use vars qw[$VERSION @ISA]; $VERSION = sprintf "%d.%02d", split m/\./, (qw$Revision: 1.1 $)[1]; use IO::Socket::SSL; use Net::POP3; @ISA = ( 'IO::Socket::SSL', grep { $_ ne 'IO::Socket::INET' } @Net::POP3::ISA ); no strict 'refs'; foreach ( keys %Net::POP3:: ) { next unless defined *{$Net::POP3::{$_}}{CODE}; *{$_} = \&{"Net::POP3::$_"}; } 1; } my $pop_host = '<pop.host>'; my $pop_port = 995; my $user_id = '<user_id>'; my $password = '<password>'; my %pop_options = ( Host => $pop_host, LocalPort => $pop_port, #ResvPort => 1, # Timeout => 30, Debug => 4, ); my %pop_ssl_options = ( Host => $pop_host, Port => $pop_port, #ResvPort => 1, # Timeout => 30, Debug => 4, ); test_pop(); sub test_pop { my $mail =''; if(!($mail = Net::POP3::SSL->new(%pop_ssl_options))) #if(!($mail = Net::POP3->new(%pop_options))) { print "ERROR: Could not open $pop_host\n$!\n"; return -1; } my $number_of_messages = $mail->login($user_id, $password); if(!$number_of_messages) { (defined $number_of_messages) or print "ERROR: Login error for +$pop_host\n$!\n"; $mail->quit(); return -1; } print "Number of messages: $number_of_messages\n"; } __END__ Output: Net::POP3>>> Net::POP3(2.29) Net::POP3>>> Net::Cmd(2.29) Net::POP3>>> Exporter(5.60) Net::POP3>>> IO::Socket::INET(1.31) Net::POP3>>> IO::Socket(1.30) Net::POP3>>> IO::Handle(1.27) Net::POP3=GLOB(0x1d699cc)<<< +OK hello from popgate on pop104.plus.mai +l.stuff.com 2.38.1 Net::POP3=GLOB(0x1d699cc)>>> USER <user_name> Net::POP3=GLOB(0x1d699cc)<<< +OK password required. Net::POP3=GLOB(0x1d699cc)>>> PASS .... Net::POP3=GLOB(0x1d699cc)<<< +OK maildrop ready, 452 messages (5836296 + octets) (6062525 3105357824) Number of messages: 452 Net::POP3::SSL>>> Net::POP3::SSL(1.01) Net::POP3::SSL>>> IO::Socket::SSL(1.08) Net::POP3::SSL>>> IO::Socket::INET(1.31) Net::POP3::SSL>>> IO::Socket(1.30) Net::POP3::SSL>>> IO::Handle(1.27) Net::POP3::SSL>>> Exporter(5.60) Net::POP3::SSL>>> Net::Cmd(2.29) Net::POP3::SSL=GLOB(0x1d69a0c)<<< +OK hello from popgate on pop106.plu +s.mail.stuff.com 2.38.1 Net::POP3::SSL=GLOB(0x1d69a0c)>>> USER <user_name> Net::POP3::SSL=GLOB(0x1d69a0c)<<< +OK password required. Net::POP3::SSL=GLOB(0x1d69a0c)>>> PASS .... Net::POP3::SSL=GLOB(0x1d69a0c)<<< +OK maildrop ready, 447 messages (58 +08500 octets) (6034729 3105357824) Number of messages: 447

In reply to Peeking into a POP3-SSL exchange by sg

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.