[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

re: [MacPerl] SMTP.pm problems



"Robert A. Decker" <comrade@umich.edu> writes:
} 
}   I'm trying to use SMTP.pm with the following sample program:
} 
}     use Net::SMTP;
}     $smtp =3D Net::SMTP->new('smtp.itd.umich.edu');
}     print $smtp->domain,"\n";
}     $smtp->quit;
} 
}   The syntax checks fine, but when I try to run it I get the following
} error:
} # Can't locate object method "SUPER::new" via package "Net::SMTP".
} File 'Zip 100:Perl:MacPerl 5.1.0r2?:lib:Net:SMTP.pm'; Line 223

Two possibilities come to mind.  First, where did you get Net::SMTP? If
you're trying to use libnet straight from CPAN, it won't work without
modification.  I've done the port of libnet, and the ported version, at
<ftp://mors.gsfc.nasa.gov/pub/MacPerl/Scripts/Beta/libnet-1.01.sit.hqx>,
works under MacPerl.  (After tomorrow morning, Oct 28 EST, take the
/Beta out of this path).  Offhand, though, I don't see why you'd get
this rather than some other error if you tried using the CPAN version
straight out of the box.

The more likely reason is that SMTP.pm inherets from IO::Socket::INET.
If I've read and understood the @ISA's properly, I think SUPER::new is
IO::Socket::new.  Make sure you have a :lib:IO:Socket.pm file.  If
you're using a 680x0 Mac, I don't believe that ultimately any Socket
stuff will work unless you're using BigMacPerl.  If you're using a PPC,
make sure you have :lib:IO:Socket.pm and that your shared libraries are
still in the :lib:auto folder (make sure that Socket and IO have shared
libraries in them).  My guess is that :IO:Socket.pm has been lost for
some reason (it either got deleted or it got moved out of MacPerl's
library search path), since it does come with the standard MacPerl
5.10r2 distribution.

I just tried my standard Net::SMTP test script, and it worked just fine
with BigMacPerl 5.10r2.  Here it is:

#!/usr/local/bin/perl

use Net::SMTP;

open(LINES,"Macintosh HD:Macintosh:english.txt") or die "can't open file";
@lines = <LINES>; # the newlines are needed
unshift(@lines,"From: schinder\@leprss.gsfc.nasa.gov\n",
               "To: schinder\@leprss.gsfc.nasa.gov\n",
               "Subject: Testing\n","\n");
$me = `hostname`;chomp($me);
$mail = Net::SMTP->new("leprss.gsfc.nasa.gov",Debug => 1);
$mail->hello($me);
$mail->mail("schinder\@leprss.gsfc.nasa.gov");
$mail->to("schinder\@leprss.gsfc.nasa.gov");
$mail->data(@lines);
$mail->quit;

You, will, of course, want to change things, and be careful of using too
large a file with the Debug switch on, because it prints everything it
sends to STDERR.

[snip]
} 
} 
} any ideas? Has anyone gotten SMTP.pm to work?
} 
} rob
} --
} <mailto: "Robert A. Decker" comrade@umich.edu>
} Programmer Analyst - Health Media Research Lab
} University of Michigan Comprehensive Cancer Center 
} 
} "Get A Life" quote #14: "Boy, this is like a dream come true! First I
} get an incredibly gorgeous genius girlfriend, and then I get to be an
} experimental Guinea pig! No offense to our Italian friends." 
} -Chris Elliott
} 
} 
} 
---
--------
Paul J. Schinder
NASA Goddard Space Flight Center,
Code 693, Greenbelt, MD 20771 USA
schinder@pjstoaster.pg.md.us