xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/Net/demos/pop3 (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!/usr/local/bin/perl -w
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateuse blib;
4*0Sstevel@tonic-gateuse Net::POP3;
5*0Sstevel@tonic-gateuse Getopt::Long;
6*0Sstevel@tonic-gate
7*0Sstevel@tonic-gate$opt_debug = 0;
8*0Sstevel@tonic-gate$opt_user = undef;
9*0Sstevel@tonic-gate
10*0Sstevel@tonic-gateGetOptions(qw(debug user=s));
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gate$pop = Net::POP3->new('backup3', Debug => $opt_debug ? 6 : 0);
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gate$user = $opt_user || $ENV{USER} || $ENV{LOGNAME};
15*0Sstevel@tonic-gate
16*0Sstevel@tonic-gate$count = $pop->login($user);
17*0Sstevel@tonic-gate
18*0Sstevel@tonic-gateif($count)
19*0Sstevel@tonic-gate {
20*0Sstevel@tonic-gate  $m = $pop->get(1);
21*0Sstevel@tonic-gate  print @$m if $m;
22*0Sstevel@tonic-gate }
23*0Sstevel@tonic-gate
24*0Sstevel@tonic-gate$pop->quit;
25