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

[MacPerl] MacPerl to Unix Perl Gotcha :-)



Well, yesterday I spent about six hours tracking down an
error which I thought I'd pass along.  It's a prgramming
error and not a Perl error per se.  :-)

Basically, on the Mac I had used the libnet routines to
send and receive mail to a Perl script and everything
worked well.  But then came the time to move the whole
program over to the Unix box where the web server was.  So
I decided to make use of the system mail facility.  An
easily submitted command:

	system( "mail $userName < $theFile" );

for the libnet calls seemed preferrable.  Saves time, saves
disk space, code space, blah, blah, blah.... :-)

Well - these programs also generated HTML code and sent
that back to the server.  BUT!  There's one thing I had
completely overlooked!  :-)  The SYSTEM command - sometimes
- returns a status.  In this case, it sometimes would
return "No Mail" if the $userName variable did not contain
anything.  This (of course) caused all of the HTML pages to
return an error since the first line returning to the web
server wasn't a "Content-type:" command.

So what's the morale of the story?  Hell - I don't know.
I'm just trying to show where an error can occur in a
program when you move from one OS to another.  Make up your
own morale!  ;-)